tcldrop-commits
[Top][All Lists]
Advanced

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

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


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules/users users.tcl
Date: Mon, 01 Dec 2003 18:25:47 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/12/01 18:25:47

Modified files:
        modules/users  : users.tcl 

Log message:
        Define the users bind type with each command as the binds mask.
        This was done so that [binds users] would return all the user-related 
binds.

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

Patches:
Index: tcldrop/modules/users/users.tcl
diff -u tcldrop/modules/users/users.tcl:1.18 
tcldrop/modules/users/users.tcl:1.19
--- tcldrop/modules/users/users.tcl:1.18        Sun Nov 30 20:59:52 2003
+++ tcldrop/modules/users/users.tcl     Mon Dec  1 18:25:47 2003
@@ -1,6 +1,6 @@
 # users.tcl --
 #
-# $Id: users.tcl,v 1.18 2003/12/01 01:59:52 fireegl Exp $
+# $Id: users.tcl,v 1.19 2003/12/01 23:25:47 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -51,7 +51,7 @@
 
 namespace eval ::tcldrop::users {
        variable version {0.7}
-       variable rcsid {$Id: users.tcl,v 1.18 2003/12/01 01:59:52 fireegl Exp $}
+       variable rcsid {$Id: users.tcl,v 1.19 2003/12/01 23:25:47 fireegl Exp $}
        # Provide the users module:
        package provide tcldrop::users $version
        # Export all the commands that should be available to 3rd-party 
scripters:
@@ -62,7 +62,7 @@
 
 # Returns the number of users in the user database:
 proc ::tcldrop::users::countusers {} {
-       foreach a [binds countusers] {
+       foreach a [binds users countusers] {
                foreach {type flags mask count proc} $a {}
                if {[catch { $proc } val]} {
                        putlog "Error in script: $proc: $val"
@@ -78,7 +78,7 @@
 # Checks to see if $handle is a valid user in the user database:
 # Returns 1 if they are, 0 if they're not.
 proc ::tcldrop::users::validuser {handle} {
-       foreach a [binds validuser] {
+       foreach a [binds users validuser] {
                foreach {type flags mask count proc} $a {}
                if {[catch { $proc $handle } val]} {
                        putlog "Error in script: $proc: $val"
@@ -95,7 +95,7 @@
 # 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 a [binds users finduser] {
                foreach {type flags mask count proc} $a {}
                if {[catch { $proc $nuhost } val]} {
                        putlog "Error in script: $proc: $val"
@@ -110,7 +110,7 @@
 
 # Checks $handle for $flags, $channel is optional.
 proc ::tcldrop::users::matchattr {handle flags {channel {}}} {
-       foreach a [binds matchattr] {
+       foreach a [binds users matchattr] {
                foreach {type bindsflags mask count proc} $a {}
                if {[catch { $proc $handle $flags $channel } val]} {
                        putlog "Error in script: $proc: $val"
@@ -130,7 +130,7 @@
 
 # Returns all the users matching $flags (flags are optional).
 proc ::tcldrop::users::userlist {{flags {}}} {
-       foreach a [binds userlist] {
+       foreach a [binds users userlist] {
                foreach {type bindsflags mask count proc} $a {}
                if {[catch { $proc $flags } val]} {
                        putlog "Error in script: $proc: $val"
@@ -144,7 +144,7 @@
 }
 
 proc ::tcldrop::users::passwdok {handle {pass {-}}} {
-       foreach a [binds passwdok] {
+       foreach a [binds users passwdok] {
                foreach {type flags mask count proc} $a {}
                if {[catch { $proc $handle $pass } val]} {
                        putlog "Error in script: $proc: $val"
@@ -159,7 +159,7 @@
 
 # Gets user related info:
 proc ::tcldrop::users::getuser {handle {type {}} {xtra {}}} {
-       foreach a [binds getuser] {
+       foreach a [binds users getuser] {
                foreach {bindtype flags mask count proc} $a {}
                if {[catch { uplevel \#0 $proc $handle $type $xtra } val]} {
                        putlog "Error in script: $proc: $val"
@@ -184,7 +184,7 @@
 # handle <newhandle, or blank to delete the user>
 # It returns the new setting.
 proc ::tcldrop::users::setuser {handle {type {}} {setting {}} {xtra {}}} {
-       foreach a [binds setuser] {
+       foreach a [binds users setuser] {
                foreach {bindtype flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $type $setting $xtra } 
val]]} {
                        putlog "Error in script: $proc: $val"
@@ -205,7 +205,7 @@
 
 # This is an eggdrop v1.7.0 command:
 proc ::tcldrop::users::setlaston {handle when {where {}}} {
-       foreach a [binds setlaston] {
+       foreach a [binds users setlaston] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $when $where } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -226,7 +226,7 @@
 
 # Gets a users channel INFO line:
 proc ::tcldrop::users::getchaninfo {handle channel} {
-       foreach a [binds getchaninfo] {
+       foreach a [binds users getchaninfo] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $channel } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -247,7 +247,7 @@
 
 # Renames a user account.
 proc ::tcldrop::users::chhandle {oldhandle newhandle} {
-       foreach a [binds chhandle] {
+       foreach a [binds users chhandle] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $oldhandle $newhandle } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -268,7 +268,7 @@
 
 # Adds/removes a users global/channel flags.
 proc ::tcldrop::users::chattr {handle {flags {}} {channel {}}} {
-       foreach a [binds chattr] {
+       foreach a [binds users chattr] {
                foreach {type bindsflags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $flags $channel } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -289,7 +289,7 @@
 
 # Adds/removes a bots global/channel bot-specific flags.
 proc ::tcldrop::users::botattr {bothandle {flags {}} {channel {}}} {
-       foreach a [binds botattr] {
+       foreach a [binds users botattr] {
                foreach {type bindsflags mask count proc} $a {}
                if {[set lev [catch { $proc $bothandle $flags $channel } val]]} 
{
                        putlog "Error in script: $proc: $val"
@@ -311,7 +311,7 @@
 # Adds a user to the user database, with the optional hostmask:
 # Returns 1 for success, 0 for failure.
 proc ::tcldrop::users::adduser {handle {hostmask {}}} {
-       foreach a [binds adduser] {
+       foreach a [binds users adduser] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $hostmask } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -333,7 +333,7 @@
 # Adds a bot to the user database, with the optional address and hostmask:
 # Returns 1 for success, 0 for failure.
 proc ::tcldrop::users::addbot {handle {address {}} {hostmask {}}} {
-       foreach a [binds addbot] {
+       foreach a [binds users addbot] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $address $hostmask } val]]} 
{
                        putlog "Error in script: $proc: $val"
@@ -355,7 +355,7 @@
 # Deletes a user (or bot) from the user database:
 # Returns 1 for success, 0 for failure.
 proc ::tcldrop::users::deluser {handle} {
-       foreach a [binds deluser] {
+       foreach a [binds users deluser] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -378,7 +378,7 @@
 # FixMe: Untested and unmodified.
 # Removes a single hostmask, or all hostmasks if none is specified.
 proc ::tcldrop::users::delhost {handle {hostmask {}}} {
-       foreach a [binds delhost] {
+       foreach a [binds users delhost] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $hostmask } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -399,7 +399,7 @@
 
 # Adds a channel record for a user:
 proc ::tcldrop::users::addchanrec {handle channel} {
-       foreach a [binds addchanrec] {
+       foreach a [binds users addchanrec] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $channel } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -420,7 +420,7 @@
 
 # Removes a channel record for a user:
 proc ::tcldrop::users::delchanrec {handle channel} {
-       foreach a [binds delchanrec] {
+       foreach a [binds users delchanrec] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $channel } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -440,7 +440,7 @@
 }
 
 proc ::tcldrop::users::haschanrec {handle channel} {
-       foreach a [binds haschanrec] {
+       foreach a [binds users haschanrec] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $handle $channel } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -457,7 +457,7 @@
 # If the -flush option is given, then save doesn't return until it's been 
completly written to disk.
 # Note, I don't even know if there's any noticable speed difference by using 
nonblocking..
 proc ::tcldrop::users::save {args} {
-       foreach a [binds save] {
+       foreach a [binds users save] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc $args } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -478,7 +478,7 @@
 
 # Proc by address@hidden (untested/unmodified)
 proc ::tcldrop::users::backup {} {
-       foreach a [binds backup] {
+       foreach a [binds users backup] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -499,7 +499,7 @@
 
 # Reload the userfile from disk:
 proc ::tcldrop::users::reload {} {
-       foreach a [binds reload] {
+       foreach a [binds users reload] {
                foreach {type flags mask count proc} $a {}
                if {[set lev [catch { $proc } val]]} {
                        putlog "Error in script: $proc: $val"
@@ -522,13 +522,13 @@
 # The ban, ignore, exempt, and invite related stuff should be in other modules.
 
 # Load all of the database modules..
-set dbpriority 1
+set dbpriority 0
 foreach n $userdbs {
        loadmodule "users::$n"
        incr dbpriority
        foreach c {adduser countusers validuser finduser matchattr 
matchchanattr userlist passwdok getuser setuser getinfo getchaninfo 
getting-users chhandle chattr botattr adduser addbot deluser delhost addchanrec 
delchanrec encpass save backup reload chpass setlaston} {
                if {[info commands "::tcldrop::users::${n}::$c"] != {}} {
-                       bind $c {+|+} {*} "::tcldrop::users::${n}::$c" 
-priority $dbpriority
+                       bind users {+|+} $c "::tcldrop::users::${n}::$c" 
-priority $dbpriority
                }
        }
 }




reply via email to

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