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

📄 a_common.pl

📁 AndyChat 是一种用Perl 来编写的多协议的控制台聊天程序。它的目的在于提供一种共同的控制台界面
💻 PL
📖 第 1 页 / 共 3 页
字号:
##!/usr/bin/perl -w## Schpati - Pre-Alpha of AndyChat v3.xx# MODULE: Common## Started on Wednesday, 9th of February, 2000 around 11pm-midnight## 21st of July, 2002# - (12.33am) Rewrote RedrawLines for the most part# -  (2.52am) For some reason my window variable keeps getting changed to something silly in LordWrite#             which is causing crashes thus my weird (but working) workaround.# -  (3.07am) Fixed the first of hopefully few parser bugs## 20th of July, 2002# - (11.28pm) Completely rewrote LordWrite using new regexp code# - (11.53pm) Completely rewrote Strrrp and reallength (cheated)## 7th of September, 2001# -  (2.41pm) Fixed annoying DCC statistics progress bug# -  (3.43pm) Attempted to fix filename overflowing bug in DCC Status## 18th of June, 2001# -  (2.55pm) Added a workaround in DoubleQuote for the 'block-bomb' effect with ASCII 128-159 - thanks sabrtooth## 11th of January, 2001 - AT SECRETNET 2001!# - (10.08am) Timestamp is now languaganised# - (11.25am) Fixed the DCC Statistics header# - (12.10pm) $window{unseen} is no longer reset between windows when you are in a scrollback buffer# -  (1.04pm) /redrawscreen now restores topic/chaninfo lines properly## 10th of January, 2001 - AT SECRETNET 2001!# -  (9.00pm) Removed chsline to save RAM!## 16th of December, 2000 - AT MPU!# -  (7.16pm) Implemented timestamping## 13th of December, 2000# - (12.27am) Now config arrays are easy (multi_[name]=[variable])## 4th of October, 2000# -  (2.xxam) Made several optimisations to ClearChatWindow## 27th of September, 2000# - (12.16am) Hacked around a bug in realsubstr (working?)## 26th of September, 2000# -  (1.45am) Finished writing realsubstr routine (working?)## 24th of June, 2000# -  (4.14am) Read $ENV{HOME}/.andychatrc instead of andychat.ini first## 23rd of June, 2000# -  (1.58am) Added pop to shorten scrollback buffer## 19th of June, 2000# - (10.55pm) RedrawChanInfo() changes from $my to $irc__server## 1st of June, 2000# -  (9.43pm) newDCC moved from a_common -> a_protocols_irc## 31st of May, 2000# -  (6.01pm) Implemented ICQ status sorting## 28th of May, 2000# -  (4.26pm) Added newDCC function# -  (4.30pm) Added killDCC function# -  (6.38pm) RedrawLines fixes# -  (7.22pm) Main window fix# -  (8.31pm) Fixed RedrawActivity bug# -  (8.43pm) Implemented SaveModes and RestoreModes (long overdue)## 7th of May, 2000# -  (7.34am) Added scrollback support to RedrawLines, AddLine & RedrawChanInfo# -  (8.15am) Squished deadly pizza view bug# - (10.11am) Added missing RedrawChanInfo() after getting messages in window in scrollback## 6th of May, 2000# -  (3.13am) AddLine fixes# -  (3.14am) AddLine fix for wrapping too early# -  (3.20am) More AddLine fixes for wrapping issues# -  (3.25am) Major DrawLeft changes# -  (5.18am) DrawLeft for User View mode# -  (5.50am) Parses colour.ini properly# -  (7.58am) Workaround for missing user id's## 5th of May, 2000# -  (8.18am) ^O ne ^P (this damn bug is driving me insane!)# - (12.51pm) ClearChatWindow with new stuff, more AddLine with new stuff,#             LordWrite with new stuff, textcolor with new stuff# -  (1.00pm) RedrawLines new stuff## 29th of April, 2000# -  (9.02am) Modified SortUsers# -  (9.32am) Oh baby! :)  SortUsers now works properly!! :)# -  (7.25pm) Added NoMoreChannel thingie# -  (8.44pm) Finally did unshift properly, nice code speedup there :)# -  (8.46pm) Made ClearChatWindow work too :)# -  (9.21pm) Optimized RedrawLines to not do stupid spaces when unnecessary# -  (9.43pm) Fixed ClearChatWindow memory leak# - (10.15pm) Another ClearChatWindow uninit'd value fix# - (10.36pm) Activity :P# - (10.46pm) RedrawActivity and RedrawChanInfo cleanups for show_activity, show_ircinfo# - (11.09pm) Optimized RedrawActivity on Unseen Messages (only happens once now)# - (12.27am) Final attempt at fixing ^? bug## 28th of April, 2000# -  (3.22am) Fixed border breakage in RedrawChanInfo upon new window creation# -  (7.31pm) Various extra $usr / $window hacks# -  ( ---- ) RedrawNicks stuff for ICQ# - (12.52am) Hacked FindUser to do UIN on nick completion :P# - (12.54am) Hacked RedrawNicks to handle ` in nicks a bit better# -  (1.00am) Do not include Offline people in ICQ in nick completion# -  (1.04am) Add a space after UINs for ICQ people in nick completion# -  (1.58am) Fixed some things regarding to RedrawNicks & lack of ICQ connections## 12th of April, 2000# -  (1.55am) Fix for RedrawChanInfo to clear status line after protocol change# -  (8.00pm) Fixes to RealLength and Strrrp for ^O and ^?# -  (8.01pm) LordWrite fixes as above## 9th of April, 2000# -  (3.44pm) Fixed DelUser bug(?)# -  (4.54pm) Made DelUser sloppier, should work a lot better now, damn references## 8th of April, 2000# -  (3.00pm) Cleaning up of newWindowInit# -  (3.02pm) Modified DrawLeft for new $pizza and $window{pizza} stuffz# -  (3.14pm) Added NoMorePizzas, NoMoreGames and NoMoreBans subs# -  (3.57pm) NoMoreUsers added# -  (4.01pm) User deletes and all that stuff now happen correctly (?)# -  (4.07pm) Fixed Retitle vs ReTitle stuffz# -  (5.12pm) Added NoMoreMe to get rid of some 'User mode set more than once' errors# - (12.22am) ReTitle updates for DrawLeft# - (12.23am) Disabled ClearChatWindow changes# -  (1.09am) Added NewMy() subby## 6th of April, 2000# -  (6.13pm) /WINDOW KILL doesn't cause an uninit'd value warning anymore# -  (6.43pm) Added newwindow# -  (7.23pm) Fixed logging= bug# -  (7.24pm) Fixed invisible= bug# -  (7.26pm) Optimised newWindowInit# -  (7.53pm) Two minutes to break, 30 minutes to fix newWindowInit optimisations# -  (8.35pm) Fixed ^O and ^? display bugs (thanks KaMii)# -  (9.43pm) RedrawChanInfo only if $thiswin protocol is IRC# -  (9.46pm) Fixed bizarre date behaviour# -  (9.54pm) Incorporated query stuff into ChanInfo bar# - (10.17pm) Fixed cdstoponexit= and paging= bugs# - (10.44pm) Tried to track down Not an ARRAY reference segfault# - (11.11pm) Tried to erradicate some ^O and ^? problems# - (11.12pm) Fixed line draw error with RedrawChanInfo## 5th of April, 2000# -  (2.22pm) SortUsers NOW SORTS ALPHABETICALLY AT LAST!!!!!!!!!! (4 hours of work!)# -  (2.49pm) SortUsers 'theoretically' sorts by mode# -  (3.06pm) Added noupdate flag to $window[$thiswin] for AddUser mainly# - (11.46pm) Added RedrawChanInfo command# - (12.07am) Better RedrawChanInfo layout# -  (1.03am) Fixed DelUser ?## 4th of April, 2000# - (10.00pm) More array clean-ups in newWinInit# - (10.42pm) Started work on new SortUsers (again)# - (11.50pm) Fixed some bugs relating to things not normally occurable# -  (1.42am) F--- it, 2 hours is long enough, giving up on SortUsers, f---en Perl needs to learn how to sort## 28th of March, 2000# -  (1.50am) Added whichwin parameter (1st) to AddLine# -  (3.11am) Added whichwin parameter to ClearChatLine# -  (3.15am) Added whichwin parameter to ClearAliasWindow# -  (3.20am) Some ClearAliasWindow optimising# -  (3.29am) Tackled uninit'd value thing in ClearAliasWindow# -  (3.40am) RedrawLines no longer causes Uninit'd value# -  (3.42am) Patched some code to do with Refreshes# -  (3.51am) Fixed ClearAliasWindow again# -  (4.07am) ReTitle fixes (remove that >)# -  (4.30am) Fixed LordWrite to write trailing `'s properly# -  (5.19am) Made perhaps unnecessary uninit'd handler for DoubleQuote# -  (4.27pm) AddLine now RedrawLines at the right time (otherwise causes stray text)# -  (4.33pm) Made some changes to AddLine wrapping to properly add some lines## 25th of March, 2000# -  (1.07pm) Reordered FindUser a little to fix a bug## 24th of March, 2000# -  (3.16pm) LordWrite now understands Bold, Underline and inVerse# -  (3.19pm) Cleaned up LordWrite and ClWriteln (why don't I just call LordWrite from ClWriteln???)# -  ( ---- ) Replaced ClWriteln calls with LordWrite :)# -  (3.54pm) Finished heavily optimizing LordWrite# -  ( ---- ) Optimized reallength to be compatible# -  (4.22pm) Finished optimizing Strrrp in the same way as LordWrite# -  (4.24pm) Small fix for Strrrp to strip bold, underline, inverse codes# -  ( ---- ) Removed ClWriteln sub altogether# -  (5.30pm) Fixed leaking colours bug# -  (6.30pm) Fixed underline display bug, ** THERE ARE STILL BUGS PRESENT **# -  (6.52pm) RedrawNicks optimised a little and now truncates nicks# -  (7.51pm) Fixed typo in UpdateGame# -  (8.40pm) Fixed another leaking colour bug# -  (9.06pm) After almost 8 hours of programming and numerous rewritten routines I have#             concluded that the bug is in BitchX which I was trying to copy :)# - (11.33pm) DelUser with only window argument kills everybody## 23rd of March, 2000# -  (5.12pm) Hacked A_BOLD setting for colours to get it right, I hope.# -  (5.17pm) Removed the code i just added, did nothing :)# -  (5.55pm) Tried to fix RedrawLines updating stuffz# -  (5.58pm) Applied fix to RedrawLines instead of RedrawNicks :P# -  (7.43pm) Topics are now truncated to fit 1 space away from time# - (11.42pm) ClearChatWindow destructive now works again## 22nd of March, 2000# -  (1.45am) RenUser hacked to only change name# -  (1.11pm) ClWriteln no longer refresh(s) every line# -  (2.52pm) Made ClWriteln check that lines 'exist' to avoid errors whilst debugging# -  (4.40pm) DoubleQuote changed nicely :)# -  (4.42pm) Added ^V inverse stuff for IRC# -  (4.49pm) Rewrote Strrrp based on reallength# -  (4.54pm) Implemented chsline (stripped chline), hell, uses a lot more ram, but#             should make things a little faster.## 21st of March, 2000# -  (1.10pm) Fixed WrapLine (didn't do anything before becuase ac_wi undefined)# -  (1.15pm) Fixed WrapLine more :)# -  (1.25pm) Fixed WrapLine ?# -  (1.30pm) Maybe the bug is in AddLine :)# -  (3.19pm) Fixed alias character echo and later border removal bugs# -  (3.26pm) Fixed voice sorting to be all together# -  ( ---- ) Changed things# -  (4.20pm) Delete now checks to make sure user exists before deleting and crashing# -  (4.22pm) Removed stupid sort on delete code# -  (8.10pm) Fixed ^_ weirdness# -  (8.20pm) Started work on IRC colours# -  (8.31pm) Phase 1 changes complete# -  (8.32pm) Fixed typo in ClWriteln# -  (8.35pm) Patched reallength for better detection of IRC colours# -  (8.38pm) Attempting removable of deadly loop# -  (8.50pm) Removable of several more IRC colour bugs# -  (8.59pm) Hacked reallength to not bugger up things# -  (9.08pm) Added irccol routine to convert ^C IRC colours -> textcolors# -  (9.15pm) More spacing fixes with IRC colours# -  (9.24pm) More fixes to do with IRC colours, see LordWrite, ClWriteln, reallength# -  (9.42pm) Patched reallength with something I left out# -  (9.47pm) Another fix for reallength :)# - (10.21pm) Fixed reallength :)## 20th of March, 2000# - (11.01pm) Still trying to fix AddUser + SortUsers# - ( ----- ) Gave up on AddUser + SortUsers again# - ( ----- ) Added more window properties: control, channel# - ( ----- ) Added new window property: nick# -  (2.49am) Really fixed reallength incorrectly evaluating line length of ` lines :)# -  ( ---- ) Patched ClWriteln to handle ^B (chr(2)) properly(?)# -  ( ---- ) Patched ClWriteln to ignore characters below 29 as reallength does## 5th of March, 2000# - (11.01pm) Fixed reallength incorrectly evaluating line length of lines with ` in it## 17th of February, 2000# -  (1.56pm) Trying to fix lang problems# -  (2.12pm) Uninitialised variable problems fixed, new sub newWindowInit (kinda dodgy)# -  (2.15pm) Continued porting ReadConfig# -  (4.51pm) Finished porting ReadConfig# -  (4.51pm) Porting complete(?)# -  (4.55pm) Fixed bug which I must have made during porting ReadConfig# -  (4.59pm) Fixed another bug to do with DOS text files# -  (5.05pm) Fixed ReadConfig logging warning about undefined nonsense# -  ( ---- ) Argh!  Case-sensitive subs!  Renamed RealLength to reallength# -  (5.22pm) Fixed(?) substr out of string bug# -  (5.23pm) Fixed typo ac_text vs ac_texta in reallength# -  (5.25pm) reallength now returns 0 instead of "" -- bug# -  (9.06pm) ARGH!  Bloody variable reuse!!  Bloody Perl!!# -  (9.15pm) Making progress on getting the text to go were it's supposed to (finally!)# -  (9.22pm) Text now goes where it supposed to, erases last text correctly, and does not mess up the nick list!# - (11.48pm) Fixed white bug# - (12.16am) Did something silly :)  Implemented status colours for PROTOCOL_ICQ userlists (very unnecessary now)# - (12.36am) Annihilated $ousers :)# - (12.45am) Fixed AddUser# - (12.51am) Rewrote DelUser# -  (1.04am) Modified AddUser to one param again# -  (1.23am) Added $whichwin parameter to AddUser, RenUser, NameOf and DelUser# -  (1.44am) First implementation of SortUsers is done (for IRC, sort by mode)# -  (1.45am) Began implementation of alphabetical (?) sorting in AddUser## 13th of February, 2000# - (12.47pm) Started porting Strrrp# - (12.51pm) Finished porting Strrrp# - (12.51pm) Started porting RealLength# - (12.52pm) Finished porting RealLength# - (12.53pm) Started porting WrapLine# - (12.58pm) Finished porting WrapLine# - (12.58pm) Started porting DoubleQuote# -  (1.01pm) Finished porting DoubleQuote# -  (1.03pm) Began finishing porting DrawMainScreen# -  (1.06pm) Finished porting DrawMainScreen# -  (1.06pm) Started porting AddLine# -  (1.19pm) Finished porting AddLine# -  (1.21pm) Started porting AddLog# -  (1.22pm) Finished porting AddLog# -  (1.23pm) Started porting AddUser# -  ( ---- ) Fixed bug (from original AndyChat) to do with the online users count# -  ( ---- ) Finished porting AddUser# -  ( ---- ) Started porting RenUser# -  (2.07pm) Finished porting RenUser# -  (2.09pm) Implemented 'sortusers' into AddUser/RenUser for future expansion# -  (2.10pm) Started porting FindUser# -  (2.19pm) Finished porting FindUser# -  (2.20pm) Started porting NameOf# -  (2.22pm) Finished porting NameOf# -  (2.23pm) Started porting DelUser# -  ( ---- ) Fixed bug (from original AndyChat) to do with refreshing user view when unnecessary# -  ( ---- ) Fixed bug (from original AndyChat) to do with the online users count# -  (2.32pm) Finished porting DelUser# -  (2.34pm) Started porting UpdateGame# -  (2.47pm) Finished porting UpdateGame# -  (2.49pm) Started porting strpNoSpace# -  (2.51pm) Finished porting strpNoSpace# -  (2.52pm) Started porting ReadConfig# -  (3.05pm) Having break from porting ReadConfig# -  (3.45pm) Began changing $usr structures - grrr, why can't Perl work how I want it to# -  (4.09pm) Failed to fix bug which made AndyChat hang upon beeps in messies as well as ReadConfig# -  (4.12pm) Fixed reused var (argh!  How many times will this happen!) which was the -real- cause of the last bug#             even though the last bug probably did exist too :)# -  ( ---- ) Fixed config reading# -  ( ---- ) Fixed bugfix about the length of bits## 12th of February, 2000# -  (4.20pm) Implemented Lang instead of some hard coded stuffz# -  (4.30pm) Began porting ClearChatWindow(destruct)# -  (6.52pm) Ported all subs before ClearChatWindow and ClearChatWindow# -  (6.53pm) Started porting ClearAliasWindow# -  (6.54pm) Finished porting ClearAliasWindow# -  (6.55pm) Started porting DrawLeft# -  (7.07pm) Finished porting DrawLeft## 9th of February, 2000# - (11.xxpm) Initial Development# - (12.00am) Moved DrawMainScreen into a_common.pl# - (12.1xam) Wrote textcolor routine in curses2andy for easy(ier) colour changing# - (12.38am) Started LordWrite# - (xxxxxam) Finished LordWrite, LordWrite works (wow)##use Curses;#do 'andy-ext.pl';#do 'curses2andy.pl';#$mainwin = initscr();$mainwin = new Curses;getmaxyx($mainwin, $maxy, $maxx);start_color();sub colline {  my ($z1) = @_;  my $z2 = "1234567890!\@#\$\%";  return substr($z2, $z1 - 1, 1);}sub irccol {  my ($z1) = @_;  $z1 = "0$z1";  $z1 = " " . substr($z1, -2);  my $z2 = " 01 02 03 10 04 06 05 15 14 12 09 11 07 13 08 16";  return index($z2, $z1) / 3;}sub SaveModes {  my ($_win) = @_;  if (! $_win) { $_win = $mainwin; }  if (! $savedmodes) { $savedmodes = 1; } else { $savedmodes++; }  $savedmode[$savedmodes]{x} = wherex($_win);  $savedmode[$savedmodes]{y} = wherey($_win);  $_win->attr_get($savedmode[$savedmodes]{attr}, $savedmode[$savedmodes]{col});#  $savedmode[$savedmodes]{attr} = getattrs($_win);}sub RestoreModes {  my ($_win) = @_;  if (! $_win) { $_win = $mainwin; }  gotoxy($_win, $savedmode[$savedmodes]{x}, $savedmode[$savedmodes]{y});  $_win->attrset($savedmode[$savedmodes]{attr});  $_win->attrset($savedmode[$savedmodes]{col});  if ($savedmodes > 1) { $savedmodes--; } else { $savedmodes = ""; }

⌨️ 快捷键说明

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