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 users/users.tcl use...


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules irc/irc.tcl users/users.tcl use...
Date: Mon, 30 Jun 2003 02:25:05 -0400

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/06/30 02:25:05

Modified files:
        modules/irc    : irc.tcl 
        modules/users  : users.tcl users_arraydb.tcl 

Log message:
        Fixed a couple bugs in users*.tcl, and bypassed Papillon's broken
        pushmode stuff..

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/irc/irc.tcl.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/users/users.tcl.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/users/users_arraydb.tcl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.18 tcldrop/modules/irc/irc.tcl:1.19
--- tcldrop/modules/irc/irc.tcl:1.18    Wed Jun  4 17:02:38 2003
+++ tcldrop/modules/irc/irc.tcl Mon Jun 30 02:25:05 2003
@@ -4,7 +4,7 @@
 #              * All IRC related commands.
 #      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.18 2003/06/04 21:02:38 fireegl Exp $
+# $Id: irc.tcl,v 1.19 2003/06/30 06:25:05 fireegl Exp $
 #
 # Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
@@ -30,7 +30,7 @@
 namespace eval ::tcldrop::irc {
        # Provide the users module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.18 2003/06/04 21:02:38 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.19 2003/06/30 06:25:05 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
        variable Nicks
@@ -684,6 +684,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
@@ -972,18 +978,20 @@
 #    Returns: nothing
 # Proc by address@hidden
 proc ::tcldrop::irc::pushmode {channel mode {arg {}}} {
-       # FixMe: Do this right!   =(
-       #        It should store all the modes.
-       if {![botonchan $channel] || ($arg != {} && ![onchan $arg $channel]} { 
return }
-       variable PushModes
-       set element [string tolower $channel,$mode]
-       if {[info exists PushModes($element)] } {
-               array set modestodo $PushModes($element)
-               if {$arg != {}} { set arg [join "$modestodo(victim) $arg"] }
-       }
-       array set modestodo [list mode $mode victim $arg]
-       set PushModes($element) [array get modestodo]
-       after idle [list flushmode $channel]
+       if {[botonchan $channel]} {
+               putserv "MODE $channel $mode $arg"
+               # FixMe: We're returning here, because the rest of this code is 
broken (not to mention ugly)!
+               return 0
+               variable PushModes
+               set element [string tolower $channel,$mode]
+               if {[info exists PushModes($element)] } {
+                       array set modestodo $PushModes($element)
+                       if {$arg != {}} { set arg [join "$modestodo(victim) 
$arg"] }
+               }
+               array set modestodo [list mode $mode victim $arg]
+               set PushModes($element) [array get modestodo]
+               after idle [list flushmode $channel]
+       }
 }
 
 #  flushmode <channel>
@@ -1080,4 +1088,18 @@
                array unset channick
        }
        return [info exists found]
+}
+
+### MSG Commands:
+# Note, these may best be put into their own file (irc-msg.tcl)
+namespace eval ::tcldrop::irc::msg {}
+
+bind msg o|o op ::tcldrop::irc::msg::op
+proc ::tcldrop::irc::msg::op {nick host hand text} {
+       set pass [lindex [split $text] 0]
+       set chan [lindex $text end]
+       if {![passwdok $hand -] && [passwdok $hand $pass]} {
+               if {$chan != {}} { lappend channels $chan } else { set channels 
[channels] }
+               foreach c $channels { if {[matchattr $hand o|o $c]} { pushmode 
$c +o $nick } }
+       }
 }
Index: tcldrop/modules/users/users.tcl
diff -u tcldrop/modules/users/users.tcl:1.8 tcldrop/modules/users/users.tcl:1.9
--- tcldrop/modules/users/users.tcl:1.8 Tue May 27 11:32:09 2003
+++ tcldrop/modules/users/users.tcl     Mon Jun 30 02:25:05 2003
@@ -1,24 +1,24 @@
 # users.tcl --
 #
-# $Id: users.tcl,v 1.8 2003/05/27 15:32:09 fireegl Exp $
+# $Id: users.tcl,v 1.9 2003/06/30 06:25:05 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #
@@ -94,6 +94,7 @@
 # Searches the user database for the handle that most closely matches $nuhost.
 # Returns the matching handle, or "*" if none found.
 proc ::tcldrop::users::finduser {nuhost} {
+       if {![string match {*!*} $nuhost]} { set nuhost "*!$nuhost" }
        foreach a [binds finduser] {
                foreach {type flags mask count proc} $a {}
                if {[catch { $proc $nuhost } val]} {
@@ -155,13 +156,14 @@
 # Gets user related info:
 proc ::tcldrop::users::getuser {handle {type {}} {xtra {}}} {
        foreach a [binds getuser] {
-               foreach {type flags mask count proc} $a {}
-               if {[catch { $proc $handle $type $xtra } val]} {
+               foreach {bindtype flags mask count proc} $a {}
+               if {[catch { uplevel \#0 $proc $handle $type $xtra } val]} {
                        putlog "Error in script: $proc: $val"
                        puterrlog "$::errorInfo"
                        return -code error $val
+               } else {
+                       return $val
                }
-               return $val
        }
        return -code error {No user database module has been loaded.}
 }
@@ -177,11 +179,13 @@
 # It returns the new setting.
 proc ::tcldrop::users::setuser {handle {type {}} {setting {}} {xtra {}}} {
        foreach a [binds setuser] {
-               foreach {type flags mask count proc} $a {}
+               foreach {bindtype flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $type $setting $xtra } 
val]]} {
                        putlog "Error in script: $proc: $val"
                        puterrlog "$::errorInfo"
                }
+               putlog "lev: $lev"
+               putlog "val: $val"
                if {![info exists retval]} {
                        set retlev $lev
                        set retval $val
Index: tcldrop/modules/users/users_arraydb.tcl
diff -u tcldrop/modules/users/users_arraydb.tcl:1.6 
tcldrop/modules/users/users_arraydb.tcl:1.7
--- tcldrop/modules/users/users_arraydb.tcl:1.6 Tue May 27 11:32:09 2003
+++ tcldrop/modules/users/users_arraydb.tcl     Mon Jun 30 02:25:05 2003
@@ -1,24 +1,24 @@
 # users_arraydb.tcl --
 #
-# $Id: users_arraydb.tcl,v 1.6 2003/05/27 15:32:09 fireegl Exp $
+# $Id: users_arraydb.tcl,v 1.7 2003/06/30 06:25:05 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #




reply via email to

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