Skip to content

Commit

Permalink
Cleaned up tweet output.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 9, 2017
1 parent 0430bad commit aec2d1a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gopherspace/twitter
Expand Up @@ -5,6 +5,7 @@ use warnings;
use Net::Twitter;
use LWP::Simple;
use Text::Unidecode;
use Text::Wrap;
#use Data::Dumper;

binmode STDOUT, ':utf8';
Expand Down Expand Up @@ -90,7 +91,14 @@ my %commands = (
$text = unidecode($text);

send_gopher_menu('i', "\@$user - $created_at");
send_gopher_menu('i', $text);
send_gopher_menu('i');

$Text::Wrap::columns = 72;
$text = wrap('', '', $text);
my @lines = split /^/, $text;
foreach (@lines) { chomp;
send_gopher_menu('i', $_);
}
send_gopher_menu('i');

if (defined $in_reply_to) {
Expand Down Expand Up @@ -163,6 +171,8 @@ my %commands = (
send_gopher_menu('1', 'Turn on retweets.', "twitter/user/$user/$with_replies_str/with_retweets", $host, $port);
}

send_gopher_menu('i');

foreach my $tweet (@$tweets) {
my $author = $tweet->{'user'}->{'screen_name'};
next if (defined $tweet->{'in_reply_to_status_id_str'} and not $with_replies);
Expand Down

0 comments on commit aec2d1a

Please sign in to comment.