From: Brian S. Stephan Date: Wed, 21 Jan 2009 01:25:45 +0000 (-0600) Subject: Merge branch 'master' into bss X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/commitdiff_plain/72072cf458f1b196171415b4e99ebf9d9c37301e?hp=-c Merge branch 'master' into bss --- 72072cf458f1b196171415b4e99ebf9d9c37301e diff --combined twirssi.pl index 1b78253,ad7bf88..f43b203 --- a/twirssi.pl +++ b/twirssi.pl @@@ -11,8 -11,8 +11,8 @@@ $Data::Dumper::Indent = 1 use vars qw($VERSION %IRSSI); - $VERSION = "1.7.4"; - my ($REV) = '$Rev: 358 $' =~ /(\d+)/; + $VERSION = "1.7.5"; + my ($REV) = '$Rev: 374 $' =~ /(\d+)/; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@@ -21,7 -21,7 +21,7 @@@ . 'Can optionally set your bitlbee /away message to same', license => 'GNU GPL v2', url => 'http://tinyurl.com/twirssi', - changed => '$Date: 2009-01-13 21:02:17 -0800 (Tue, 13 Jan 2009) $', + changed => '$Date: 2009-01-19 23:31:12 -0800 (Mon, 19 Jan 2009) $', ); my $window; @@@ -597,8 -597,11 +597,11 @@@ sub do_updates unless ( ref $tweets ) { if ( $obj->can("get_error") ) { + my $error; + eval { $error = JSON::Any->jsonToObj( $obj->get_error() ) }; + if ($@) { $error = $obj->get_error() } print $fh "type:debug API Error during friends_timeline call: ", - JSON::Any->jsonToObj( $obj->get_error() ), " Aborted.\n"; + "$error Aborted.\n"; } else { print $fh "type:debug API Error during friends_timeline call. Aborted.\n"; @@@ -608,7 -611,8 +611,7 @@@ 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") @@@ -624,7 -628,8 +627,7 @@@ 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, @@@ -661,7 -666,8 +664,7 @@@ 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; @@@ -681,7 -687,8 +684,7 @@@ 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; @@@ -731,16 -738,13 +734,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 { @@@ -760,6 -764,13 +763,6 @@@ 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 @@@ -901,12 -912,6 +904,12 @@@ sub event_send_text Irssi::signal_add( "send text", "event_send_text" ); +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" );