📄 a_protocols_irc.pl
字号:
if ($irc__server[$srv]{modes}) { if (index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) > -1) { AddLine($whichwin, "User mode set twice", $__irc_mark14); } else { $irc__server[$srv]{modes} = $irc__server[$srv]{modes} . substr($tmpmodes, $ap_i, 1); } } else { $irc__server[$srv]{modes} = substr($tmpmodes, $ap_i, 1); } } else { if (! $irc__server[$srv]{modes} || index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) < 0) { AddLine($whichwin, "Undefined user mode undefined", $__irc_mark14); } else { if (index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) > 0 && index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) < length($irc__server[$srv]{modes}) - 1) { $irc__server[$srv]{modes} = substr($irc__server[$srv]{modes}, 0, index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1))) . substr($irc__server[$srv]{modes}, index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) + 1); } elsif (index($irc__server[$srv]{modes}, substr($tmpmodes, $ap_i, 1)) > 0) { $irc__server[$srv]{modes} = substr($irc__server[$srv]{modes}, 0, -1); } else { $irc__server[$srv]{modes} = substr($irc__server[$srv]{modes}, 1); } } } } } $irc__server[$srv]{modes} = join('', sort(split(//, $irc__server[$srv]{modes})));}sub irc__do_chanmodechange { my ($whichwin) = @_; for ($ap_i = 0; $ap_i < length($tmpmodes); $ap_i++) { if (substr($tmpmodes, $ap_i, 1) eq "+") { $tf = 1; } elsif (substr($tmpmodes, $ap_i, 1) eq "-") { $tf = ""; } # o [user] op # v [user] voice # b [mask] ban # k [key] require [key] to join channel # l [num] limit channel number to [num] # i invite only # m moderated, voices only # n no external messages # p private # t topic change restricted to ops # s secret elsif (substr($tmpmodes, $ap_i, 1) eq "o") { $tm++; $tmpnum = FindUser($whichwin, 1, $args[$tm]); if ($tmpnum) { $usr[$whichwin][$tmpnum]{op} = $tf; if ($usr[$whichwin][$tmpnum]{me}) { $my[$whichwin]{op} = $tf; if ($whichwin eq $thiswin) { RedrawChanInfo(); } } SortUsers($whichwin); if ($whichwin eq $thiswin) { RedrawNicks(); } } } elsif (substr($tmpmodes, $ap_i, 1) eq "v") { $tm++; $tmpnum = FindUser($whichwin, 1, $args[$tm]); if ($tmpnum) { $usr[$whichwin][$tmpnum]{voice} = $tf; if ($usr[$whichwin][$tmpnum]{me}) { $my[$whichwin]{voice} = $tf; if ($whichwin eq $thiswin) { RedrawChanInfo(); } } SortUsers($whichwin); if ($whichwin eq $thiswin) { RedrawNicks(); } } } elsif (substr($tmpmodes, $ap_i, 1) eq "b") { } else { if (substr($tmpmodes, $ap_i, 1) eq "k") { if ($tf) { $tm++; $window[$whichwin]{key} = $args[$tm]; } else { $tm++; $window[$whichwin]{key} = ""; if ($window[$whichwin]{key} && $window[$whichwin]{key} ne $args[$tm]) { AddLine($whichwin, " `\@Security Error`7: `\%Key change doesn't match previous key! Ignoring tho :P"); } } } elsif (substr($tmpmodes, $ap_i, 1) eq "l") { if ($tf) { $tm++; $window[$whichwin]{limit} = $args[$tm]; } else { $window[$whichwin]{limit} = ""; } }# elsif (index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) > -1 && $tf)# {# AddLine($whichwin, "Channel mode set twice", $__irc_mark14);# } if ($tf) { if ($window[$whichwin]{modes}) { if (index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) > -1) { } else { $window[$whichwin]{modes} = $window[$whichwin]{modes} . substr($tmpmodes, $ap_i, 1); } } else { $window[$whichwin]{modes} = substr($tmpmodes, $ap_i, 1); } } else { if (! $window[$whichwin]{modes} || index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) < 0) {# AddLine($whichwin, " `\@Warning`7: `\%Channel mode undefined before defined"); } else { if (index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) > 0 && index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) < length($window[$whichwin]{modes}) - 1) { $window[$whichwin]{modes} = substr($window[$whichwin]{modes}, 0, index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1))) . substr($window[$whichwin]{modes}, index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) + 1); } elsif (index($window[$whichwin]{modes}, substr($tmpmodes, $ap_i, 1)) > 0) { $window[$whichwin]{modes} = substr($window[$whichwin]{modes}, 0, -1); } else { $window[$whichwin]{modes} = substr($window[$whichwin]{modes}, 1); } } } } } $window[$whichwin]{modes} = join('', sort(split(//, $window[$whichwin]{modes}))); if ($tmpnick) { AddLine($whichwin, $__irc_mark12 . "mode`8/`3" . DoubleQuote($tmpto) . " `8[`%" . DoubleQuote("@args") . "`8] `7by `%" . DoubleQuote($tmpnick)); } if ($whichwin eq $thiswin) { RedrawChanInfo(); }}sub irc__on_chanmodeis { my ($self, $event) = @_; @args = $event->args; $tmpto = $args[1]; $tmpnick = ""; shift @args; shift @args; $whichwin = whichcontrol($self, 2, $tmpto); $tmpmodes = $args[0]; $tm = 0; $tf = 1; irc__do_chanmodechange($whichwin);}sub irc__mode { my ($self, $to, $data) = @_; $self->mode($to, $data);}sub irc__on_mode { my ($self, $event) = @_; my ($srv); $tmpnick = $event->nick; $tmpto = ($event->to)[0]; @args = $event->args; $argsize = @args; $srv = irc__whichServer($self); if (substr($tmpto, 0, 1) ne "#" && substr($tmpto, 0, 1) ne "&") { $tmpmodes = $args[0]; $tm = 0; $tf = 1; irc__do_usermodechange($srv);# foreachcontrol($self, 2, \&irc__do_usermodechange); $whichwin = $irc__server[$srv]{window}; if (! $whichwin) { $whichwin = whichcontrol($self, 2, "Server Messages"); AddLine($whichwin, "New method failed in on_mode -- please report", $__irc_mark14); } AddLine($whichwin, $__irc_mark12 . "Mode change `8[`%" . DoubleQuote("@args") . "`8] `7for user `3" . DoubleQuote($tmpto)); if ($self eq $window[$thiswin]{control}) { RedrawChanInfo(); } } else { $whichwin = whichcontrol($self, 2, $tmpto); $tmpmodes = $args[0]; $tm = 0; $tf = 1; irc__do_chanmodechange($whichwin);# if ($whichwin eq $thiswin)# {# RedrawChanInfo();# } }}sub irc__on_debug { my ($self, $event) = @_; $tmpnick = $event->nick; $tmphost = $event->userhost; $tmpto = ($event->to)[0]; @args = $event->args; $argsize = @args; AddLine($thiswin, "Self: $self"); AddLine($thiswin, "From: $tmpnick"); AddLine($thiswin, "Host: $tmphost"); AddLine($thiswin, " To: $tmpto"); AddLine($thiswin, "Data: $argsize - @args");}sub irc__raw { my ($self, $data) = @_; $self->sl($data);}sub irc__on_error { my ($self, $event) = @_; @args = $event->args; shift @args; $whichwin = whichcontrol($self, 2, $tmpnick, 1); if (! $whichwin) { $whichwin = whichcontrol($self, 2); } AddLine(whichcontrol($self, 2, "Server Messages"), DoubleQuote("@args"), $__irc_mark14);}sub irc__on_lusers { my ($self, $event) = @_; @args = $event->args; shift @args; AddLine(whichcontrol($self, 2, "Server Messages"), DoubleQuote("@args"), $__irc_mark10);}sub irc__on_msg { my ($self, $event) = @_; $tmpnick = $event->nick; $tmphost = $event->userhost; $tmpto = ($event->to)[0]; @args = $event->args; if ($config{paging}) { if ($pagesswaiting > 1) { $pagesswaiting--; UpdateGame(6); } if ($pagesswaiting < 22) { for ($ap_i = $pagesswaiting; $ap_i <= 22; $ap_i++) { if ($ap_i > 1) { $pagess[$ap_i - 1] = $pagess[$ap_i]; } } } $pagess[21] = $tmpnick . " whispers @args"; AddLog(whichcontrol($self, 2), $pagess[21]); } $whichwin = whichcontrol($self, 2, $tmpnick, 1); if (! $whichwin) { $whichwin = whichcontrol($self, 2); } AddLine($whichwin, $event->args, "`8[`#" . DoubleQuote($tmpnick) . "`8(`5" . DoubleQuote($tmphost) . "`8)]`7 ");}sub irc__on_notice { my ($self, $event) = @_; $tmpnick = $event->nick; $tmphost = $event->userhost; $tmpto = ($event->to)[0]; $whichwin = whichcontrol($self, 2, $tmpnick, 1); if (! $whichwin) { $whichwin = whichcontrol($self, 2); } AddLine($whichwin, $event->args, "`8-`#" . DoubleQuote($tmpnick) . "`8(`5" . DoubleQuote($tmphost) . "`8)-`7 ");}sub irc__notice { my ($self, $to, $data) = @_; $self->notice($to, $data);}sub irc__on_public { my ($self, $event) = @_; my ($msgtext, $word, $hlc); $tmpnick = $event->nick; $tmpto = ($event->to)[0]; $srv = irc__whichServer($self); $hlc = "`" . colline($config{highlightcolour}) if $config{highlightcolour}; if (! $hlc || length($hlc) ne 2) { $hlc = "`\$"; } if ($config{nickhighlight} && join('', $event->args) =~ /$irc__server[$srv]{name}/i) { AddLine(whichcontrol($self, 2, $tmpto), $event->args, $hlc . "<`7" . DoubleQuote($tmpnick) . $hlc . ">`7 "); } elsif (@{$config{highlight}}[0]) { $msgtext = join('', $event->args); foreach $word (@{$config{highlight}}) { if ($msgtext =~ /$word/i) { AddLine(whichcontrol($self, 2, $tmpto), $event->args, $hlc . "<`7" . DoubleQuote($tmpnick) . $hlc . ">`7 "); return; } } AddLine(whichcontrol($self, 2, $tmpto), $event->args, "`9<`7" . DoubleQuote($tmpnick) . "`9>`7 "); } else { AddLine(whichcontrol($self, 2, $tmpto), $event->args, "`9<`7" . DoubleQuote($tmpnick) . "`9>`7 "); }}sub irc__privmsg { my ($self, $to, $data) = @_; $self->privmsg($to, $data);}sub irc__on_caction { my ($self, $event) = @_; $tmpnick = $event->nick; $tmpto = ($event->to)[0]; @args = $event->args; if (substr($tmpto, 0, 1) eq "&" || substr($tmpto, 0, 1) eq "#") { AddLine(whichcontrol($self, 2, $tmpto), "@args", "`8" . chr(240) . " `\$" . DoubleQuote($tmpnick) . " `7"); } else { $whichwin = whichcontrol($self, 2, $tmpnick, 1); if (! $whichwin) { $whichwin = whichcontrol($self, 2); } AddLine($whichwin, "@args", "`8" . chr(240) . " `!" . DoubleQuote($tmpnick) . " `7"); }}sub irc__action { my ($self, $to, $data) = @_; $self->ctcp("ACTION", $to, $data);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -