]> git.sommitrealweird.co.uk Git - twirssi-net-twitter-lite.git/blobdiff - twirssi.pl
Add twitter_block and twitter_unblock commands
[twirssi-net-twitter-lite.git] / twirssi.pl
index 331715ce03737fbfe13a9606df4d34fc16799292..48b01087556da95a53da05914d4322f6755dd864 100644 (file)
@@ -504,7 +504,7 @@ sub cmd_login {
         return;
     }
 
-    if ( my $timeout = Irssi::settings_get_int("twitter_timeout") ) {
+    if ( my $timeout = Irssi::settings_get_int("twitter_timeout") and $twit->can('ua')) {
         $twit->ua->timeout($timeout);
     }
 
@@ -1623,6 +1623,22 @@ if ($window) {
             sub { &notice("Device updated to $_[0]"); }
         )
     );
+    Irssi::command_bind(
+        "twitter_block",
+        &gen_cmd(
+            "/twitter_block <username>",
+            "create_block",
+            sub { &notice("Blocked $_[0]"); }
+        )
+    );
+    Irssi::command_bind(
+        "twitter_unblock",
+        &gen_cmd(
+            "/twitter_unblock <username>",
+            "destroy_block",
+            sub { &notice("Unblock $_[0]"); }
+        )
+    );
     Irssi::signal_add_last( 'complete word' => \&sig_complete );
 
     &notice("  %Y<%C(%B^%C)%N                   TWIRSSI v%R$VERSION%N (r$REV)");