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 00:04:30 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/11/29 00:04:30

Modified files:
        modules/irc    : irc.tcl 

Log message:
        Went through all the raw binds and fixed/tweaked 'em.. gj though 
Papillion, I didn't have to change much. =)  (They're still untested though)

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

Patches:
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.25 tcldrop/modules/irc/irc.tcl:1.26
--- tcldrop/modules/irc/irc.tcl:1.25    Fri Nov 28 19:50:07 2003
+++ tcldrop/modules/irc/irc.tcl Sat Nov 29 00:04:29 2003
@@ -4,7 +4,7 @@
 #              * All IRC related commands.
 #      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.25 2003/11/29 00:50:07 fireegl Exp $
+# $Id: irc.tcl,v 1.26 2003/11/29 05:04:29 fireegl Exp $
 #
 # Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
@@ -30,21 +30,37 @@
 namespace eval ::tcldrop::irc {
        # Provide the irc module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.25 2003/11/29 00:50:07 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.26 2003/11/29 05:04:29 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
        # Nicks stores the non-channel specific info for each nick:
+       # Format: Nicks($lowernick) {array data}
+       # Array data contains the following types:
+       # nick, handle, ident, address, and realname (if available).
        variable Nicks
        array set Nicks {}
+
        # ChannelNicks stores the channel specific info for each nick:
+       # Format: ChannelNicks($lowerchannel,$lowernick) {array data}
+       # Array data contains the following types:
+       # op, voice, halfop, jointime, idletime.
        variable ChannelNicks
        array set ChannelNicks {}
+
        # Channels stores the non-nick specific info for each channel:
+       # Format: Channels($lowerchannel) {array data}
+       # Array data contains the following types:
+       # channel, chanmodes, topic.
        variable Channels
        array set Channels {}
+
        # Bans stores the currently active channel bans:
+       # Format: Bans($lowerchannel,$lowerban) {array data}
+       # Array data contains the following types:
+       # ban, creator, created, channel.
        variable Bans
        array set Bans {}
+
        # PushModes stores all the modes that need to be pushed to the server 
when we next hit the Tcl event loop (or when flushmode is called manually).
        variable PushModes
        array set PushModes {}
@@ -250,40 +266,40 @@
        set nick [lindex $larg 1]
        set ident [lindex $larg 2]
        set address [lindex $larg 3]
-       #set unknown [lindex $larg 4]
-       set realname [string range [join [lrange $larg 5 end]] 1 end]
-       set handle [finduser "address@hidden"]
-       variable Nicks
-       set element [string tolower $nick]
-       array set nickinfo [array get Nicks $element]
-       array set nickinfo [list nick $nick ident $ident address $address 
realname $realname hand $handle]
-       set Nicks($element) [array get nickinfo]
-       # FixMe: Not sure if it's sposta be $nick in the next two lines:
        if {[string equal $dest $nick]} {
                # We WHOIS'd ourself.. (probably on connect to IRC)
                # So we should update our botname variable:
                set ::botname "address@hidden"
        }
+       if {[onchan $nick]} {
+               #set unknown [lindex $larg 4]
+               set realname [string range [join [lrange $larg 5 end]] 1 end]
+               set handle [finduser "address@hidden"]
+               variable Nicks
+               set element [string tolower $nick]
+               if {[info exists Nicks($element)]} { array set nickinfo 
$Nicks($element)] }
+               array set nickinfo [list nick $nick ident $ident address 
$address realname $realname handle $handle]
+               set Nicks($element) [array get nickinfo]
+       }
 }
 
 # irc.choopa.net: 317 FireEgl FireEgl 193 1050624422 seconds idle, signon time
 # Process results from a WHOIS:
 # Proc by address@hidden
 # FixMe: Untested and unmodified.
-bind raw - 317 ::tcldrop::irc::317 99
-proc ::tcldrop::irc::317 {from key arg} {
-       # FixMe: This should set the initial idle (lastspoke) time, and join 
time.
-       set larg [split $arg]
-       set nick [lindex $larg 1]
-       set idle [lindex $larg 2]
-       set jointime [lindex $larg 3]
-       variable Nicks
-       set element [string tolower $nick]
-       if {![info exists Nicks($element)]} { set Nicks($element) {} }
-       array set nickinfo $Nicks($element)
-       array set nickinfo [list idle $idle logon $jointime ]
-       set Nicks($element) [array get nickinfo]
-}
+# bind raw - 317 ::tcldrop::irc::317 99
+#proc ::tcldrop::irc::317 {from key arg} {
+#      # FixMe: This should set the initial idle (lastspoke) time, and join 
time.
+#      set larg [split $arg]
+#      set nick [lindex $larg 1]
+#      set idle [lindex $larg 2]
+#      set jointime [lindex $larg 3]
+#      variable Nicks
+#      set element [string tolower $nick]
+#      if {[info exists Nicks($element)]} { array set nickinfo 
$Nicks($element) }
+#      array set nickinfo [list idle $idle logon $jointime]
+#      set Nicks($element) [array get nickinfo]
+#}
 
 bind evnt - init-server ::tcldrop::irc::Init-Server 99
 proc ::tcldrop::irc::Init-Server {type} {
@@ -296,33 +312,34 @@
 bind raw - JOIN ::tcldrop::irc::JOIN 99
 proc ::tcldrop::irc::JOIN {from key arg} {
        set channel [string range $arg 1 end]
+       # If the bot itself just joined the channel, do a resetchan:
        if {[string equal $from $::botname]} { resetchan $channel }
        set nick [lindex [split $from !] 0]
-       set uhost [lindex [split $from !] end]
-       set handle [finduser $uhost]
+       set ident [lindex [split $from address@hidden 1]
+       set address [lindex [split $from @] end]
+       set handle [finduser $from]
        #Updating the Nicks/ChannelNicks arrays
-       variable Nicks
        variable ChannelNicks
-       set element [string tolower $channel,$nick]
-       if {![info exists Nicks([string tolower $nick])]} {
-               putserv "WHOIS $nick"
-               array set blabla [list nick $nick op 0 voice 0 halfop 0 "join" 
[set m [clock seconds]] "idle" $m]
-               set ChannelNicks($element) [array get blabla]
-       }
+       array set channickinfo [list nick $nick op 0 voice 0 halfop 0]
+       set ChannelNicks([string tolower "$channel,$nick"]) [array get 
channickinfo]
+       variable Nicks
+       if {[info exists Nicks([set element [string tolower $nick]])]} { array 
set nickinfo $Nicks($element) }
+       array set nickinfo [list nick $nick handle $handle ident $ident address 
$address]
+       set Nicks($element) [array get nickinfo]
        # Call all the join binds:
        foreach b [binds join] {
                foreach {type flags mask count proc} $b {}
                if {[string match -nocase $mask "$channel $from"] && [matchattr 
$handle $flags $channel]} {
-                       ::tcldrop::countbind $type $mask $proc
-                       if {[catch { $proc $nick $uhost $handle $channel } 
err]} {
+                       if {[catch { $proc $nick address@hidden $handle 
$channel } err]} {
                                putlog "Error in $proc: $err"
                                puterrlog "$::errorInfo"
                        }
+                       ::tcldrop::countbind $type $mask $proc
                }
        }
 }
 
-#irc.blessed.net 367 TiCkLe #tclsh address@hidden address@hidden 1053610707
+# irc.blessed.net 367 TiCkLe #tclsh address@hidden address@hidden 1053610707
 # Process the results of MODE $channel +b:
 bind raw - 367 ::tcldrop::irc::367 99
 proc ::tcldrop::irc::367 {from key arg} {
@@ -331,21 +348,12 @@
        set ban [lindex $larg 2]
        set creator [lindex $larg 3]
        set created [lindex $larg 4]
-       # FixMe: Complete this.
-       # We need to make a second ban-array to seperate the bans on channel, 
and the
-       # internal bans set by the bot (active or not)
        variable Bans
-       set element [string tolower $channel,$ban]
-       if {![info exists Bans($element]} { set Bans($element {} }
-       array set chanbans $Bans($element)
-       array set chanbans [list ban $ban creator $creator created $created]
-       set Bans($element) [array get chanbans]
+       set Bans([string tolower $channel,$ban]) [list ban $ban creator 
$creator created $created channel $channel]
 }
 
-
 # irc.choopa.net: 324 FireEgl #channel +tn
 # Process the results from MODE $channel:
-# Proc by address@hidden
 bind raw - 324 ::tcldrop::irc::324 99
 proc ::tcldrop::irc::324 {from key arg} {
        set larg [split $arg]
@@ -353,57 +361,66 @@
        set modes [join [lrange $larg 2 end]]
        variable Channels
        set element [string tolower $channel]
-       if {![info exists Channels($element)]} { set Channels($element) {} }
-       array set chaninfo $Channels($element)
-       array set chaninfo [list modes $modes]
+       if {[info exists Channels($element)]} { array set chaninfo 
$Channels($element) }
+       array set chaninfo [list chanmodes $modes channel $channel]
        set Channels($element) [array get chaninfo]
 }
 
-
 # irc.choopa.net: 329 FireEgl #channel 1050676546
 # Process the results from MODE $channel:
 # Proc by address@hidden
-bind raw - 329 ::tcldrop::irc::329 99
-proc ::tcldrop::irc::329 {from key arg} {
-       set larg [split $arg]
-       set channel [lindex $larg 1]
-       # This is the unixtime of when the channel was created:
-       set created [lindex $larg end]
-       variable Channels
-       set element [string tolower $channel]
-       if {![info exists Channels($element)]} { set Channels($element) {} }
-       array set chaninfo $Channels($element)
-       array set chaninfo [list created $created]
-       set Channels($element) [array get chaninfo]
-}
-
+# bind raw - 329 ::tcldrop::irc::329 99
+#proc ::tcldrop::irc::329 {from key arg} {
+#      set larg [split $arg]
+#      set channel [lindex $larg 1]
+#      # This is the unixtime of when the channel was created:
+#      set created [lindex $larg end]
+#      variable Channels
+#      set element [string tolower $channel]
+#      if {![info exists Channels($element)]} { set Channels($element) {} }
+#      array set chaninfo $Channels($element)
+#      array set chaninfo [list created $created]
+#      set Channels($element) [array get chaninfo]
+#}
 
 # irc.homelien.no 331 Papillon #channel :No topic is set
 # Process the results from TOPIC $channel: if no topic is set
 # Proc by address@hidden
 bind raw - 331 ::tcldrop::irc::331 99
-proc ::tcldrop::irc::331 {from key arg} { ::tcldrop::irc::332 $from $key [join 
[lrange [split $arg] 0 1]] }
-
+proc ::tcldrop::irc::331 {from key arg} { 332 $from $key [join [lrange [split 
$arg] 0 1]] }
 
 # irc.homelien.no 332 Papillon #channel :topic
 # Process the results from TOPIC $channel:
-# Proc by address@hidden
 bind raw - 332 ::tcldrop::irc::332 99
 proc ::tcldrop::irc::332 {from key arg} {
        set larg [split $arg]
        set topic [string range [join [lrange $larg 2 end]] 1 end]
        set channel [lindex $larg 1]
-
        variable Channels
        set element [string tolower $channel]
-       if {![info exists Channels($element)]} { set Channels($element) {} }
-       array set chaninfo $Channels($element)
-       array set chaninfo [list topic $topic]
+       if {[info exists Channels($element)]} { array set chaninfo 
$Channels($element) }
+       array set chaninfo [list topic $topic channel $channel]
        set Channels($element) [array get chaninfo]
 }
 
+# irc.choopa.net: 333 FireEgl #tcl address@hidden 1069721590
+# Process the results from TOPIC $channel:
+# This tells us the creator and created time.
+bind raw - 333 ::tcldrop::irc::333 99
+proc ::tcldrop::irc::333 {from key arg} {
+       set larg [split $arg]
+       set channel [lindex $larg 1]
+       set creator [lindex $larg 2]
+       set created [lindex $larg 3]
+       variable Channels
+       set element [string tolower $channel]
+       if {[info exists Channels($element)]} { array set chaninfo 
$Channels($element) }
+       array set chaninfo [list topic-creator $creator topic-created $created]
+       set Channels($element) [array get chaninfo]
+}
 
-# Proc by address@hidden
+# address@hidden TOPIC #test :blah blah
+# Triggered when somebody changes the topic.
 bind raw - TOPIC ::tcldrop::irc::TOPIC 99
 proc ::tcldrop::irc::TOPIC {from key arg} {
        set larg [split $arg]
@@ -411,25 +428,22 @@
        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)]} { set Channels($element) {} }
-       array set chaninfo $Channels($element)
-       if {[string equal -nocase $topic $chaninfo(topic)]} { return }
-       array set chaninfo [list topic $topic]
+       if {[info exists Channels($element)]} { array set chaninfo 
$Channels($element) }
+       array set chaninfo [list topic $topic topic-creator $from topic-created 
[clock seconds]]
        set Channels($element) [array get chaninfo]
-
        # Call all the topc binds:
        foreach b [binds topc] {
                foreach {type flags mask count proc} $b {}
                if {[string match -nocase $mask "$channel $topic"]} {
-                       ::tcldrop::countbind $type $mask $proc
                        if {[catch { $proc $nick $uhost $handle $channel $topic 
} err]} {
                                putlog "Error in $proc: $err"
                                puterrlog "$::errorInfo"
                        }
+                       ::tcldrop::countbind $type $mask $proc
                }
        }
 }
@@ -438,11 +452,10 @@
 # Proc by address@hidden
 # FixMe: Untested and unmodified.
 proc ::tcldrop::irc::NICK {from key arg} {
-       global botnick
        set oldnick [lindex [split $from !] 0]
        if {![string equal $::botnick $::nick] && [string equal -nocase 
$oldnick $::nick]} {
                putserv "NICK $::nick"
-               set botnick $::nick
+               set ::botnick $::nick
        }
        set uhost [lindex [split $from !] 1]
        set nick [string range $arg 1 end]
@@ -464,6 +477,7 @@
        }
 }
 
+# FixMe: redo this.
 bind nick - * ::tcldrop::irc::nick 0
 proc ::tcldrop::irc::nick {nick uhost handle channel newnick} {
        set lowernick [string tolower $nick]
@@ -491,17 +505,16 @@
        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 {}
                foreach channel [channels] {
                        if {[string match -nocase $mask "$channel $uhost"] && 
[matchattr $handle $flags $channel]} {
-                               ::tcldrop::countbind $type $mask $proc
                                if {[catch { $proc $nick $uhost $handle 
$channel $msg } err]} {
                                        putlog "Error in $proc: $err"
                                        puterrlog "$::errorInfo"
                                }
+                               ::tcldrop::countbind $type $mask $proc
                        }
                }
        }
@@ -519,34 +532,26 @@
        set nick [lindex [split $from !] 0]
        set uhost [lindex [split $from !] 1]
        set channel [lindex $larg 0]
-       set victim [lindex $larg 1]
+       set target [lindex $larg 1]
        set reason [string range [join [lrange $larg 2 end]] 1 end]
        set handle [finduser $uhost]
-
-       set el [string tolower $channel]
+       variable Nicks
+       array unset Nicks [set lowernick [string tolower $nick]]
        variable ChannelNicks
-       array unset ChannelNicks $element,*
-       if {[array get ChannelNicks [string tolower *,$nick]] == {}} {
-               variable Nicks
-               array unset Nicks [string tolower $nick]
-       }
-
+       array unset ChannelNicks [string tolower $channel],$lowernick
        # Call all the kick binds:
        foreach b [binds kick] {
                foreach {type flags mask count proc} $b {}
-               foreach channel [channels] {
-                       if {[string match -nocase $mask "$channel $victim"]} {
-                               ::tcldrop::countbind $type $mask $proc
-                               if {[catch { $proc $nick $uhost $handle 
$channel $victim $reason } err]} {
-                                       putlog "Error in $proc: $err"
-                                       puterrlog "$::errorInfo"
-                               }
+               if {[string match -nocase $mask "$channel $target"]} {
+                       if {[catch { $proc $nick $uhost $handle $channel 
$target $reason } err]} {
+                               putlog "Error in $proc: $err"
+                               puterrlog "$::errorInfo"
                        }
+                       ::tcldrop::countbind $type $mask $proc
                }
        }
 }
 
-
 # irc.choopa.net: 433 FireEgl NewNick Nickname is already in use.
 # will choose the alternate nick, if that's taken aswell it will set 
Lamestbotxx
 # where xx is random numbers
@@ -556,12 +561,10 @@
        if {[string equal $oldnick $::nick]} {
                putserv "NICK $::altnick"
        } elseif {[string equal $oldnick $::altnick]} {
-               set newnick "$::nick[rand 99]"
-               putserv "NICK $newnick"
+               putserv "NICK $::nick[rand 99]"
        }
 }
 
-
 # irc.choopa.net: 352 FireEgl #channel ~FireEgl 
adsl-17-134-83.bhm.bellsouth.net irc.choopa.net FireEgl H@ 0 Proteus
 # Process the results from WHO $channel:
 bind raw - 352 ::tcldrop::irc::352 99
@@ -577,33 +580,25 @@
        set flags [string trimleft [lindex $larg 6] {HG*xXd!}]
        #set hops [string trimleft [lindex $larg 7] :]
        set realname [join [lrange $larg 8 end]]
-       set handle [finduser [maskhost "address@hidden"]]
-       # Nicks stores global nick info (not bot-info, we got that already):
-       if {![string equal $nick $::botnick]} {
-               variable Nicks
-               set element [string tolower $nick]
-               array set nickinfo [array get Nicks $element]
-               array set nickinfo [list nick $nick ident $ident address 
$address realname $realname hand $handle]
-               set Nicks($element) [array get nickinfo]
-       }
-
-       # ChannelNicks stores channel specific info on nicks:
+       set handle [finduser "address@hidden"]
+       variable Nicks
+       set element [string tolower $nick]
+       if {[info exists Nicks($element)]} { array set nickinfo 
$Nicks($element) }
+       array set nickinfo [list nick $nick ident $ident address $address 
realname $realname handle $handle]
+       set Nicks($element) [array get nickinfo]
        variable ChannelNicks
        set element [string tolower "$channel,$nick"]
-       array set channick [array get ChannelNicks $element]
-       if {![info exists ChannelNicks($element)]} { array set channick [list 
idle [set m [clock seconds]] "join" $m] }
-       set op 0
-       set voice 0
-       set halfop 0
-       foreach f $flags {
+       if {[info exists ChannelNicks($element)]} { array set channickinfo 
$ChannelNicks($element) }
+       set op [set voice [set halfop 0]]
+       foreach f [split $flags {}] {
                switch -- $f {
                        address@hidden { set op 1 }
                        {+} { set voice 1 }
                        {%} { set halfop 1 }
                }
        }
-       array set channick [list nick $nick op $op voice $voice halfop $halfop]
-       set ChannelNicks($element) [array get channick]
+       array set channickinfo [list idletime [clock seconds] jointime [clock 
seconds] nick $nick op $op voice $voice halfop $halfop]
+       set ChannelNicks($element) [array get channickinfo]
        return 0
 }
 
@@ -616,23 +611,20 @@
        set channel [lindex $larg 0]
        set msg [string range [join [lrange $larg 1 end]] 1 end]
        set handle [finduser $uhost]
-
-       #chanrem [lindex $a 2]
        # Call all the part binds:
        foreach b [binds part] {
                foreach {type flags mask count proc} $b {}
                if {[string match -nocase $mask "$channel $uhost"] && 
[matchattr $handle $flags $channel]} {
-                       ::tcldrop::countbind $type $mask $proc
                        if {[catch { $proc $nick $uhost $handle $channel $msg } 
err]} {
                                putlog "Error in $proc: $err"
                                puterrlog "$::errorInfo"
                        }
+                       ::tcldrop::countbind $type $mask $proc
                }
        }
        variable ChannelNicks
-       set element [string tolower "$channel,$nick"]
-       array unset ChannelNicks $element
-       if {[array get ChannelNicks [string tolower *,$nick]] == {}} {
+       array unset ChannelNicks [string tolower "$channel,$nick"]
+       if {![onchan $nick]} {
                variable Nicks
                array unset Nicks [string tolower $nick]
        }
@@ -647,79 +639,26 @@
        set dest [lindex $larg 0]
        set text [string range [join [lrange $larg 1 end]] 1 end]
        set handle [finduser $uhost]
-       if {$nick == {} && $uhost == {} && $handle == {*}} { return }
        # Call all the notc binds:
        foreach b [binds notc] {
                foreach {type flags mask count proc} $b {}
-               # I checked and though it doesn't say so in tcl-commands.txt 
this bind ignores flags
-               if {[string match -nocase $mask "$text"]} {
-                       ::tcldrop::countbind $type $mask $proc
+               if {[string match -nocase $mask $text] && [matchattr $handle 
$flags]} {
                        if {[catch { $proc $nick $uhost $handle $text $dest } 
err]} {
                                putlog "Error in $proc: $err"
                                puterrlog "$::errorInfo"
                        }
+                       ::tcldrop::countbind $type $mask $proc
                }
        }
 }
 
 bind raw - PRIVMSG ::tcldrop::irc::PRIVMSG 99
-proc ::tcldrop::irc::PRIVMSGx {from key arg} {
-       # FixMe: Need a command that finds the users handle.
-       set handle [finduser $from]
-       set nick [lindex [set from [split $from !]] 0]
-       set uhost [lindex $from end]
-       set larg [split $arg]
-       set dest [lindex $larg 0]
-       if {[string index $arg 0] == "\001"} {
-               set keyword [string toupper [join [lrange [split [string 
trimleft $arg ":\001"]] 1]]]
-               set text [string trimright [join [lrange $larg 2 end] "\001"]]
-               # All CTCP binds are called:
-               ::tcldrop::irc::callctcp $nick $uhost $handle $dest $keyword 
$text
-       } else {
-               set text [string range [join [lrange $larg 1 end]] 1 end]
-               set ltext [split [string trim $text]]
-               set command [lindex $ltext 0]
-               set args [string trimleft [join [lrange $ltext 1 end]]]
-               if {[isbotnick $dest]} {
-                       # All MSG binds are called:
-                       if {![::tcldrop::irc::callmsg $nick $uhost $handle 
$command $args]} {
-                               # If callmsg returned 0, do the MSGM binds:
-                               ::tcldrop::irc::callmsgm $nick $uhost $handle 
$text
-                       }
-               } else {
-                       # All PUB binds are called:
-                       if {![::tcldrop::irc::callpub $nick $uhost $handle 
$dest $command $args]} {
-                               # If callpub returned 0, do the PUBM binds:
-                               ::tcldrop::irc::callpubm $nick $uhost $handle 
$dest $text
-                       }
-               }
-       }
-       # Stuff I'll need to know how to reply to PINGs:
-       #if {[string compare $owner [lindex $a 0]] == 0} {
-       #       putlog "#[raw2nick $owner]# [lindex [lrange [split $a :] 2 end] 
0]"
-       #       docmd [lindex [lrange [split $a :] 2 end] 0]
-       #}
-       #if {[string compare ":\001PING" [lindex $a 3]]==0} {
-       #       putlog "CTCP PING From: [raw2nick [lindex $a 0]]"
-       #       if {[string compare $owner [lindex $a 0]] == 0} {
-               #               putserv "NOTICE [raw2nick [lindex $a 0]] 
:\001PING [expr [clock seconds] - [lindex $a 4]] [lindex $a 5]"
-       #       } else {
-       #               # Ohh damn, we are lagged ;)
-       #               putserv "NOTICE [raw2nick [lindex $a 0]] :\001PING 
[expr [clock seconds] - [lindex $a 4] + 1[random 9]] [lindex $a 5]"
-       #       }
-       #}
-}
-
-# Proc modified by address@hidden:
-# FixMe: This proc is untested, once verified that it works it'll be safe to 
remove the original one (above).
 proc ::tcldrop::irc::PRIVMSG {from key arg} {
-       # FixMe: Need a command that finds the users handle.
+       set handle [finduser $from]
        set nick [lindex [set from [split $from !]] 0]
        set uhost [lindex $from end]
-       set handle [finduser $uhost]
        set larg [split $arg]
        set dest [lindex $larg 0]
-       puts "$handle $nick $uhost $larg $dest"
        if {[string index $arg 0] == "\001"} {
                set keyword [string toupper [join [lrange [split [string 
trimleft $arg ":\001"]] 1]]]
                set text [string trimright [join [lrange $larg 2 end] "\001"]]
@@ -744,23 +683,12 @@
                set args [string trimleft [join [lrange $ltext 1 end]]]
                if {[isbotnick $dest]} {
                        # All MSG binds are called:
-                       putlog "callmsg:"
-                       putlog "nick: $nick"
-                       putlog "uhost: $uhost"
-                       putlog "handle: $handle"
-                       putlog "command: $command"
-                       putlog "args: $args"
                        if {![::tcldrop::irc::callmsg $nick $uhost $handle 
$command $args]} {
                                # If callmsg returned 0, do the MSGM binds:
                                ::tcldrop::irc::callmsgm $nick $uhost $handle 
$text
                        }
                } else {
                        # All PUB binds are called:
-                       variable ChannelNicks
-                       set element [string tolower $dest,$nick]
-                       array set nickinfo $ChannelNicks($element)
-                       array set nickinfo [list idle [clock seconds]]
-                       set ChannelNicks($element) [array get nickinfo]
                        if {![::tcldrop::irc::callpub $nick $uhost $handle 
$dest $command $args]} {
                                # If callpub returned 0, do the PUBM binds:
                                ::tcldrop::irc::callpubm $nick $uhost $handle 
$dest $text
@@ -1024,10 +952,11 @@
 #  getchanmode <channel>
 #    Returns: string of the type "+ntik key" for the channel specified
 proc ::tcldrop::irc::getchanmode {channel} {
-       if {![botonchan $channel]} { return }
-       variable Channels
-       array set chanmode $Channels([string tolower $channel])
-       return $chanmode(modes)
+       if {[botonchan $channel]} {
+               variable Channels
+               array set chanmode $Channels([string tolower $channel])
+               return $chanmode(modes)
+       }
 }
 
 #  pushmode <channel> <mode> [arg]




reply via email to

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