1 # This file is part of SurrealServices.
3 # SurrealServices is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # SurrealServices is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with SurrealServices; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 package SrSv
::IRCd
::Parse
;
21 use Exporter
'import';
22 # parse_sjoin shouldn't get used anywhere else, as we never produce SJOINs
23 # parse_tkl however is used for loopbacks.
24 BEGIN { our @EXPORT_OK = qw(parse_line parse_tkl parse_addline) }
27 BEGIN { *SJB64
= \
&ircd
::SJB64
; *CLK
= \
&ircd
::CLK
; *NICKIP
= \
&ircd
::NICKIP
; }
29 use SrSv
::Conf
'main';
30 use SrSv
::Conf2Consts
'main';
35 require Socket6
; import Socket6
;
40 use SrSv
::IRCd
::State
qw($ircline $remoteserv create_server get_server_children set_server_state get_server_state %IRCd_capabilities);
41 use SrSv
::IRCd
::Queue
qw(queue_size);
42 use SrSv
::IRCd
::IO
qw( ircsend ircsendimm);
43 use SrSv
::IRCd
::Send qw
(getRevUuid getUuid setRevUuid setUuid
);
44 use SrSv
::Unreal
::Modes
qw(%opmodes);
46 # Unreal uses its own modified base64 for everything except NICKIP
47 use SrSv
::Unreal
::Base64
qw(b64toi itob64);
49 # Unreal uses unmodified base64 for NICKIP.
50 # Consider private implementation,
51 # tho MIME's is probably faster
63 use SrSv
::Shared
qw(@servernum);
74 if($in =~ /^(?:@|:)(\S+) (\S+)/) {
77 elsif ($in =~ /^(\S+)/) {
80 my $sub = $cmdhash{$cmd};
81 unless (defined($sub)) {
82 print "Bailing out from $ircline:$cmd for lack of cmdhash\n" if DEBUG
();
85 my ($event, $src, $dst, $wf, @args) = &$sub($in);
86 unless (defined($event)) {
87 print "Bailing out from $ircline:$cmd for lack of event\n" if DEBUG
;
90 #return unless defined $event;
92 my (@recipients, @out);
94 #$args[$dst] = lc $args[$dst];
95 @recipients = split(/\,/, $args[$dst]);
97 #if(defined($src)) { $args[$src] = lc $args[$src]; }
100 foreach my $rcpt (@recipients) {
102 push @out, [$event, $src, $dst, $wf, [@args]];
105 @out = [$event, $src, $dst, $wf, [@args]];
110 #parse_fjoin($server, $channel, $ts, $modes, @nicks, @status)
111 sub parse_fjoin
($$$$$$) {
112 my ($server, $channel, $ts, $modes, $nicksref, $statusref) = @_;
113 my @status = @$statusref;
114 my @nicks = @$nicksref;
117 foreach my $nick (@nicks) {
119 my @ops = split ("",$status[$i]);
120 foreach my $prefix (@ops) {
121 $op |= $opmodes{$prefix};
123 push @users, { NICK
=> ircd
::getRevUuid
($nick), __OP
=> $op};
126 return ($server, $channel, $ts, $modes, undef, \
@users, undef, undef, undef); #those are got from FMODE...
128 sub parse_sjoin
($$$$) {
129 my ($server, $ts, $cn, $parms) = @_;
130 my (@users, @bans, @excepts, @invex, @blobs, $blobs, $chmodes, $chmodeparms);
132 $server = '' unless $server;
134 if($parms =~ /^:(.*)/) {
137 ($chmodes, $blobs) = split(/ :/, $parms, 2);
138 ($chmodes, $chmodeparms) = split(/ /, $chmodes, 2);
140 @blobs = split(/ /, $blobs);
142 foreach my $x (@blobs) {
143 if($x =~ /^(\&|\"|\')(.*)$/) {
145 push @bans, $2 if $1 eq '&';
146 push @excepts, $2 if $1 eq '"';
147 push @invex, $2 if $1 eq "\'";
149 $x =~ /^([*~@%+]*)(.*)$/;
150 my ($prefixes, $nick) = ($1, $2);
151 my @prefixes = split(//, $prefixes);
153 foreach my $prefix (@prefixes) {
154 $op |= $opmodes{q
} if ($prefix eq '*');
155 $op |= $opmodes{a
} if ($prefix eq '~');
156 $op |= $opmodes{o
} if ($prefix eq '@');
157 $op |= $opmodes{h
} if ($prefix eq '%');
158 $op |= $opmodes{v
} if ($prefix eq '+');
161 push @users, { NICK
=> $nick, __OP
=> $op };
165 return ($server, $cn, $ts, $chmodes, $chmodeparms, \
@users, \
@bans, \
@excepts, \
@invex);
167 sub parse_addline
($) {
169 #return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
170 #>> 47 :583AAAAAA ADDLINE G test@testie inspircd.erry.omg 1308118489 0 :hi
171 my ($setter, undef, $type, $mask, $server, $time, $expiry, $reason) = split (/ /, $line, 7);
176 my @masks = split (/@/,$mask, 1);
177 my $ident = $masks[0];
178 my $host = $masks[1];
179 #return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
180 return ($type, +1, $ident, $host, $setter, $expiry, $time, $reason);
184 # This function is intended to accept ALL tkl types,
185 # tho maybe not parse all of them in the first version.
187 # Discard first token, 'TKL'
188 my (undef, $sign, $type, $params) = split(/ /, $in, 4);
190 # Yes, TKL types are case sensitive!
191 # also be aware (and this applies to the net.pm generator functions too)
192 # This implementation may appear naiive, but Unreal assumes that, for a given
193 # TKL type, that all parameters are non-null.
194 # Thus, if any parameters ARE null, Unreal WILL segfault.
195 ## Update: this problem may have been fixed since Unreal 3.2.2 or so.
196 if ($type eq 'G' or $type eq 'Z' or $type eq 's' or $type eq 'Q') {
198 # TKL + type ident host setter expiretime settime :reason
199 # TKL - type ident host setter
200 # for Q, ident is always '*' or 'h' (Services HOLDs)
202 my ($ident, $host, $setter, $expire, $time, $reason) = split(/ /, $params, 6);
205 return ($type, +1, $ident, $host, $setter, $expire, $time, $reason);
207 elsif($sign eq '-') {
208 my ($ident, $host, $setter) = split(/ /, $params, 3);
209 return ($type, -1, $ident, $host, $setter);
212 elsif($type eq 'F') {
213 # TKL + F cpnNPq b saturn!attitude@netadmin.SCnet.ops 0 1099959668 86400 Possible_mIRC_DNS_exploit :\/dns (\d+\.){3}\d
214 # TKL + F u g saturn!attitude@saturn.netadmin.SCnet.ops 0 1102273855 604800 sploogatheunbreakable:_Excessively_offensive_behavior,_ban_evasion. :.*!imleetnig@.*\.dsl\.mindspring\.com
215 # TKL - F u Z tabris!northman@tabris.netadmin.SCnet.ops 0 0 :do_not!use@mask
217 my ($target, $action, $setter, $expire, $time, $bantime, $reason, $mask) = split(/ /, $params, 8);
219 return ($type, +1, $target, $action, $setter, $expire, $time, $bantime, $reason, $mask);
221 elsif($sign eq '-') {
222 my ($target, $action, $setter, $expire, $time, $mask) = split(/ /, $params, 6);
224 return ($type, -1, $target, $action, $setter, $mask);
230 my ($event, $src, $dst, @args);
231 $_[0] =~ /^(?:8|PING) :(\S+)$/;
232 # ($event, $src, $dst, $args)
233 return ('PING', undef, undef, WF_NONE
, $1);
236 #:583 UID 583AAAAAJ 1307703236 erry__ localhost localhost errietta 127.0.0.1 1307703241 + :errietta
237 $_[0] =~ /^(:\S+) UID (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) (\S+) (\d+) (\S+) :(.*)$/;
238 my ($server, $uid, $ts, $nick, $host, $vhost, $ident, $IP, $stamp, $modes, $gecos) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);
239 ircd
::setRevUuid
($uid, $nick);
240 ircd
::setUuid
($nick, $uid);
241 return ('NICKCONN', undef, undef, WF_NICK
, $nick, 0, $ts, $ident, $host, $server, $stamp, $modes, $vhost, $gecos,
242 join('.', unpack('C4', MIME
::Base64
::decode
($IP))));
247 if ($_[1] != "ENDBURST") {
248 $_[0] =~ /^(@|:)(\S+) (?:EOS|ES)/; # Sometimes there's extra crap on the end?
251 $server = $servernum[b64toi
($2)];
256 set_server_state
($server, 1);
257 return undef() unless get_server_state
($remoteserv);
258 if($server eq $remoteserv) { $event = 'SEOS' } else { $event = 'EOS' }
259 print "Ok. we had EOS\n";
260 return ($event, undef, undef, WF_ALL
, $server);
263 print "This be it! Got endbrust!\n";
264 return ("ENDBURST", undef, undef, WF_ALL
, $1);
269 #ircd::debug($_[0]) if $debug;
270 if($_[0] =~ /^(?:SERVER|\') (\S+) (\S+) :(U[0-9]+)-([A-Za-z0-9]+)-([0-9]+) (.*)$/) {
271 # SERVER test-tab.surrealchat.net 1 :U2307-FhinXeOoZEmM-200 SurrealChat
272 # cmd, servername, hopCount, U<protocol>-<buildflags>-<numeric> infoLine
277 return ('SERVER', undef, undef, WF_ALL
, undef, $1, $2, $6, $5, $3, $4);
278 # src, serverName, numHops, infoLine, serverNumeric, protocolVersion, buildFlags
280 elsif($_[0] =~ /^(:|@)(\S+) (?:SERVER|\') (\S+) (\d+) (\d+) :(.*)$/) {
281 # @38 SERVER test-hermes.surrealchat.net 2 100 :SurrealChat
282 # source, cmd, new server, hopCount, serverNumeric, infoLine
283 my ($numeric, $name);
285 $name = $servernum[b64toi
($2)];
290 create_server
($3, $name);
293 return ('SERVER', undef, undef, WF_ALL
, $name, $3, $4, $6, $5);
294 # src, serverName, numHops, infoLine, serverNumeric
296 if($_[0] =~ /^(?:SERVER|\') (\S+) (\S+) :(.*)$/) {
299 return ('SERVER', undef, undef, WF_ALL
, undef, $1, $2, $3);
300 # src, serverName, numHops, infoLine
302 elsif($_[0] =~ /^:(\S+) (?:SERVER|\') (\S+) (\d+) :(.*)$/) {
303 # source, new server, hop count, description
304 create_server
($2, $1);
305 return ('SERVER', undef, undef, WF_ALL
, $1, $2, $3, $4);
306 # src, serverName, numHops, infoLine
311 if($_[0] =~ /^(?:SQUIT|-) (\S+) :(.*)$/) {
312 my $list = [get_server_children
($1)];
313 set_server_state
($1, undef());
314 return ('SQUIT', undef, undef, WF_ALL
, undef, $list, $2);
316 elsif($_[0] =~ /^(:|@)(\S+) (?:SQUIT|-) (\S+) :(.*)$/) {
319 $name = $servernum[b64toi
($2)];
324 my $list = [get_server_children
($3)];
325 set_server_state
($3, undef());
326 return ('SQUIT', undef, undef, WF_ALL
, $name, $list, $4);
331 $_[0] =~ /^(?:NETINFO|AO) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) :(.*)$/;
332 return ('NETINFO', undef, undef, WF_NONE
, $1, $2, $3, $4, $5, $6, $7, $8);
336 $_[0] =~ /^PROTOCTL (.*)$/;
337 return ('PROTOCTL', undef, undef, WF_NONE
, $1);
341 $_[0] =~ /^:(\S+) (?:C|JOIN) (\S+)$/;
342 return ('JOIN', undef, 1, WF_CHAN
, $1, $2);
344 #>> 13 :97K FJOIN #erry 1307879417 +nt :o,97KAAAAAA ,97KAAAAAB
346 $_[0] =~ m
"^(:\S+) FJOIN (\S+) (\d+) (\S+) (.*)$";
347 my ($server, $channel, $ts, $modes, $userstring) = ($1, $2, $3, $4, $5);
348 my @users = split (" ", $userstring);
349 my (@nicks, @status);
350 foreach my $user (@users) {
351 my @params = split (",",$user);
352 push (@status, $params[0]);
353 push (@nicks, $params[1]);
355 return ('SJOIN', undef, undef, WF_CHAN
, parse_fjoin
($server, $channel, $ts, $modes, \
@nicks, \
@status));
358 if ($_[0] =~ /^(?:\~|SJOIN) (\S+) (\S+) (.*)$/) {
359 my ($ts, $cn, $payload) = ($1, $2, $3);
363 return ('SJOIN', undef, undef, WF_CHAN
, parse_sjoin
($remoteserv, $ts, $cn, $payload));
365 elsif($_[0] =~ /^(@|:)(\S+) (?:\~|SJOIN) (\S+) (\S+) (.*)$/) {
366 my ($server, $ts, $cn, $payload) = ($2, $3, $4, $5);
368 $server = $servernum[b64toi
($2)];
376 return ('SJOIN', undef, undef, WF_CHAN
, parse_sjoin
($server, $ts, $cn, $payload));
381 if($_[0] =~ /^:(\S+) (?:D|PART) (\S+) :(.*)$/) {
382 return ('PART', undef, 0, WF_CHAN
, $1, $2, $3);
384 elsif($_[0] =~ /^:(\S+) (?:D|PART) (\S+)$/) {
385 return ('PART', undef, 0, WF_CHAN
, $1, $2, undef);
390 if($_[0] =~ /^(@|:)(\S+) (?:G|MODE) (#\S+) (\S+) (.*)(?: \d+)?$/) {
393 $name = $servernum[b64toi
($2)];
398 my $properName = getRevUuid
($name);
399 if ($properName) { $name = $properName; }
400 return ('MODE', undef, 1, WF_ALL
, $name, $3, $4, $5);
402 elsif($_[0] =~ /^:(\S+) (?:G|MODE) (\S+) :(\S+)$/) {
403 # We shouldn't ever get this, as UMODE2 is preferred
404 return ('UMODE', 0, 0, WF_ALL
, $1, $3);
411 if($_[0] =~ /^(@|:)(\S+) (?:\!|PRIVMSG) (\S+) :(.*)$/) {
414 $name = $servernum[b64toi
($2)];
420 my $reverse_uuid = ircd
::getRevUuid
($dest);
421 my $user_revuuid = ircd
::getRevUuid
($name);
422 unless ($reverse_uuid eq "") {
423 $dest = $reverse_uuid;
425 unless ($user_revuuid eq "") {
426 $name = $user_revuuid;
428 $event = 'PRIVMSG'; @args = ($name, $dest, $4);
430 elsif($_[0] =~ /^(@|:)(\S+) (?:B|NOTICE) (\S+) :(.*)$/) {
433 $name = $servernum[b64toi
($2)];
438 $event = 'NOTICE'; @args = ($name, $3, $4);
440 $args[1] =~ s/\@${main_conf{local}}.*//io;
442 if(queue_size
> 50 and $event eq 'PRIVMSG' and $args[1] !~ /^#/ and $args[2] =~ /^\w/) {
443 ircd
::notice
($args[1], $args[0], "It looks like the system is busy. You don't need to do your command again, just hold on a minute...");
446 return ($event, 0, 1, WF_ALL
, @args);
450 if($_[0] =~ /^:(\S+) (?:6|AWAY) :(.*)$/) {
451 return ('AWAY', undef, undef, WF_ALL
, $1, $2);
453 elsif($_[0] =~ /^:(\S+) (?:6|AWAY) $/) {
454 return ('BACK', undef, undef, WF_ALL
, $1);
460 #:97KAAAAAA NICK erry_ 1307878528
461 if($_[0] =~ /^:(\S+) (?:NICK|\&) (\S+) :?(\S+)$/) {
462 my $oldnick = ircd
::getRevUuid
($1);
463 ircd
::setRevUuid
($1, $2);
464 ircd
::setUuid
($2, $1);
465 return ('NICKCHANGE', undef, undef, WF_NICK
, $oldnick, $2, $3);
467 elsif(CLK
&& NICKIP
&& $_[0] =~ /^(?:NICK|\&) (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) (\d+) (\S+) (\S+) (\S+) (\S+) :(.*)$/) {
468 #NICK Guest57385 1 !14b7t0 northman tabriel.tabris.net 38 0 +iowghaAxNWzt netadmin.SCnet.ops SCnet-3B0714C4.tabris.net CgECgw== :Sponsored By Skuld
469 #NICK outis 1 !14corv northman localhost 38 0 +iowghaAxNWzt tabris.netadmin.SCnet.ops SCnet-D8C01838 AAAAAAAAAAAAAAAAAAAAAQ== :Sponsored By Skuld
470 my ($nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost, $cloakhost, $IP, $gecos) =
471 ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12);
475 if (SJB64
and length($server) <= 2 and $server !~ /\./) {
476 $server = $servernum[b64toi
($server)];
479 if(main_conf_ipv6
&& (length($IP) > 8)) {
480 $IP = Socket6
::inet_ntop
(AF_INET6
, MIME
::Base64
::decode
($IP));
482 $IP = join('.', unpack('C4', MIME
::Base64
::decode
($IP)));
484 return ('NICKCONN', undef, undef, WF_NICK
, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
485 $gecos, $IP, $cloakhost
488 elsif(!CLK
&& NICKIP
&& $_[0] =~ /^(?:NICK|\&) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) :(.*)$/) {
489 #NICK tab 1 1116196525 northman tabriel.tabris.net test-tab.surrealchat.net 0 +iowghaAxNWzt netadmin.SCnet.ops CgECgw== :Sponsored by Skuld
490 my ($nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost, $IP, $gecos) =
491 ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);
495 if (SJB64
and length($server) <= 2 and $server !~ /\./) {
496 $server = $servernum[b64toi
($server)];
499 if(main_conf_ipv6
&& length($IP) > 8) {
500 $IP = Socket6
::inet_ntop
(AF_INET6
, MIME
::Base64
::decode
($IP));
502 $IP = join('.', unpack('C4', MIME
::Base64
::decode
($IP)));
504 return ('NICKCONN', undef, undef, WF_NICK
, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost,
508 elsif(!CLK
&& !NICKIP
&& $_[0] =~ /^(?:NICK|\&) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) :(.*)$/) {
509 #NICK tab 1 1116196525 northman tabriel.tabris.net test-tab.surrealchat.net 0 +iowghaAxNWzt netadmin.SCnet.ops :Sponsored by Skuld
510 my ($nick, $hops, $ts, $ident, $host, $server, $stamp, $modes, $vhost, $gecos) =
511 ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
515 if (SJB64
and length($server) <= 2 and $server !~ /\./) {
516 $server = $servernum[b64toi
($server)];
519 return ('NICKCONN', undef, undef, WF_NICK
, $nick, $hops, $ts, $ident, $host, $server, $stamp, $modes,
525 $_[0] =~ /^:(\S+) (?:QUIT|\,) :(.*)$/;
527 my $nick = ircd
::getRevUuid
($id);
528 if (!$nick) { $nick = $id; }
529 return ('QUIT', 0, undef, WF_NICK
, $nick, $2);
533 #:tabris KILL ProxyBotW :tabris.netadmin.SCnet.ops!tabris (test.)
534 #:ProxyBotW!bopm@ircop.SCnet.ops QUIT :Killed (tabris (test.))
535 $_[0] =~ /^(@|:)(\S+) (?:KILL|\.) (\S+) :(\S+) \((.*)\)$/;
538 $name = $servernum[b64toi
($2)];
543 return ('KILL', 0, 1, WF_NICK
, $name, $3, $4, $5);
547 #:tabris KICK #diagnostics SurrealBot :i know you don't like this. but it's for science!
548 $_[0] =~ /^(@|:)(\S+) (?:KICK|H) (\S+) (\S+) :(.*)$/;
549 # source, chan, target, reason
550 #$src = 0; #$dst = 2;
553 $name = $servernum[b64toi
($2)];
558 return ('KICK', 0, undef, WF_CHAN
, $name, $3, $4, $5);
562 if($_[0] =~ /^:(\S+) (?:CHGHOST|AL) (\S+) (\S+)$/) {
563 #:Agent CHGHOST tabris tabris.netadmin.SCnet.ops
564 return ('CHGHOST', 0, 1, WF_CHAN
, $1, $2, $3);
565 #setter, target, vhost
567 elsif($_[0] =~ /^:(\S+) (?:SETHOST|AA) (\S+)$/) {
568 #:tabris SETHOST tabris.netadmin.SCnet.ops
569 return ('CHGHOST', 0, 1, WF_CHAN
, $1, $1, $2);
572 elsif ($_[0] =~ /^:(?:\S* )?302 (\S+) :(\S+?)\*?=[+-].*?\@(.*)/) {
573 #:serebii.razorville.co.uk 302 leif :Jesture=+~Jesture00@buzz-3F604D09.sympatico.ca
574 return ('CHGHOST', 0, 1, WF_CHAN
, $1, $2, $3);
580 $_[0] =~ /^:(?:\S* )?340 (\S+) :(\S+?)\*?=[+-].*?\@((?:\.|\d)*)/;
581 return ('USERIP', 0, 1, WF_CHAN
, $1, $2, $3);
585 if($_[0] =~ /^:(\S+) (?:CHGIDENT|AL) (\S+) (\S+)$/) {
586 return ('CHGIDENT', 0, 1, WF_ALL
, $1, $2, $3);
587 #setter, target, IDENT
589 elsif($_[0] =~ /^:(\S+) (?:SETIDENT|AD) (\S+)$/) {
590 return ('CHGIDENT', 0, 1, WF_ALL
, $1, $1, $2);
591 #setter, target, ident
597 if($_[0] =~ /^(@|:)(\S+) (?:TOPIC|\)) (\S+) (\S+) (\S+) :(.*)$/) {
598 #:tabris TOPIC #the_lounge tabris 1089336598 :Small Channel in search of Strong Founder for long term relationship, growth, and great conversation.
600 my ($name, $cn, $setter, $ts, $topic) = ($2, $3, $4, $5, $6);
602 $name = $servernum[b64toi
($2)];
610 return ('TOPIC', 0, 1, WF_ALL
, $name, $cn, $setter, $ts, $topic);
612 elsif($_[0] =~ /^(?:TOPIC|\)) (\S+) (\S+) (\S+) :(.*)$/) {
613 my ($cn, $setter, $ts, $topic) = ($1, $2, $3, $4);
617 # src, channel, setter, timestamp, topic
618 return ('TOPIC', 0, 1, WF_ALL
, undef, $cn, $setter, $ts, $topic);
624 $_[0] =~ /^:(\S+) (?:UMODE2|\|) (\S+)$/;
626 # a note, not all umodes are passed
627 # +s, +O, and +t are not passed. possibly others
628 # also not all umodes do we care about.
629 # umodes we need care about:
630 # oper modes: hoaACN,O oper-only modes: HSq
631 # regular modes: rxB,izV (V is only somewhat, as the ircd
632 # does the conversions from NOTICE to PRIVSMG for us).
634 # Yes, I'm changing the event type on this
635 # It's better called UMODE, and easily emulated
636 # on IRCds with only MODE.
637 return ('UMODE', 0, 0, WF_ALL
, $1, $2);
642 $_[0] =~ /^:(\S+) (?:SVS2?MODE|n|v) (\S+) (\S+)$/;
644 # a note, not all umodes are passed
645 # +s, +O, and +t are not passed. possibly others
646 # also not all umodes do we care about.
647 # umodes we need care about:
648 # oper modes: hoaACN,O oper-only modes: HSq
649 # regular modes: rxB,izV (V is only somewhat, as the ircd
650 # does the conversions from NOTICE to PRIVSMG for us).
652 return ('UMODE', 0, 0, WF_ALL
, $2, $3);
656 # :tab WHOIS ConnectServ :ConnectServ
657 if($_[0] =~ /^:(\S+) (?:WHOIS|\#) (\S+)$/) {
658 return ('WHOIS', 0, undef, WF_NONE
, $1, $2);
660 elsif($_[0] =~ /^:(\S+) (?:WHOIS|\#) (\S+) :(\S+)$/) {
661 return ('WHOIS', 0, undef, WF_NONE
, $1, $3);
666 $_[0] =~ /^:(\S+) (?:TSCTL|AW) alltime$/;
667 ircsend
(":$main_conf{local} NOTICE $1 *** Server=$main_conf{local} TSTime=".
668 time." time()=".time." TSOffset=0");
673 $_[0] =~ /^:(\S+) (?:VERSION|\+).*$/;
674 return ('VERSION', 0, undef, WF_NONE
, $1);
678 if ($_[0] =~ /^(@|:)(\S+) (?:TKL|BD) (.*)$/) {
679 # We discard the source anyway.
682 # $server = $servernum[b64toi($2)];
687 return ('TKL', undef, undef, WF_NONE
, parse_tkl
("TKL $3"));
689 elsif ($_[0] =~ /^(?:TKL|BD) (.*)$/) {
690 return ('TKL', undef, undef, WF_NONE
, parse_tkl
("TKL $1"));
695 $_[0] =~ /^(@|:)(\S+) (SENDSNO|Ss|SMO|AU) ([A-Za-z]) :(.*)$/;
696 #@servernumeric Ss snomask :message
699 $name = $servernum[b64toi
($2)];
705 $event = 'SENDSNO' if(($3 eq 'SENDSNO' or $3 eq 'Ss'));
706 $event = 'SMO' if(($3 eq 'SMO' or $3 eq 'AU'));
707 return ($event, 0, undef, WF_NONE
, $name, $4, $5);
711 $_[0] =~ /^(@|:)(\S+) (?:GLOBOPS|\]) :(.*)$/;
712 #@servernumeric [ :message
715 $name = $servernum[b64toi
($2)];
720 return ('GLOBOPS', 0, undef, WF_NONE
, $name, $3);
724 $_[0] =~ /^:(\S+) (?:105|005) (\S+) (.+) :are supported by this server$/;
725 # :test-tab.surrealchat.net 105 services.SC.net CMDS=KNOCK,MAP,DCCALLOW,USERIP :are supported by this server
726 foreach my $token (split(/\s+/, $3)) {
727 my ($key, $value) = split('=', $token);
728 $IRCd_capabilities{$key} = ($value ? $value : 1);
733 $_[0] =~ /^:(\S+) (?:STATS|2) (\S) :(.+)$/;
734 return ('STATS', undef, undef, WF_NONE
, $1, $2, $3)
751 NETINFO
=> \
&NETINFO
,
754 PROTOCTL
=> \
&PROTOCTL
,
768 PRIVMSG
=> \
&MESSAGE
,
810 VERSION
=> \
&VERSION
,
819 SENDSNO
=> \
&SNOTICE
,
825 GLOBOPS
=> \
&GLOBOPS
,
831 SVSMODE
=> \
&SVSMODE
,
833 SVS2MODE
=> \
&SVSMODE
,