]> hydra-www.ietfng.org Git - instirc/commitdiff
Correct IrssiInstancer to print {bot} even when no instance tag is present
authornwf <nwf@cs.jhu.edu>
Mon, 3 Aug 2009 04:13:42 +0000 (00:13 -0400)
committernwf <nwf@cs.jhu.edu>
Mon, 3 Aug 2009 04:13:42 +0000 (00:13 -0400)
Ignore-this: 4135df032bc2907e3d0fb25b33345406

darcs-hash:20090803041342-4d648-d36ba3ae975e7f173390cae6d9532418f0397bf3.gz

IrssiInstancer.pl

index ddec1ef89560557e59385d89edf4a4704d481e82..dd1994ecabdea0a94293c774556ae8561151d8f2 100644 (file)
@@ -121,6 +121,7 @@ sub demangle_and_check_routes($$$) {
                 sub ($$) {
                   my ($t,$v) = @_;
                   my $dec = $mc->tdecode($v);
+                  # XXX This knowledge ought be in Definitions.pm
                   $is_bot = $dec & 1 if ($dec > 2);
                 }
               , 'warn_initial' => sub () { $warn_initial = 1; }
@@ -138,22 +139,24 @@ sub demangle_and_check_routes($$$) {
     Irssi::print("Instancer: warning: unknown message types " . (join " ",@unknowns));
   }
 
-  # XXX This is pretty hacky.
-  if ($res and $is_bot) {
-    $rest = "{bot} " . $rest;
-  }
-
-  if ($res and defined $instance_label) {
-    # Find window item given server and name
-    my $witem = $srv->window_item_find($channame);
+  if ($res) {
+    
+    # XXX This is pretty hacky.
+    if ($is_bot) {
+        $rest = "{bot} " . $rest;
+    }
+    
+    if (defined $instance_label) {
+      # Find window item given server and name
+      my $witem = $srv->window_item_find($channame);
 
-    if (not defined $witem) {
+      if (not defined $witem) {
         Irssi::print("No witem while decoding?");
         return (undef, undef, $text);
-    }
+      }
 
-    # override channel name; this may undefine the target.
-    if (inst_routed($witem, $instance_label)) {
+      # override channel name; this may undefine the target.
+      if (inst_routed($witem, $instance_label)) {
         Irssi::print("Instance $instance_label is routed...");
 
         # See if we have a target.
@@ -166,9 +169,12 @@ sub demangle_and_check_routes($$$) {
         } else {
             $rest = undef;
         }
-    }
+      }
 
-    return ($target, $instance_label, $rest);
+      return ($target, $instance_label, $rest);
+    } else {
+      return (undef, undef, $rest);
+    } 
   }
 
   return (undef, undef, $text);