basic (but working) support for tweeting non-command input to the twitter window
authorBrian S. Stephan <bss@emptymatter.org>
Fri, 9 Jan 2009 05:49:50 +0000 (23:49 -0600)
committerBrian S. Stephan <bss@emptymatter.org>
Fri, 9 Jan 2009 05:49:50 +0000 (23:49 -0600)
twirssi.pl

index ba254dd80fa0437475991f7a8df7a351d0f1a352..6358591b9b6e4bfeffbea0b8e266a22239b61cde 100644 (file)
@@ -893,6 +893,20 @@ sub sig_complete {
     }
 }
 
+sub event_send_text {
+    my ( $line, $server, $win ) = @_;
+    my $awin = Irssi::active_win();
+
+    # if the window where we got our text was the twitter window, and the user
+    # wants to be lazy, tweet away!
+    if ( ($awin->get_active_name() eq $window->{name})
+         and Irssi::settings_get_bool("tweet_window_input") ) {
+        &cmd_tweet($line, $server, $win);
+    }
+}
+
+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',
@@ -915,6 +929,7 @@ Irssi::settings_add_bool( "twirssi", "twirssi_debug",             0 );
 Irssi::settings_add_bool( "twirssi", "twirssi_first_run",         1 );
 Irssi::settings_add_bool( "twirssi", "twirssi_track_replies",     1 );
 Irssi::settings_add_bool( "twirssi", "twirssi_use_reply_aliases", 0 );
+Irssi::settings_add_bool( "twirssi", "tweet_window_input",        0 );
 $window = Irssi::window_find_name( Irssi::settings_get_str('twitter_window') );
 
 if ($window) {