From: Brian S. Stephan Date: Thu, 22 Jan 2009 06:21:44 +0000 (-0600) Subject: working version of irssi formats + delayed tweet printing. uses an array of arrays... X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/commitdiff_plain/e7bb2465a311967042e04b63f5f4526a4b4f35bd?ds=sidebyside;hp=77ff80bc4cf6b780b63a41a7ce261546c571d00a working version of irssi formats + delayed tweet printing. uses an array of arrays to stuff important info and prints shortly later --- diff --git a/twirssi.pl b/twirssi.pl index 444aac6..9fc47bc 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -734,16 +734,13 @@ sub monitor_child { } if ( $meta{type} eq 'tweet' ) { - $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_tweet', - $account, $meta{nick}, $marker, $_); + push @lines, [$meta{type}, $account, $meta{nick}, $marker, $_]; } elsif ( $meta{type} eq 'reply' ) { - $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_reply', - $account, $meta{nick}, $marker, $_); + push @lines, [$meta{type}, $account, $meta{nick}, $marker, $_]; } elsif ( $meta{type} eq 'dm' ) { - $window->printformat(MSGLEVEL_PUBLIC, 'twirssi_dm', - $account, $meta{nick}, $_); + push @lines, [$meta{type}, $account, $meta{nick}, $_]; } elsif ( $meta{type} eq 'error' ) { - $window->print("ERROR: $_", MSGLEVEL_PUBLIC); + push @lines, [$_]; } elsif ( $meta{type} eq 'debug' ) { print "$_" if &debug,; } else { @@ -763,6 +760,10 @@ sub monitor_child { if ($new_last_poll) { print "new last_poll = $new_last_poll" if &debug; + for my $line ( @lines ) { + $window->printformat(MSGLEVEL_PUBLIC, "twirssi_".@$line[0], + @$line[1,2,3,4]); + } close FILE; unlink $filename @@ -910,6 +911,7 @@ 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', + 'twirssi_error', 'ERROR: $0', ]); Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );