# twitter.pl, for irssi+BitlBee+twitter # tristan+perl@ethereal.net 19dec2007 # todo: find window named "twitter" and print there if it exists use Irssi; use strict; use vars qw($VERSION %IRSSI); $VERSION = '1.00'; %IRSSI = ( authors => 'Tristan Horn', contact => 'tristan+perl@ethereal.net', name => 'Twitter', description => 'This script beautifies incoming Twitter-via-BitlBee messages.', license => 'Public Domain', ); Irssi::theme_register([ twitter_msg => '[%B$0%K/twitter%n] $1-', twitter_other => '[%Ktwitter%n] $1-' ]); sub sig_twitter_privmsg { my($server, $msg, $nick, $address) = @_; if ($nick =~ /^twitter/i) { if ($msg =~ /: /) { Irssi::printformat(MSGLEVEL_NOTICES, 'twitter_msg', $`, $'); } else { Irssi::printformat(MSGLEVEL_NOTICES, 'twitter_other', $msg); } Irssi::signal_stop(); } } Irssi::signal_add('message private', 'sig_twitter_privmsg');