]> hydra-www.ietfng.org Git - instirc/commitdiff
Add initial support for bot response MMF
authornwf <nwf@cs.jhu.edu>
Fri, 22 May 2009 04:38:19 +0000 (00:38 -0400)
committernwf <nwf@cs.jhu.edu>
Fri, 22 May 2009 04:38:19 +0000 (00:38 -0400)
Ignore-this: 9bf62adaa9f3ae089b56a01f61e2f980

darcs-hash:20090522043819-4d648-baa8488a366c3a2129c472b2f006373288af1650.gz

IrssiInterface.pl

index dcbef701fbd894091481538eea7786dae029002c..02c188f545051978fcd4b77ae3cd3e1e626fbb3f 100644 (file)
@@ -107,6 +107,7 @@ sub demangle_and_check_routes($$$) {
   my $target = undef;
   my $instance_label = undef;
   my $warn_initial = 0;
+  my $is_bot = 0;
   my @unknowns = ( );
     # Last one wins approach to instance labels.  Sending more than one
     # really ought be an error.
@@ -116,6 +117,12 @@ sub demangle_and_check_routes($$$) {
                   my ($t,$v) = @_;
                   $instance_label = $hc->decode($v);
                 }
+              , $known_types{'MiscMessageFlags'} => 
+                sub ($$) {
+                  my ($t,$v) = @_;
+                  my $dec = $mc->tdecode($v);
+                  $is_bot = $dec & 1 if ($dec > 2);
+                }
               , 'warn_initial' => sub () { $warn_initial = 1; }
               , 'default' => 
                 sub ($$) { my ($t,$v) = @_; push @unknowns, $t; }
@@ -131,6 +138,11 @@ 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) {
     $rest =~ s/^(.*)$instance_suffix$/$1/;