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: Tue, 25 Nov 2003 16:27:47 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/11/25 16:27:47

Modified files:
        modules/irc    : irc.tcl 

Log message:
        A few tweaks, and added the [callneed] proc which provides the "need" 
bind type.

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

Patches:
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.22 tcldrop/modules/irc/irc.tcl:1.23
--- tcldrop/modules/irc/irc.tcl:1.22    Fri Nov 21 17:28:03 2003
+++ tcldrop/modules/irc/irc.tcl Tue Nov 25 16:27:47 2003
@@ -4,7 +4,7 @@
 #              * All IRC related commands.
 #      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.22 2003/11/21 22:28:03 fireegl Exp $
+# $Id: irc.tcl,v 1.23 2003/11/25 21:27:47 fireegl Exp $
 #
 # Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
@@ -28,19 +28,24 @@
 #
 
 namespace eval ::tcldrop::irc {
-       # Provide the users module:
+       # Provide the irc module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.22 2003/11/21 22:28:03 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.23 2003/11/25 21:27:47 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
+       # Nicks stores the non-channel specific info for each nick:
        variable Nicks
        array set Nicks {}
+       # ChannelNicks stores the channel specific info for each nick:
        variable ChannelNicks
        array set ChannelNicks {}
+       # Channels stores the non-nick specific info for each channel:
        variable Channels
        array set Channels {}
+       # Bans stores the currently active channel bans:
        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 {}
        # Export all the commands that should be available to 3rd-party 
scripters:
@@ -138,6 +143,26 @@
        }
 }
 
+# Note: Eggdrop supports the following need types: op, unban, invite, limit, 
and key.
+proc ::tcldrop::irc::callneed {channel {type {join}}} {
+       foreach b [binds need] {
+               foreach {type flags mask count proc} $b {}
+               if {[string match -nocase $mask "$channel $type"]} {
+                       ::tcldrop::countbind $type $mask $proc
+                       if {[catch { $proc $channel $type } err]} {
+                               putlog "Error in $proc: $err"
+                               puterrlog "$::errorInfo"
+                       }
+               }
+       }
+}
+
+# This gets called once a minute and all it does it try to join the channels 
we're not in.
+bind time - {* * * * *} ::tcldrop::irc::CheckNeeds
+# Note: It's called CheckNeeds, because we assume the irc server will tell us 
why we can't join a channel. And therefore we'll have raw binds in place to 
call the need-binds.
+proc ::tcldrop::irc::CheckNeeds {minute hour day month year} {
+       foreach channel [channels] { if {![botonchan $channel]} { puthelp "JOIN 
$channel" } }
+}
 
 # Proc by address@hidden
 # FixMe: Untested and unmodified.
@@ -818,7 +843,7 @@
 #      any channel if none is specified); 0 otherwise
 proc ::tcldrop::irc::onchan {nick {channel {*}}} {
        variable ChannelNicks
-       if {[array get ChannelNicks [string tolower $channel,$nick]] != {}} {
+       if {[array names ChannelNicks [string tolower $channel,$nick]] != {}} {
                return 1
        } else {
                return 0




reply via email to

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