From ae1bcb2c07259b05d40c3a09c7e7dd5b1feb2f43 Mon Sep 17 00:00:00 2001 From: nwf Date: Fri, 22 May 2009 00:38:19 -0400 Subject: [PATCH] Add initial support for bot response MMF Ignore-this: 9bf62adaa9f3ae089b56a01f61e2f980 darcs-hash:20090522043819-4d648-baa8488a366c3a2129c472b2f006373288af1650.gz --- IrssiInterface.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IrssiInterface.pl b/IrssiInterface.pl index dcbef70..02c188f 100644 --- a/IrssiInterface.pl +++ b/IrssiInterface.pl @@ -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/; -- 2.50.1