tcldrop-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tcldrop/CVS] tcldrop/modules/irc irc.tcl


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules/irc irc.tcl
Date: Sat, 29 Nov 2003 17:24:25 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/11/29 17:24:25

Modified files:
        modules/irc    : irc.tcl 

Log message:
        Commented on how to add support for raw 005.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/irc/irc.tcl.diff?tr1=1.27&tr2=1.28&r1=text&r2=text

Patches:
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.27 tcldrop/modules/irc/irc.tcl:1.28
--- tcldrop/modules/irc/irc.tcl:1.27    Sat Nov 29 01:05:56 2003
+++ tcldrop/modules/irc/irc.tcl Sat Nov 29 17:24:25 2003
@@ -4,7 +4,7 @@
 #              * All IRC related commands.
 #      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.27 2003/11/29 06:05:56 fireegl Exp $
+# $Id: irc.tcl,v 1.28 2003/11/29 22:24:25 fireegl Exp $
 #
 # Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
@@ -30,7 +30,7 @@
 namespace eval ::tcldrop::irc {
        # Provide the irc module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.27 2003/11/29 06:05:56 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.28 2003/11/29 22:24:25 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
        # Nicks stores the non-channel specific info for each nick:
@@ -71,6 +71,27 @@
        namespace export resetchan onchan botonchan nick2hand hand2nick 
handonchan getchanhost getchanjoin onchansplit chanlist getchanidle getchanmode 
pushmode flushmode topic botisop botishalfop botisvoice isop ishalfop wasop 
washalfop isvoice ischanban ischanexempt ischaninvite chanbans chanexempts 
chaninvites resetbans resetexempts resetinvites
 }
 
+# Note: These are the raw 005's from several networks.  (collected on November 
29, 2003)
+# FixMe: Add support for these to Tcldrop.
+# calvino.freenode.net: 5 FireEgl MODES=4 MAXCHANNELS=20 NICKLEN=16 USERLEN=10 
HOSTLEN=63 TOPICLEN=450 KICKLEN=450 CHANNELLEN=30 KEYLEN=23 CHANTYPES=# 
address@hidden CASEMAPPING=ascii CAPAB IRCD=dancer are available on this server
+# irc.choopa.net: 5 FireEgl STD=i-d address@hidden KNOCK EXCEPTS INVEX MODES=4 
MAXCHANNELS=90 MAXBANS=100 MAXTARGETS=6 NICKLEN=9 TOPICLEN=120 KICKLEN=120 are 
supported by this server
+# irc.choopa.net: 5 FireEgl CHANTYPES=#& PREFIX=(ov)@+ 
CHANMODES=eIb,k,l,imnpst NETWORK=EFnet CASEMAPPING=rfc1459 CHARSET=ascii 
CALLERID ETRACE WALLCHOPS are supported by this server
+# localhost.localdomain: 5 FireEgl WHOX WALLCHOPS WALLVOICES USERIP CPRIVMSG 
CNOTICE SILENCE=15 MODES=6 MAXCHANNELS=15 MAXBANS=45 NICKLEN=9 TOPICLEN=160 
AWAYLEN=160 KICKLEN=160 are supported by this server
+# localhost.localdomain: 5 FireEgl CHANTYPES=#& PREFIX=(ov)@+ 
CHANMODES=b,k,l,imnpstr CASEMAPPING=rfc1459 NETWORK=UnderNet are supported by 
this server
+# Elsene.Be.Eu.undernet.org: 5 FireEgl WHOX WALLCHOPS WALLVOICES USERIP 
CPRIVMSG CNOTICE SILENCE=15 MODES=6 MAXCHANNELS=20 MAXBANS=45 NICKLEN=9 
TOPICLEN=160 AWAYLEN=160 KICKLEN=160 are supported by this server
+# Elsene.Be.Eu.undernet.org: 5 FireEgl CHANTYPES=#& PREFIX=(ov)@+ 
CHANMODES=b,k,l,imnpstr CASEMAPPING=rfc1459 NETWORK=UnderNet are supported by 
this server
+# hotspeed.sg.as.dal.net: 5 FireEgl NOQUIT WATCH=128 SAFELIST MODES=6 
MAXCHANNELS=20 MAXBANS=100 NICKLEN=30 TOPICLEN=307 KICKLEN=307 CHANTYPES=# 
PREFIX=(ov)@+ NETWORK=DALnet SILENCE=10 CASEMAPPING=ascii 
CHANMODES=b,k,l,ciLmMnOprRst are available on this server
+#
+# Note: Here's my idea for adding support for these...
+#       When the bot connects to a server (raw 001), it takes all the globals
+#       such as modes-per-line, for example, and other per-server specific
+#       settings and puts them into the servers idxinfo..
+#       When it reaches raw 005 it'll replace those defaults in the servers
+#       idxinfo with the ones the server supports, like MODES=4, for example.
+#       The bot should then always look at the servers idxinfo instead of the
+#       global var for deciding how many modes-per-line to use (for example).
+#
+
 proc ::tcldrop::irc::resetchan {channel} {
        putquick "MODE $channel +b"
        putquick "MODE $channel"
@@ -425,11 +446,10 @@
 proc ::tcldrop::irc::TOPIC {from key arg} {
        set larg [split $arg]
        set nick [lindex [split $from !] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex [split $from !] 1]
        set channel [lindex $larg 0]
        set topic [string range [join [lrange $larg 1 end]] 1 end]
-       # FixMe: finduser maybe be too slow, therefore it may be better to 
extract the handle from the Nicks array.
-       set handle [finduser $uhost]
        variable Channels
        set element [string tolower $channel]
        if {[info exists Channels($element)]} { array set chaninfo 
$Channels($element) }
@@ -459,7 +479,7 @@
        }
        set uhost [lindex [split $from !] 1]
        set nick [string range $arg 1 end]
-       set handle [finduser $uhost]
+       set handle [finduser $nick!$uhost]
 
        # Call all the nick binds:
        putlog "Nick change: $oldnick -> $nick"
@@ -502,9 +522,9 @@
 bind raw - QUIT ::tcldrop::irc::SIGN 99
 proc ::tcldrop::irc::SIGN {from key arg} {
        set nick [lindex [split $from !] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex [split $from !] 1]
        set msg [string range $arg 1 end]
-       set handle [finduser $uhost]
        # Call all the sign binds:
        foreach b [binds sign] {
                foreach {type flags mask count proc} $b {}
@@ -530,11 +550,11 @@
 proc ::tcldrop::irc::KICK {from key arg} {
        set larg [split $arg]
        set nick [lindex [split $from !] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex [split $from !] 1]
        set channel [lindex $larg 0]
        set target [lindex $larg 1]
        set reason [string range [join [lrange $larg 2 end]] 1 end]
-       set handle [finduser $uhost]
        variable Nicks
        array unset Nicks [set lowernick [string tolower $nick]]
        variable ChannelNicks
@@ -607,10 +627,10 @@
 proc ::tcldrop::irc::PART {from key arg} {
        set larg [split $arg]
        set nick [lindex [split $from !] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex [split $from !] 1]
        set channel [lindex $larg 0]
        set msg [string range [join [lrange $larg 1 end]] 1 end]
-       set handle [finduser $uhost]
        # Call all the part binds:
        foreach b [binds part] {
                foreach {type flags mask count proc} $b {}
@@ -635,10 +655,10 @@
 proc ::tcldrop::irc::NOTICE {from key arg} {
        set larg [split $arg]
        set nick [lindex [split $from !] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex [split $from !] 1]
        set dest [lindex $larg 0]
        set text [string range [join [lrange $larg 1 end]] 1 end]
-       set handle [finduser $uhost]
        # Call all the notc binds:
        foreach b [binds notc] {
                foreach {type flags mask count proc} $b {}
@@ -654,8 +674,8 @@
 
 bind raw - PRIVMSG ::tcldrop::irc::PRIVMSG 99
 proc ::tcldrop::irc::PRIVMSG {from key arg} {
-       set handle [finduser $from]
        set nick [lindex [set from [split $from !]] 0]
+       set handle [nick2hand $nick]
        set uhost [lindex $from end]
        set larg [split $arg]
        set dest [lindex $larg 0]
@@ -697,6 +717,25 @@
        }
 }
 
+# All this does is clear out all the variables when we disconnect from the 
server:
+bind evnt - disconnect-server ::tcldrop::irc::disconnect-server
+proc ::tcldrop::irc::disconnect-server {event} {
+       variable Nicks
+       array unset Nicks
+       variable ChannelNicks
+       array unset ChannelNicks
+       variable Channel
+       array unset Channel
+       variable Bans
+       array unset Bans
+       variable Exempts
+       array unset Exempts
+       variable Invites
+       array unset Invites
+       # FixMe: It should probably clear the $::botnick and $::botname 
variables too..
+       #        Or should that be done in the server module?
+}
+
 #  ischanban <ban> <channel>
 #    Returns: 1 if the specified ban is on the given channel's ban list
 #      (not the bot's banlist for the channel)
@@ -729,13 +768,12 @@
 #      a sublist of the form {<ban> <bywho> <age>}. age is seconds from the
 #      bot's POV.
 #    Module: irc
-# FixMe: Add support for the age.
 proc ::tcldrop::irc::chanbans {channel} {
        set banlist [list]
        variable Bans
        foreach b [array names Bans [string tolower $channel],*] {
                array set baninfo $Bans($b)
-               lappend banlist [list $baninfo(ban) $baninfo(creator) 1]
+               lappend banlist [list $baninfo(ban) $baninfo(creator) 
$baninfo(created)]
        }
        return $banlist
 }
@@ -751,7 +789,7 @@
        variable Exempts
        foreach b [array names Exempts [string tolower $channel],*] {
                array set exemptinfo $Exempts($b)
-               lappend exemptlist [list $exemptinfo(exempt) 
$exemptinfo(creator) 1]
+               lappend exemptlist [list $exemptinfo(exempt) 
$exemptinfo(creator) $exemptinfo(created)]
        }
        return $exemptlist
 }
@@ -766,7 +804,7 @@
        variable Invites
        foreach b [array names Invites [string tolower $channel],*] {
                array set inviteinfo $Invites($b)
-               lappend invitelist [list $inviteinfo(ban) $inviteinfo(creator) 
1]
+               lappend invitelist [list $inviteinfo(ban) $inviteinfo(creator) 
$inviteinfo(created)]
        }
        return $invitelist
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]