X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/blobdiff_plain/ba48424a621abb05eb7219d01cdac67e2f474b9d..5223d4907b82fb18426bbd7e53619ccb4855d778:/twirssi.pl?ds=inline diff --git a/twirssi.pl b/twirssi.pl index 46d2e2c..ba254dd 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -19,7 +19,7 @@ BEGIN { use vars qw($VERSION %IRSSI); $VERSION = "1.7.3"; -my ($REV) = '$Rev: 353 $' =~ /(\d+)/; +my ($REV) = '$Rev: 354 $' =~ /(\d+)/; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -28,7 +28,7 @@ my ($REV) = '$Rev: 353 $' =~ /(\d+)/; . 'Can optionally set your bitlbee /away message to same', license => 'GNU GPL v2', url => 'http://tinyurl.com/twirssi', - changed => '$Date: 2009-01-08 14:17:30 -0800 (Thu, 08 Jan 2009) $', + changed => '$Date: 2009-01-08 14:46:04 -0800 (Thu, 08 Jan 2009) $', ); my $window; @@ -615,8 +615,8 @@ sub do_updates { foreach my $t ( reverse @$tweets ) { my $text = decode_entities( $t->{text} ); - $text =~ s/%/%%/g; - $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g; + $text =~ s/(^|\W)\@([-\w]+)/$1\cC12\@$2\cC/g; + $text =~ s/[\n\r]/ /g; my $reply = "tweet"; if ( Irssi::settings_get_bool("show_reply_context") and $t->{in_reply_to_screen_name} ne $username @@ -631,8 +631,8 @@ sub do_updates { if ($context) { my $ctext = decode_entities( $context->{text} ); - $ctext =~ s/%/%%/g; - $ctext =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g; + $ctext =~ s/(^|\W)\@([-\w]+)/$1\cC12\@$2\cC/g; + $ctext =~ s/[\n\r]/ /g; printf $fh "id:%d account:%s nick:%s type:tweet %s\n", $context->{id}, $username, $context->{user}{screen_name}, $ctext; @@ -668,8 +668,8 @@ sub do_updates { if exists $friends{ $t->{user}{screen_name} }; my $text = decode_entities( $t->{text} ); - $text =~ s/%/%%/g; - $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g; + $text =~ s/(^|\W)\@([-\w]+)/$1\cC12\@$2\cC/g; + $text =~ s/[\n\r]/ /g; printf $fh "id:%d account:%s nick:%s type:tweet %s\n", $t->{id}, $username, $t->{user}{screen_name}, $text; } @@ -688,8 +688,8 @@ sub do_updates { foreach my $t ( reverse @$tweets ) { my $text = decode_entities( $t->{text} ); - $text =~ s/%/%%/g; - $text =~ s/(^|\W)\@([-\w]+)/$1%B\@$2%n/g; + $text =~ s/(^|\W)\@([-\w]+)/$1\cC12\@$2\cC/g; + $text =~ s/[\n\r]/ /g; printf $fh "id:%d account:%s nick:%s type:dm %s\n", $t->{id}, $username, $t->{sender_screen_name}, $text; } @@ -738,13 +738,16 @@ sub monitor_child { } if ( $meta{type} eq 'tweet' ) { - push @lines, "[$account%B\@$meta{nick}%n$marker] $_\n",; + $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_tweet', + $account, $meta{nick}, $marker, $_); } elsif ( $meta{type} eq 'reply' ) { - push @lines, "[$account\\--> %B\@$meta{nick}%n$marker] $_\n",; + $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_reply', + $account, $meta{nick}, $marker, $_); } elsif ( $meta{type} eq 'dm' ) { - push @lines, "[$account%B\@$meta{nick}%n (%WDM%n)] $_\n",; + $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_dm', + $account, $meta{nick}, $_); } elsif ( $meta{type} eq 'error' ) { - push @lines, "ERROR: $_\n"; + $window->print("ERROR: $_", MSGLEVEL_PUBLIC); } elsif ( $meta{type} eq 'debug' ) { print "$_" if &debug,; } else { @@ -764,13 +767,6 @@ sub monitor_child { if ($new_last_poll) { print "new last_poll = $new_last_poll" if &debug; - foreach my $line (@lines) { - chomp $line; - $window->print( $line, MSGLEVEL_PUBLIC ); - foreach ( $line =~ /\@([-\w]+)/ ) { - $nicks{$1} = time; - } - } close FILE; unlink $filename @@ -897,6 +893,12 @@ sub sig_complete { } } +Irssi::theme_register([ + 'twirssi_tweet', '[$0%B@$1%n$2] $3', + 'twirssi_reply', '[$0\--> %B@$1%n$2] $3', + 'twirssi_dm', '[$0%B@$1%n (%WDM%n)] $2', +]); + Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" ); Irssi::settings_add_str( "twirssi", "bitlbee_server", "bitlbee" ); Irssi::settings_add_str( "twirssi", "short_url_provider", "TinyURL" );