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

📄 a_common.pl

📁 AndyChat 是一种用Perl 来编写的多协议的控制台聊天程序。它的目的在于提供一种共同的控制台界面
💻 PL
📖 第 1 页 / 共 3 页
字号:
}sub LordWrite {  my ($z2, $z1) = @_;  my ($_alt, $_sect);  if (! $z1)  {    $z1 = $z2;    $z2 = $mainwin;  }  $z1 =~ s/\002/\000B\000/g;  $z1 =~ s/\003(\d\d?(,\d\d?)?)\003?/\000C$1\000/g;  $z1 =~ s/\003/\000K\000/g;  $z1 =~ s/\017//g;  $z1 =~ s/\025//g;  $z1 =~ s/\037/\000U\000/g;  $z1 =~ s/\026/\000V\000/g;  $z1 =~ s/(?<!`)`[0-9!@#\$%]/\000$&\000/g;  $z1 =~ s/``/`/go;  $_alt = 1;  foreach $_sect (split(/\000/, $z1))  {    if ($_alt)    {      addstr($z2, $_sect);      $_alt = "";    }    else    {      $_alt = 1;      if ($_sect =~ /^B$/)      {        if ($cbold)        {          $z2->attroff(A_BOLD);          $cbold = "";        }        else        {          $z2->attron(A_BOLD);          $cbold = 1;        }      }      elsif ($_sect =~ /^C/)      {        my ($_win) = $z2;        $_sect =~ s/^C//;        $_win->attr_get($_bcc1, $_bcc2);        my ($_fg, $_bg) = split(/,/, $_sect, 2);#        if ($_bg)#        {#          textbackground($z2, irccol($_bg));#        }        textcolor($z2, irccol($_fg));      }      elsif ($_sect =~ /^K$/)      {        $z2->attrset($_bcc1);        $z2->attrset($_bcc2);        undef $_bcc1; undef $_bcc2;      }      elsif ($_sect =~ /^U$/)      {        if ($culine)        {          $z2->attroff(A_UNDERLINE);          $culine = "";        }        else        {          $z2->attron(A_UNDERLINE);          $culine = 1;        }      }      elsif ($_sect =~ /^V$/)      {        if ($cinverse)        {          $z2->attroff(A_REVERSE);          $cinverse = "";        }        else        {          $z2->attron(A_REVERSE);          $cinverse = 1;        }      }      elsif ($_sect =~ /^`/)      {        $_sect = substr($_sect, 1);        textcolor($z2, index($colline, $_sect) + 1);      }      else      {        # You shouldn't be here.        open(BZ, ">>bogeys.log");        print BZ "Bogey in LordWrite: $_sect\n";        close(BZ);      }    }  }  if ($cbold)  {    $z2->attroff(A_BOLD);    $cbold = "";  }  if ($cinverse)  {    $z2->attroff(A_REVERSE);    $cinverse = "";  }  if ($culine)  {    $z2->attroff(A_UNDERLINE);    $culine = "";  }}sub LordWrite_old {  my ($z2, $z1) = @_;  if (! $z1)  {    $z1 = $z2;    $z2 = $mainwin;  }#  for ($z = 0; $z < length($z1); $z++)#  {  my $z = 0; while ($z < length($z1))  {    my $lw = index(substr($z1, $z), chr(2));    my $lw3 = index(substr($z1, $z), chr(3));    if (($lw3 < $lw || $lw eq -1) && $lw3 > -1) { $lw = $lw3; }    my $lw15 = index(substr($z1, $z), chr(15));    if (($lw15 < $lw || $lw eq -1) && $lw15 > -1) { $lw = $lw15; }    my $lw21 = index(substr($z1, $z), chr(21));    if (($lw21 < $lw || $lw eq -1) && $lw21 > -1) { $lw = $lw21; }    my $lw22 = index(substr($z1, $z), chr(22));    if (($lw22 < $lw || $lw eq -1) && $lw22 > -1) { $lw = $lw22; }    my $lw30 = index(substr($z1, $z), "`");    if (($lw30 < $lw || $lw eq -1) && $lw30 > -1) { $lw = $lw30; }    my $lw31 = index(substr($z1, $z), chr(31));    if (($lw31 < $lw || $lw eq -1) && $lw31 > -1) { $lw = $lw31; }    my $lw127 = index(substr($z1, $z), chr(127));    if (($lw127 < $lw || $lw eq -1) && $lw127 > -1) { $lw = $lw127; }    if ($lw < 0)    {      addstr($z2, substr($z1, $z));      if ($cbold)      {        $z2->attroff(A_BOLD);        $cbold = "";      }      if ($cinverse)      {        $z2->attroff(A_REVERSE);        $cinverse = "";      }      if ($culine)      {        $z2->attroff(A_UNDERLINE);        $culine = "";      }      return;    }    else    {      if ($lw > 0)      {        addstr($z2, substr($z1, $z, $lw));        $z = $lw + $z;      }    }    if (substr($z1, $z, 1) eq chr(2))    {      if ($cbold)      {        $z2->attroff(A_BOLD);        $cbold = "";      }      else      {        $z2->attron(A_BOLD);        $cbold = 1;      }    }    elsif (substr($z1, $z, 1) eq chr(3))    {     if ($z + 1 < length($z1))     {      $z++;      if ((index($colline, substr($z1, $z, 1)) > -1 && index($colline, substr($z1, $z, 1)) < 9) || substr($z1, $z, 1) eq "0")      {        if ($z + 1 < length($z1))        {          $z++;          if ((index($colline, substr($z1, $z, 1)) > -1 && index($colline, substr($z1, $z, 1)) < 9) || substr($z1, $z, 1) eq "0")          {#            $beforectrlc = $z2->attr_get();#            $beforectrlc = getattrs($z2);            textcolor($z2, irccol(substr($z1, $z - 1, 2)));#            attron(A_UNDERLINE) if ($culine);#            attron(A_REVERSE) if ($cinverse);#            attron(A_BOLD) if ($cbold);          }          else          {            $z--;#            $beforectrlc = $z2->attr_get();#            $beforectrlc = getattrs($z2);            textcolor($z2, irccol(substr($z1, $z, 1)));#            attron(A_UNDERLINE) if ($culine);#            attron(A_REVERSE) if ($cinverse);#            attron(A_BOLD) if ($cbold);          }        }        else        {#          $beforectrlc = $z2->attr_get();#          $beforectrlc = getattrs($z2);          textcolor($z2, irccol(substr($z1, $z, 1)));#          attron(A_UNDERLINE) if ($culine);#          attron(A_REVERSE) if ($cinverse);#          attron(A_BOLD) if ($cbold);        }      }      else      {        if ($beforectrlc)        {          attrset($z2, $beforectrlc);          $beforectrlc = "";        }        $z--;      }     }     else     {        if ($beforectrlc)        {          $z2->attrset($beforectrlc);          $beforectrlc = "";        }     }    }    elsif (substr($z1, $z, 1) eq chr(31))    {      if ($culine)      {        $z2->attroff(A_UNDERLINE);        $culine = "";      }      else      {        $z2->attron(A_UNDERLINE);        $culine = 1;      }    }    elsif (substr($z1, $z, 1) eq chr(22))    {      if ($cinverse)      {        $z2->attroff(A_REVERSE);        $cinverse = "";      }      else      {        $z2->attron(A_REVERSE);        $cinverse = 1;      }    }    elsif (substr($z1, $z, 1) eq "`")    {      $z++;      if ($z >= length($z1))      {        addstr($z2, "`");      }      else      {        if (index($colline, substr($z1, $z, 1)) > -1)        {          textcolor($z2, index($colline, substr($z1, $z, 1)) + 1);#          attron(A_UNDERLINE) if ($culine);#          attron(A_REVERSE) if ($cinverse);#          attron(A_BOLD) if ($cbold);        }        elsif (substr($z1, $z, 1) eq "`")        {          addstr($z2, "`");        }        else        {          addstr($z2, "`" . substr($z1, $z, 1));        }      }    }    else    {#      addstr(substr($z1, $z, 1));#      addstr("Error!");	# Hack!    }    $z++;  }  if ($cbold)  {    $z2->attroff(A_BOLD);    $cbold = "";  }  if ($cinverse)  {    $z2->attroff(A_REVERSE);    $cinverse = "";  }  if ($culine)  {    $z2->attroff(A_UNDERLINE);    $culine = "";  }}sub RedrawNicks {  if ($leftwindow > 4) { return; }  SaveModes();  textcolor($userboxwin, 15);  my $ac_i = 0; my $ac_j = 0;  erase($userboxwin);  while (($ac_i < $maxy - 5) && ($ac_j < $window[$thiswin]->{users}))  {    $ac_j++;    if (! $usr[$thiswin][$ac_j]{invis} && $usr[$thiswin][$ac_j]{name} && (($window[$thiswin]{protocol} eq 3 && $usr[$thiswin][$ac_j]{status} ne 65535) || $window[$thiswin]{protocol} ne 3))    {      $ac_i++;#      gotoxy($maxx - 15, $ac_i + 1);      gotoxy($userboxwin, 0, $ac_i - 1);      if ($usr[$thiswin]->[$ac_j]->{op})      {        LordWrite($userboxwin, "`\$\@"); textcolor($userboxwin, 15);      }      elsif ($usr[$thiswin]->[$ac_j]->{voice})      {        LordWrite($userboxwin, "`\9+"); textcolor($userboxwin, 15);      }      elsif ($window[$thiswin]->{protocol} eq 3)      {        $acrns = $usr[$thiswin][$ac_j]{status};#        if ($acrns eq ICQ_STATUS_INVISIBLE)#        {#          textcolor($userboxwin, 8);#        }        if ($acrns eq 0)        {          textcolor($userboxwin, 9);        }        elsif ($acrns eq 1)        {          textcolor($userboxwin, 10);        }        elsif ($acrns eq 4)        {          textcolor($userboxwin, 10);        }        elsif ($acrns eq 16)        {          textcolor($userboxwin, 10);        }        elsif ($acrns eq 2)        {          textcolor($userboxwin, 10);        }        elsif ($acrns eq 32)        {          textcolor($userboxwin, 9);        }        if ($acrns eq 0)        {          LordWrite($userboxwin, "o");        }        elsif ($acrns eq 1)        {          LordWrite($userboxwin, "a");        }

⌨️ 快捷键说明

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