⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a_protocols_irc.pl

📁 AndyChat 是一种用Perl 来编写的多协议的控制台聊天程序。它的目的在于提供一种共同的控制台界面
💻 PL
📖 第 1 页 / 共 5 页
字号:
    }  }}sub irc__on_motd {  my ($self, $event) = @_;  my ($srv, $chn);  @args = $event->args;  shift @args;  $tmpchannel = $args[0];  $srv = irc__whichServer($self);  if (substr($tmpchannel, 0, 1) eq "#" || substr($tmpchannel, 0, 1) eq "&")  {    if (index($tmpchannel, " ") > 1)    {      $tmpreason = substr($tmpchannel, index($tmpchannel, " ") + 1);      $tmpchannel = substr($tmpchannel, 0, index($tmpchannel, " "));    }    $chn = irc__whichChannel($srv, $tmpchannel);    $whichwin = $irc__channel[$srv][$chn]{window};    if (! $whichwin)    {      AddLine($thiswin, "$tmpchannel failed new method in on_motd -- please report", $__irc_mark14);      $whichwin = whichcontrol($self, 2, $tmpchannel);    }  }  else  {    $whichwin = $irc__server[$srv]{window};    if (! $whichwin)    {      AddLine($thiswin, "Server failed new method in on_motd -- please report", $__irc_mark14);      $whichwin = whichcontrol($self, 2, "Server Messages");    }  }  if ($window[$whichwin]{channel} ne "Server Messages")  {    if (index($tmpreason, " ") > -1)    {      $tmpcontent = substr($tmpreason, index($tmpreason, " ") + 1);      $tmpreason = substr($tmpreason, 0, index($tmpreason, " "));    }    if (substr($tmpreason, length($tmpreason) - 1, 1) eq ":")    {      $tmpreason = substr($tmpreason, 0, -1);    }    AddLine($whichwin, $tmpcontent, $__irc_mark12 . "$tmpreason `8(`3$tmpchannel`8): `7");  }  else  {    AddLine($whichwin, "@args", $__irc_mark12);  }}sub irc__on_whoisuser {  my ($self, $event) = @_;  $tmpnick = ($event->args)[1];  $tmphost = ($event->args)[2] . "\@" . ($event->args)[3];  $tmpname = ($event->args)[5];  @args = $event->args;  shift @args;  shift @args;  shift @args;  shift @args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, $__irc_mark10 . DoubleQuote($tmpnick) . " `8(`7" . DoubleQuote($tmphost) . "`8) ()");  AddLine($whichwin, DoubleQuote($tmpname), $__irc_mark10 . "i`7rcname  : ");}sub irc__on_whoisserver {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote("@args"), $__irc_mark10 . "s`7erver   : ");}sub irc__on_whoisoperator {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote("@args"), $__irc_mark10 . "o`7perator : ");}sub irc__on_whoischanop {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote("@args"), $__irc_mark10 . "c`7hanop   : ");}sub irc__on_whoisvworld {  my ($self, $event) = @_;  $tmphost = ($event->args)[2];  $tmphost = substr($tmphost, rindex($tmphost, " ") + 1);  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote($tmphost), $__irc_mark10 . "v`7world   : ");}sub irc__on_whoishelp {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote("@args"), $__irc_mark10 . "i`7nfo     : ");}sub irc__on_whoisidle {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  shift @args;  $tmpidle = $args[0];  $tmpsignon = $args[1];  if (index($tmpsignon, "idle") > -1)  {    $tmpsignon = 0;  }  else  {    $tmpsignon = $args[1];  }  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, $__irc_mark10 . "i`7dle     : " . readablesecs($tmpidle) . " (signon: " . localtime($tmpsignon) . ")");}sub irc__on_whoischannels {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  shift @args;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote("@args"), $__irc_mark10 . "c`7hannels : ");}sub irc__on_endofwhois {  my ($self, $event) = @_;  if ($config{whoisinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, $__irc_mark10 . "e`7nd of WHOIS");}sub irc__whois {  my ($self, $to) = @_;  $self->whois($to);}sub irc__on_away {  my ($self, $event) = @_;  @args = $event->args;  $tmpnick = $args[1];  shift @args;  shift @args;  if ($config{awayinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, DoubleQuote($tmpnick) . " - " . DoubleQuote("@args"), $__irc_mark10 . "a`7way     : ");}sub irc__on_nosuchnick {  my ($self, $event) = @_;  @args = $event->args;  $tmpnick = $args[1];  shift @args;  shift @args;  if ($config{nouserinserverwindow})  {    $whichwin = whichcontrol($self, 2, "Server Messages");  }  else  {    $whichwin = whichcontrol($self, 2);  }  AddLine($whichwin, " - " . DoubleQuote("@args"), $__irc_mark13 . "`%" . DoubleQuote($tmpnick) . "`7");}sub irc__away {  my ($self, $data) = @_;  $self->away($data);}sub irc__on_awaytoggle {  my ($self, $event) = @_;  @args = $event->args;  shift @args;  AddLine(whichcontrol($self, 2), DoubleQuote("@args"), $__irc_mark12);}sub irc__on_nicknameinuse {  my ($self, $event) = @_;  my ($tmpnick);  $srv = irc__whichServer($self);  $whichwin = $irc__server[$srv]{window};  if (! $whichwin)  {    $whichwin = whichcontrol($self, 2, "Server Messages");    AddLine($thiswin, "New method failed in on_nicknameinuse -- please report", $__irc_mark14);#    $my[whichcontrol($self, 2)]{name} = ($event->args)[0];  }  else  {    $irc__server[$srv]{name} = ($event->args)[0];  }  $tmpnick = ($event->args)[1];  AddLine($whichwin, $__irc_mark12 . "`%" . DoubleQuote($tmpnick) . " `7is already in use or forbidden");}sub irc__do_nickchange {  my ($whichwin, $self) = @_;  if ($window[$whichwin]{query} && $window[$whichwin]{query} eq $tmpnick)  {    $window[$whichwin]{query} = $newnick;    if ($whichwin eq $thiswin) { RedrawChanInfo(); }  }}sub irc__on_nick {  my ($self, $event) = @_;  my ($irc__i);  $tmpnick = $event->nick;  $newnick = ($event->args)[0];  $srv = irc__whichServer($self);  if ($irc__server[$srv]{control})  {    if ($tmpnick eq $irc__server[$srv]{name})    {      $irc__server[$srv]{name} = $newnick;      $irc__server[$srv]{id} = $newnick . substr($irc__server[$srv]{id}, length($tmpnick));      if ($irc__server[$srv]{window} eq $thiswin)      {        RedrawChanInfo();      }    }    if ($irc__server[$srv]{channels})    {      for ($irc__i = 1; $irc__i <= $irc__server[$srv]{channels}; $irc__i++)      {        if (FindUser($irc__channel[$srv][$irc__i]{window}, 1, $tmpnick))        {          RenUser($irc__channel[$srv][$irc__i]{window}, $tmpnick, $newnick);          AddLine($irc__channel[$srv][$irc__i]{window}, $__irc_mark12 . "`%". DoubleQuote($tmpnick) . " `7is now known as `3" . DoubleQuote($newnick));        }        if ($newnick eq $irc__server[$srv]{name} && $irc__channel[$srv][$irc__i]{window} eq $thiswin)        {          RedrawChanInfo();        }      }    }    if ($irc__server[$srv]{queries})    {      for ($irc__i = 1; $irc__i <= $irc__server[$srv]{queries}; $irc__i++)      {        if ($irc__query[$srv][$irc__i]{name} eq $tmpnick)        {          $irc__query[$srv][$irc__i]{name} = $newnick;          if ($irc__query[$srv][$irc__i]{window} eq $thiswin)          {            RedrawChanInfo();          }        }      }    }    # We still do queries the old way, since it is way more efficient, probably dumping the new way    foreachcontrol($self, 2, \&irc__do_nickchange);  }  else  {    AddLine(whichcontrol($self, 2), "do_nickchange old method detected -- please report", $__irc_mark14);#    foreachcontrol($self, 2, \&irc__do_nickchange);  }}sub irc__nick {  my ($self, $data) = @_;  $self->nick($data);}sub irc__do_usermodechange {  my ($srv) = @_;  $whichwin = $irc__server[$srv]{window};  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 = "";    }    else    {      if ($tf)      {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -