📄 a_protocols_irc.pl
字号:
##!/usr/bin/perl## Schpati - Pre-Alpha of AndyChat v3.xx# MODULE: Protocols - IRC## Started on Thursday, 17th of February, 2000 around 11.15pm## 21st of July, 2002# - (1.52am) Added irc__on_error# - (2.00am) Added lots of handlers to irc__on_error for testing# - (2.06am) Added irc__raw for sending raw commands to server## 20th of July, 2002# - (11.37pm) Fixed bugs that stopped files being recognised as having downloaded successfully## 26th of May, 2002# - (11.25am) Maybe on_invite now shows us who is doing the inviting## 27th of February, 2002# - (12:30am) Fixed /INVITE exit issues## 23rd of November, 2001# - (8.40pm) Removed channel mode set twice, and undefined before defined warnings## 16th of July, 2001# - (5.35pm) Added another workaround for reconnect support## 21st of June, 2001# - (11.45pm) Added .in.[rand].filename naming for incoming DCCs due to dupe file receive problems## 11th of January, 2001# - (12.20pm) You can now leave channels which you are not visually 'in'# - (12.23pm) RedrawActivity moved in on_part to keep things clean# - (12.25pm) ... and again :)## 10th of January, 2001# - (9.21pm) Server auto-joins to channels now works## 9th of January, 2001# - (3.05pm) Nick changes now change their respective queries again## 21st of December, 2000# - (12.27am) Fixed joining to multiple channels with keys## 13th of December, 2000# - (12.36am) Nick -and- word highlighting is in# - (12.39am) Server status is now set correctly after an "Unable to reconnect" error# - (2.14am) Implemented safe handling of 'you are banned'# - (2.20pm) Implemented highlightcolour config option## 26th of June, 2000# - (5.48pm) Keep correct number of users in $irc__channel{users}## 24th of June, 2000# - (4.05am) Fixed pesky CTCP REPLY bug# - (7.25am) Fixed reconnect to wrong server bug (maybe)## 23rd of June, 2000# - (4.14pm) Now you can /join #channel,#channel,..## 22nd of June, 2000# - (10.54am) Workaround for wrong nick on reconnect## 21st of June, 2000# - (1.22am) Fixed pesky CTCP replies in wrong window problem# - (10.14am) People broke into my house -- no further development today## 20th of June, 2000# - (11.32pm) Moved code to $__irc_mark12# - (11.37pm) $__irc_mark10, $__irc_mark13, removed old old code for `@-`%=`@- :)# - (11.44pm) More code cleanups## 19th of June, 2000# - (4.56pm) Fixed a couple of irc__invite bugs (inviting when not meant to)# - (10.25pm) Various changes for $irc__server instead of $my# - (11.11pm) Fixes to irc__killChannel/killQuery and newServer# - (11.12pm) And killDCC# - (11.57pm) Things work kinda normally again methinks## 18th of June, 2000# - (1.15am) No more channel mode set twice incorrectly# - (9.09pm) Spelling irc__forcedisconnect correctly helps a lot!# - (10.28pm) Lots of rewriting to do $irc__ instead of $my, began irc__newQuery, irc__killQuery## 17th of June, 2000 - Extreme headache all morning# - (9.37pm) Fixed rejoinonkick, problem with new IRC structure, thanks Ben# - (10.34pm) Implementing config{ircservertimeout} to time quits out## 16th of June, 2000# - (5.33am) Display correct on_invite message# - (5.36am) Implemented $config{joinoninvite}# - (5.45am) New unified error thingie (yellow thingie)# - (6.16am) irc__newServer, irc__newChannel code tidyups# - (6.29am) irc__whichChannel# - (6.32am) irc__whichServer# - (7.13am) Several changes with the new $srv/$chn bits, little speedups and lots of slowdowns likely# - ( ---- ) Lots of reconnect on disconnect work# - (9.34am) Fixed some [Server Messages] vs Server Messages# - (9.04pm) Temporary workaround for little problem# - (10.20pm) Casing bug fixed## 13th of June, 2000# - (10.18pm) Fixed pings not going anywhere bug# - (10.28pm) Temporary on_invite# - (11.40pm) Sort modes nicely, removed unnecessary RedrawChanInfo() (I think)## 5th of June, 2000# - (5.30am) Added another Austnet extension to Net::IRC to stop nick change in event causing bad errors## 4th of June, 2000# - (1.25pm) Fixed 'Already in channel' bug# - (1.29pm) Added 'nonewwin' flag to irc__join, to prevent/force creating new window# - ( ---- ) Implemented irc__invite# - (7.19pm) Fixed rejoinonkick bug# - (7.30pm) Channel control is now a reference to Server control# - (8.37pm) Don't send blank user(dcc) to user## 3rd of June, 2000# - (11.10pm) Moved more stuff into irc__join in preparation for join on start and join on invite# - (11.58pm) Implemented rejoin on kick## 2nd of June, 2000 (after Build 0602 released :P)# - (8.04pm) Set rcontrol correctly on autodccget (minor bug)## 2nd of June, 2000# - (1.12am) DCC CHAT almost complete :)# - (1.14am) Queries now change when user's nick changes# - (3.15am) /DCC CHAT sends work now :)# - (5.43pm) whichDCC now looks at $acy->peerport and peeraddr :) Sneaky..# - (6.33pm) Rewrote irc__whichDCC several times, got DCC working again :)## 1st of June, 2000# - (9.25pm) Optimised some RedrawChanInfo() calls# - (9.32pm) Fixed some changes for CTCPs in Net::IRC 0.70 and later# - (9.41pm) on_cdcc fixes, CTCP is *VERY* different now(!!)# - (9.46pm) Silly silly me# - (11.01pm) irc__whichDCC implemented, irc__killDCC correctly named# - (11.09pm) Work begun on irc__on_dcc_open, ooo# - (12.04am) irc__on_dcc_open chat support done? irc__on_chat started## 31st of May, 2000# - (8.33pm) Code tidying @[ = $[# - (9.32pm) Do not DoubleQuote in on_motd (doublequote twice, ouch :P)## 30th of May, 2000# - (7.21pm) New on_caction handling for new Net::IRC, now only works with 0.70 or later## 29th of May, 2000# - (4.10pm) Started work on irc__newServer, irc__newChannel, irc__newDCC# - (4.10pm) Started work on irc__killServer, irc__killChannel, irc__killDCC## 28th of May, 2000# - (4.41pm) Window kills now jump to previous window, and windowcount is handled better# - (7.19pm) Removed some unnecessary ClearChatWindow things# - (8.17pm) Attempt to fix windows not parting correctly# - (8.21pm) Found the real bug for the above! :)# - (8.23pm) Take #2## 22nd of May, 2000# - (1.10pm) Made characters on end of line ncurses 5 compatible, upgrade now :P# - ( ---- ) Started on DCC stuffz## 13th of May, 2000# - (12.38am) Fixed who replies going to wrong window## 7th of May, 2000# - (9.07am) LOTS of pizza code cleanups# - (9.14am) Even more pizza code cleanups## 1st of May, 2000# - (11.15pm) Actions now follow queries too# - (11.17pm) Fixed 'no users displayed' in room bug## 29th of April, 2000# - (2.29am) More ` fixes to do with CTCP replies :)# - ( ---- ) Implemented on_ctime# - (7.27pm) Some NoMoreChannel implementation (not really happy with it)# - (10.11pm) Fixed phantom $thiswin vs $whichwin on_names bug# - (10.58pm) More RedrawActivity bits# - (11.32pm) privmsg/notice now return in proper windows (I think)## 28th of April, 2000# - (3.10am) Fixed several on_kick bugs# - (3.17am) Fixed several more on_kick bugs# - (3.19am) Fixed one more on_kick bug# - (3.39am) Added irc__kick function# - ( ---- ) Minor on_topic changes# - (4.05am) Added irc__on_topicinfo handler# - (4.35am) Painfully added better Austnet on_motd parsing which is cool# - (5.15am) on_crping, on_crversion, on_crfinger, on_crtime all implemented# - (5.44pm) Renamed to a_protocols_irc.pl# - (5.46pm) whichcontrol/foreachcontrol now check IRC windows only!# - (6.25pm) whichcontrol/foreachcontrol moved to a_protocols and $protocol parameter added## 12th of April, 2000# - (12.24am) Removed 'Channel mode set twice' warning for +l and +k changes# - (1.12am) Fix(?) for some uninit'd value thing which never happened in whichcontrol# - (1.12am) Also added query support to whichcontrol# - (1.38am) Added all room quit I think# - (1.42am) Possible fix for phantom modes after disconnect# - (1.44am) Not very good fix for phantom modes on on_part/on_kick# - (1.52am) Code tidying for do_disconnect# - (2.37am) Undid and redid earlier fix(?)# - (2.46am) Did earlier fix and recent fix properly :)# - (12.47pm) Removed an unnecessary(?) SortUsers command# - (4.28pm) Readded SortUsers command# - (8.44pm) Tried to fix on_kick problems## 11th of April, 2000# - (11.55pm) Fixed some bugs to do with using ` around the place## 9th of April, 2000# - (3.50pm) Fixed CTCP PIZZA crash :P# - (4.36pm) Fixed undef value when doing stuff with new channels and stuffz# - (4.46pm) Fixed contents of {id} to avoid multiple user@host causing probs :)# - (4.48pm) Fix for $tmpnick . "!" . $tmphost eq $my{id}# - (12.15am) Change so that receiving private actions are in Cyan like sending private actions## 8th of April, 2000# - (2.01pm) No more uninit'd value when in unassigned window# - (2.15pm) Added RedrawChanInfo after a chanmode change +o or +v on us# - (2.43pm) Fixed users randomly joining wrong channel, twas a casing issue# - (3.08pm) Several fixes for new $pizza and NoMore* things# - (3.17pm) Better channel/topic protection when killwindowonpart in use# - (3.28pm) Better protection against dupe pizza servers (on_part/on_quit now kill stale pizzas)# - (4.45pm) Added whoisinserverwindow and awayinserverwindow flags for outputting away/whois replies# - (5.00pm) Added on_nosuchnick# - (12.58am) on_motd/on_lusers changes for "Server Messages"# - (1.02am) Some fixes for on_mode stuffz# - (1.12am) Removed some error checking on whichcontrol :P# - (1.16am) Did some schtuffz to umm... the ummm... nick changing code## 6th of April, 2000# - (1.23am) Self nick change now causes a ChanInfo bar refresh# - (6.00pm) Added irc__mode# - (6.18pm) ChanInfo line updated after /part now# - (6.40pm) Added $config{killwindowonpart} support# - (10.55pm) Added $my{op} detection upon join## 5th of April, 2000# - (3.11pm) Implemented noupdate stuffz# - (3.27pm) Modes +o-o and +v-v should work to a degree# - (3.29pm) Fixed bug relating to sorting not happening in 'other' windows# - (3.46pm) Added on_cping# - (3.49pm) Fixed on_cping (wonder if that would've crashed clients :P)# - (4.23pm) Changed some BitchX stuff to AndyChat stuff# - (4.25pm) Restored BitchX stuff, AndyChat didn't work :)# - (11.35pm) Lots more on_mode stuffz# - (12.04am) Better self-op/self-voice detection# - (12.12am) User on_mode stuff half implemented, needs seperate function!# - (12.15am) Added do_usermodechange function mentioned above# - (12.20am) Made do_chanmodechange function aswell, for initial mode stuff# - (12.29am) Implemented on_chanmodeis## 4th of April, 2000# - (8.44pm) Added better on_topic support# - (8.57pm) on_topic support works now :)# - (9.57pm) Displays topic change info in room of topic change# - (10.30pm) Started implementing on_mode## 28th of March, 2000# - (2.21am) Added whichcontrol function thing and made AddLine changes# - (2.55am) Finished implementing all $thiswin changes (I think)# - (3.59am) Fixed ReTitle and RedrawNicks bug in on_part# - ( ---- ) Made DoubleQuote changes and scrapped them# - (4.14am) DoubleQuote'd public messies# - (5.08am) DoubleQuote'd a lot of stuffz :)# - (5.12am) Added irc__join# - (5.32am) Did lots of conversion for whichcontrol($self, $channel) stuff# - (6.11am) Fixed on_away display# - (6.19am) Added server workaround for no signon time# - (3.00pm) Started implementing foreachcontrol, global stuffz# - (3.14pm) foreachcontrol handler works :) Nick changes now work properly# - (3.15pm) Implemented foreachcontrol to on_quit, gotta love this :)# - (3.41pm) Channel specific server messies now end up in correct window# - (5.12pm) Clears topic (no more [#bla] Joining... with rooms with no topic)## 25th of March, 2000# - (1.05pm) Added better irc__on_disconnect parsing# - (1.46pm) Added irc__on_whoisvworld# - (1.48pm) Added irc__on_whoishelp# - (2.00pm) Better irc__on_disconnect parsing# - (3.45pm) Fixed typo which crashed upon topic change## 24th of March, 2000# - (1.10am) Added irc__on_cpizza# - (1.44am) Completed irc__on_cpizza# - (1.46am) Minor fixes to irc__on_cpizza# - ( ---- ) Implemented irc__on_endofnames and irc__on_whoreply for stuffz# - (3.17am) The new irc__on_join pizza stuff works :)# - (3.35am) Added irc__nick# - (3.45am) Added irc__on_nicknameinuse# - (4.11am) Added CTCP display for people requesting VERSION# - (1.24pm) Added whois idle parsing# - (1.32pm) Added irc__on_awaytoggle for unaway/nowaway modes# - (1.40pm) Added irc__on_away# - (1.41pm) Added irc__away# - (1.49pm) irc__on_away returns correct stuffz now# - (1.59pm) irc__on_awaytoggle now shows the args in grey# - (7.49pm) irc__on_msg now adds to pagess buffer# - (8.19pm) And does it properly too!# - (11.14pm) Added irc__part# - (11.38pm) Added irc__quit# - (11.44pm) Added irc__on_disconnect# - (11.51pm) Parsed the quit reason properly## 23rd of March, 2000# - (7.03pm) Added irc__ctcp# - (10.15pm) irc__on_join now sets $usr{id} to hostmask# - (11.37pm) irc__on_join triggers a ctcp pizza if me = pizza server## 22nd of March, 2000# - (1.26am) Added irc__on_nick## 21st of March, 2000# - (12.38pm) Changed ACS_BULLET to ACS_DEGREE# - ( ---- ) Added irc__on_lusers# - ( ---- ) Fixed .o. thing on server messies# - (1.08pm) -- MARK --# - ( ---- ) Added irc__on_notice# - (1.40pm) Added irc__on_cversion# - ( ---- ) Fixed irc__on_cversion# - (2.06pm) Added irc__on_topic# - ( ---- ) Fixed irc__on_topic# - ( ---- ) Fixed join/part message colours# - (2.18pm) Really fixed irc__on_topic# - ( ---- ) Fixed wrong character on self-actions# - (3.58pm) Added irc__on_quit# - (4.00pm) Added reason to quit/part message# - (4.05pm) Kinda got the reasons to work# - (4.20pm) Added irc__notice# - (10.28pm) Started whois stuffz# - (10.32pm) Added irc__on_whoisuser# - (10.34pm) Added irc__whois## 20th of March, 2000# - (11.01pm) Finished more of irc__on_caction from earlier# - ( ----- ) Added irc__privmsg# - ( ----- ) Added irc__action and got it working!# - ( ----- ) Added irc__on_motd## 5th of March, 2000# - (11.14pm) Changed incoming message format and private message format# - (earlier) Fixed IRC timeouts, even tho I have further work to do on em.## 17th of February, 2000# - (11.15pm) Initial Development# - ( ----- ) Added several IRC onevents# IRC Special Functionssub irc__inroom { my ($whichwin, $self) = @_; if ($window[$whichwin]{channel} && uc($window[$whichwin]{channel}) eq uc($tmpchannel)) { $tmpchannels++; }}sub irc__newServer { my ($acy) = @_; my $acz; if ($irc__servercount) { for ($acz = 1; $acz <= $irc__servercount; $acz++) { if (! $irc__server[$acz]{status}) { $irc__server[$acz]{window} = $acy; return $acz; } elsif ($acy && $irc__server[$acz]{window} eq $acy) { if ($irc__server[$acz]{status} ne 4) { AddLine($thiswin, "Malfunction in irc__newServer, stolen window -- please report", $__irc_mark14); } else { irc__killServer($acz, 1); $irc__server[$acz]{window} = $acy; return $acz; } } } $irc__servercount++; } else { $irc__servercount = 1; } irc__killServer($irc__servercount, 1); if ($acy) { $irc__server[$irc__servercount]{window} = $acy; } return $irc__servercount;}sub irc__whichServer { my ($acz) = @_; # (Self) my ($irc__i); if (! $irc__servercount) { return; } else { for ($irc__i = 1; $irc__i <= $irc__servercount; $irc__i++) { if ($irc__server[$irc__i]{control} eq $acz) { return $irc__i; } } }}sub irc__killServer { my ($acz, $acx) = @_; $irc__server[$acz]{control} = ""; $irc__server[$acz]{status} = ""; $irc__server[$acz]{ip} = ""; $irc__server[$acz]{port} = ""; $irc__server[$acz]{name} = ""; $irc__server[$acz]{id} = ""; $irc__server[$acz]{away} = ""; $irc__server[$acz]{modes} = ""; $irc__server[$acz]{window} = ""; $irc__server[$acz]{activetimeout} = ""; $irc__server[$acz]{channels} = 0; $irc__server[$acz]{queries} = 0; while (! $acx && $acz eq $irc__servercount && ! $irc__server[$irc__servercount]{status} && $irc__servercount) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -