[cvslog] (2005-07-31 03:49:46 UTC) Module eggdrop1.7: Change committed!

cvslog cvs at tsss.org
Sat Jul 30 21:49:46 CST 2005


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2005-07-31 03:49:46 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     eggdrop.conf doc/TCL-COMMANDS doc/html/mod-server.html
     doc/html/tcl-commands.html doc/settings/mod.server src/main.c
     src/patch.h src/tclegg.h src/tclhash.c
     src/mod/filesys.mod/filesys.c src/mod/irc.mod/chan.c
     src/mod/irc.mod/irc.c src/mod/irc.mod/irc.h
     src/mod/server.mod/server.c src/mod/server.mod/server.h
     src/mod/server.mod/servmsg.c src/mod/server.mod/help/server.help
     src/mod/server.mod/help/set/server.help

Log message:

* Phase 4. Compiles now.
* Fixed a bug in my earlier main.c changes.

I don't like massive changes like this that don't go through the patch 
process. There is alot of room for error here, as careful as I am trying 
to be.

---------------------- diff included ----------------------
Index: eggdrop1.7/doc/TCL-COMMANDS
diff -u eggdrop1.7/doc/TCL-COMMANDS:1.4 eggdrop1.7/doc/TCL-COMMANDS:1.5
--- eggdrop1.7/doc/TCL-COMMANDS:1.4	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/doc/TCL-COMMANDS	Sat Jul 30 22:49:35 2005
@@ -1,4 +1,4 @@
-$Id: TCL-COMMANDS,v 1.4 2005/07/31 02:57:54 wcc Exp $
+$Id: TCL-COMMANDS,v 1.5 2005/07/31 03:49:35 wcc Exp $
 
 Eggdrop Tcl Commands
 Last revised: August 24, 2004
@@ -1679,7 +1679,11 @@
 
          Description: matches the entire line of text from a /msg with the
            mask. This is useful for binding Tcl procs to words or phrases
-           spoken anywhere within a line of text.
+|          spoken anywhere within a line of text. If the proc returns 1,
+|          Eggdrop will not log the message that triggered this bind.
+|          MSGM binds are processed before MSG binds. If the exclusive-binds
+|          setting is enabled, MSG binds will not be trigged by text that
+|          a MSGM bind has already handled.
          Module: server
 
     (6)  PUBM (stackable)
@@ -1689,8 +1693,11 @@
          Description: just like MSGM, except it's triggered by things said
            on a channel instead of things /msg'd to the bot. The mask is
            matched against the channel name followed by the text and can
-           contain wildcards. Also, if a line triggers a PUB bind, it will not
-           trigger a PUBM bind.
+|          contain wildcards. If the proc returns 1, Eggdrop will not log
+|          the message that triggered this bind. PUBM binds are processed
+|          before PUB binds. If the exclusive-binds setting is enabled,
+|          PUB binds will not be trigged by text that a PUBM bind has
+|          already handled.
          Module: irc
 
     (7)  NOTC (stackable)
@@ -1701,8 +1708,9 @@
            obviously) or a channel name. mask is matched against the entire
            notice and can contain wildcards. It is considered a breach of
            protocol to respond to a /notice on IRC, so this is intended for
-           internal use (logging, etc.) only. Note that server notices do not
-           trigger the NOTC bind.
+           internal use (logging, etc.) only. Note that server notices do
+|          not trigger the NOTC bind. If the proc returns 1, Eggdrop will
+|          not log the message that triggered this bind.
 
            New Tcl procs should be declared as
              proc notcproc {nick uhost hand text {dest ""}} {
@@ -2023,7 +2031,8 @@
           of the wallops msg. Note that RFC shows the server name as a source
           of the message, whereas many IRCds send the nick!user at host of the
           actual sender, thus, Eggdrop will not parse it at all, but simply
-          pass it to bind in its original form.
+|         pass it to bind in its original form. If the proc returns 1,
+|         Eggdrop will not log the message that triggered this bind.
         Module: server
 
     (34) BCST (stackable)
@@ -2195,14 +2204,23 @@
 
     (10) CHOF  Return 1 to ask the bot not to process the partyline part event.
 
-    (11) WALL  Return 1 to make Eggdrop log the command as:
-                 !nick! msg
+|   (11) WALL  Return 1 to make Eggdrop not log the message that triggered
+|              this bind.
 
 |   (12) NOTE  Return 1 to make Eggdrop not process the note any further.
 |              This includes stacked note bindings that would be processed
 |              after this one, as well as the built-in eggdrop note handling
 |              routines.
 
+|   (13) MSGM  Return 1 to make Eggdrop not log the message that triggered
+|              this bind.
+
+|   (14) PUBM  Return 1 to make Eggdrop not log the message that triggered
+|              this bind.
+
+|   (15) NOTC  Return 1 to make Eggdrop not log the message that triggered
+|              this bind.
+
 *** CONTROL PROCEDURES ***
 
   Using the 'control' command, you can put a DCC connection (or outgoing
Index: eggdrop1.7/doc/html/mod-server.html
diff -u eggdrop1.7/doc/html/mod-server.html:1.3 eggdrop1.7/doc/html/mod-server.html:1.4
--- eggdrop1.7/doc/html/mod-server.html:1.3	Thu Jan 20 19:43:38 2005
+++ eggdrop1.7/doc/html/mod-server.html	Sat Jul 30 22:49:35 2005
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: mod-server.html,v 1.3 2005/01/21 01:43:38 wcc Exp $ -->
+<!-- $Id: mod-server.html,v 1.4 2005/07/31 03:49:35 wcc Exp $ -->
 
 <html>
   <head>
@@ -282,6 +282,15 @@
           this to 1.</p>
         </dd>
 
+        <dt><strong>set exclusive-binds 0</strong></dt>
+        <dd>
+          <p>This setting configures PUBM and MSGM binds to be exclusive
+          of PUB and MSG binds. This means if a MSGM bind with the mask
+          &quot;*help*&quot; exists and is triggered, any MSG bindings
+          with &quot;help&quot; in their mask will not be triggered.
+          Don't enable this unless you know what you are doing!</p>
+        </dd>
+
         <dt><strong>set double-mode 0</strong></dt>
 
         <dd>
@@ -308,8 +317,8 @@
           <p>This enables Eggdrop&#39;s penalty calculation. Every command
           Eggdrop sends to the IRC server raises it&#39;s penalty points.
           If Eggdrop reaches a server limit, it gets disconnected with
-          "excess flood" message. Eggdrop is able to count internal those
-          penalty points, too and take measures against excess flooding.
+          &quot;excess flood&quot; message. Eggdrop is able to count internal
+          those penalty points, too and take measures against excess flooding.
           Note: it&#39;s highly advised to turn this on!</p>
         </dd>
 
Index: eggdrop1.7/doc/html/tcl-commands.html
diff -u eggdrop1.7/doc/html/tcl-commands.html:1.6 eggdrop1.7/doc/html/tcl-commands.html:1.7
--- eggdrop1.7/doc/html/tcl-commands.html:1.6	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/doc/html/tcl-commands.html	Sat Jul 30 22:49:35 2005
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: tcl-commands.html,v 1.6 2005/07/31 02:57:54 wcc Exp $ -->
+<!-- $Id: tcl-commands.html,v 1.7 2005/07/31 03:49:35 wcc Exp $ -->
 
 <html>
   <head>
@@ -3908,7 +3908,11 @@
               <p><strong>Description:</strong> matches the entire line of
               text from a /msg with the mask. This is useful for binding
               Tcl procs to words or phrases spoken anywhere within a line
-              of text.</p>
+              of text. If the proc returns 1, Eggdrop will not log the
+              message that triggered this bind. MSGM binds are processed
+              before MSG binds. If the exclusive-binds setting is enabled,
+              MSG binds will not be trigged by text that a MSGM bind has
+              already handled.</p>
 
               <p><strong>Module:</strong> server</p>
             </li>
@@ -3925,8 +3929,11 @@
               it&#39;s triggered by things said on a channel instead of
               things /msg&#39;d to the bot. The mask is matched against
               the channel name followed by the text and can contain
-              wildcards. Also, if a line triggers a PUB bind, it will not
-              trigger a PUBM bind.</p>
+              wildcards. If the proc returns 1, Eggdrop will not log
+              the message that triggered this bind. PUBM binds are
+              processed before PUB binds. If the exclusive-binds setting
+              is enabled, PUB binds will not be trigged by text that a
+              PUBM bind has already handled.</p>
 
               <p><strong>Module:</strong> irc</p>
             </li>
@@ -3943,7 +3950,9 @@
               matched against the entire notice and can contain wildcards.
               It is considered a breach of protocol to respond to a /notice
               on IRC, so this is intended for internal use (logging, etc.)
-              only.Note that server notices do not trigger the NOTC bind.</p>
+              only. Note that server notices do not trigger the NOTC bind.
+              If the proc returns 1, Eggdrop will not log the message that
+              triggered this bind.</p>
 
               <p>New Tcl procs should be declared as</p>
 
@@ -4423,8 +4432,13 @@
               proc-name &lt;handle&gt; &lt;msg&gt;</strong></p>
 
               <p><strong>Description:</strong> when the bot receives a
-              wallops, it invokes this binding. flags are ignored; the
-              mask is matched against the text of the wallops msg.</p>
+              wallops, it invokes this binding. flags are ignored; the mask
+              is matched against the text of the wallops msg. Note that RFC
+              shows the server name as a source of the message, whereas many
+              IRCds send the nick!user at host of the actual sender, thus,
+              Eggdrop will not parse it at all, but simply pass it to bind
+              in its original form. If the proc returns 1, Eggdrop will not
+              log the message that triggered this bind.</p>
 
               <p><strong>Module:</strong> server</p>
             </li>
@@ -4851,11 +4865,8 @@
             <li>
               <p><strong>WALL</strong></p>
 
-              <p>Return 1 to make Eggdrop log the command as:</p>
-
-              <blockquote>
-                <p>!nick! msg</p>
-              </blockquote>
+              <p>Return 1 to make Eggdrop not log the message that
+              triggered this bind.</p>
             </li>
 
             <li>
@@ -4866,6 +4877,27 @@
               be processed after this one, as well as the built-in
               eggdrop note handling routines.</p>
             </li>
+
+            <li>
+              <p><strong>MSGM</strong></p>
+
+              <p>Return 1 to make Eggdrop not log the message that
+              triggered this bind.</p>
+            </li>
+
+            <li>
+              <p><strong>PUBM</strong></p>
+
+              <p>Return 1 to make Eggdrop not log the message that
+              triggered this bind.</p>
+            </li>
+
+            <li>
+              <p><strong>NOTC</strong></p>
+
+              <p>Return 1 to make Eggdrop not log the message that
+              triggered this bind.</p>
+            </li>
           </ol>
         </li>
       </ol>
Index: eggdrop1.7/doc/settings/mod.server
diff -u eggdrop1.7/doc/settings/mod.server:1.4 eggdrop1.7/doc/settings/mod.server:1.5
--- eggdrop1.7/doc/settings/mod.server:1.4	Thu Jan 20 19:43:38 2005
+++ eggdrop1.7/doc/settings/mod.server	Sat Jul 30 22:49:35 2005
@@ -1,4 +1,4 @@
-$Id: mod.server,v 1.4 2005/01/21 01:43:38 wcc Exp $
+$Id: mod.server,v 1.5 2005/07/31 03:49:35 wcc Exp $
 
 Server Module
 Last revised: February 12, 2003
@@ -172,6 +172,13 @@
       If you want Eggdrop to trigger binds for ignored users, set this to 1.
 
 
+    set exclusive-binds 0
+      This setting configures PUBM and MSGM binds to be exclusive of PUB
+      and MSG binds. This means if a MSGM bind with the mask "*help*" exists
+      and is triggered, any MSG bindings with "help" in their mask will not
+      be triggered. Don't enable this unless you know what you are doing!
+
+
     set double-mode 0
       Allow identical messages in the mode queue?
 
Index: eggdrop1.7/eggdrop.conf
diff -u eggdrop1.7/eggdrop.conf:1.7 eggdrop1.7/eggdrop.conf:1.8
--- eggdrop1.7/eggdrop.conf:1.7	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/eggdrop.conf	Sat Jul 30 22:49:35 2005
@@ -1,7 +1,7 @@
 #! /path/to/executable/eggdrop
 # ^- This should contain a fully qualified path to your Eggdrop executable.
 #
-# $Id: eggdrop.conf,v 1.7 2005/07/31 02:57:54 wcc Exp $
+# $Id: eggdrop.conf,v 1.8 2005/07/31 03:49:35 wcc Exp $
 #
 # This is a sample Eggdrop configuration file which includes all possible
 # settings that can be used to configure your bot.
@@ -881,6 +881,12 @@
 # If you want Eggdrop to trigger binds for ignored users, set this to 1.
 set trigger-on-ignore 0
 
+# This setting configures PUBM and MSGM binds to be exclusive of PUB and MSG
+# binds. This means if a MSGM bind with the mask "*help*" exists and is
+# triggered, any MSG bindings with "help" in their mask will not be
+# triggered. Don't enable this unless you know what you are doing!
+set exclusive-binds 0
+
 # Allow identical messages in the mode queue?
 set double-mode 1
 
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.19 eggdrop1.7/src/main.c:1.20
--- eggdrop1.7/src/main.c:1.19	Sat Jul 30 21:32:43 2005
+++ eggdrop1.7/src/main.c	Sat Jul 30 22:49:35 2005
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: main.c,v 1.19 2005/07/31 02:32:43 wcc Exp $
+ * $Id: main.c,v 1.20 2005/07/31 03:49:35 wcc Exp $
  */
 
 #include "main.h"
@@ -585,6 +585,7 @@
 int count_channels()
 {
   int i = 0;
+  struct chanset_t *chan;
 
   for (chan = chanset; chan; chan = chan->next) {
     i++;
@@ -595,6 +596,8 @@
 
 void process_args(int argc, char **argv)
 {
+  int i;
+
   if (argc > 1) {
     for (i = 1; i < argc; i++)
       do_arg(argv[i]);
@@ -609,7 +612,6 @@
 #endif
   char buf[520], s[25];
   FILE *f;
-  struct chanset_t *chan;
 #ifndef ENABLE_STRIP
   struct rlimit cdlim;
 #endif
Index: eggdrop1.7/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.7/src/mod/filesys.mod/filesys.c:1.6 eggdrop1.7/src/mod/filesys.mod/filesys.c:1.7
--- eggdrop1.7/src/mod/filesys.mod/filesys.c:1.6	Thu Jan 20 19:43:42 2005
+++ eggdrop1.7/src/mod/filesys.mod/filesys.c	Sat Jul 30 22:49:35 2005
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.6 2005/01/21 01:43:42 wcc Exp $
+ * $Id: filesys.c,v 1.7 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -164,7 +164,7 @@
     dprintf(idx, "What?  You need 'help'\n");
     return 0;
   }
-  if (x == BIND_EXEC_BRK)
+  if (x == BIND_QUIT)
     return 1;
   if (x == BIND_EXEC_LOG)
     putlog(LOG_FILES, "*", "#%s# files: %s %s", dcc[idx].nick, cmd, args);
Index: eggdrop1.7/src/mod/irc.mod/chan.c
diff -u eggdrop1.7/src/mod/irc.mod/chan.c:1.6 eggdrop1.7/src/mod/irc.mod/chan.c:1.7
--- eggdrop1.7/src/mod/irc.mod/chan.c:1.6	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/src/mod/irc.mod/chan.c	Sat Jul 30 22:49:35 2005
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.6 2005/07/31 02:57:54 wcc Exp $
+ * $Id: chan.c,v 1.7 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -2318,6 +2318,8 @@
   }
 
   if (msg[0]) {
+    int result = 0;
+
     /* Check even if we're ignoring the host. (modified by Eule 17.7.99) */
     detect_chan_flood(nick, uhost, from, chan, FLOOD_PRIVMSG, NULL);
 
@@ -2325,23 +2327,22 @@
     if (!chan)
       return 0;
 
-    if (!ignoring || trigger_on_ignore) {
-      if (check_tcl_pub(nick, uhost, chan->dname, msg))
-        return 0;
-      check_tcl_pubm(nick, uhost, chan->dname, msg);
+    update_idle(chan->dname, nick);
 
-      chan = findchan(realto);
-      if (!chan)
-        return 0;
+    if (!ignoring || trigger_on_ignore) {
+      result = check_tcl_pubm(nick, uhost, chan->dname, msg);
 
+      if (!result || !exclusive_binds)
+        if (check_tcl_pub(nick, uhost, chan->dname, msg))
+          return 0;
     }
-    if (!ignoring) {
+
+    if (!ignoring && result != 2) {
       if (to[0] == '@')
         putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", nick, msg);
       else
         putlog(LOG_PUBLIC, chan->dname, "<%s> %s", nick, msg);
     }
-    update_idle(chan->dname, nick);
   }
   return 0;
 }
@@ -2435,6 +2436,7 @@
     }
   }
   if (msg[0]) {
+
     /* Check even if we're ignoring the host. (modified by Eule 17.7.99) */
     detect_chan_flood(nick, uhost, from, chan, FLOOD_NOTICE, NULL);
 
@@ -2442,17 +2444,14 @@
     if (!chan)
       return 0;
 
-    if (!ignoring || trigger_on_ignore) {
-      check_tcl_notc(nick, uhost, u, to, msg);
+    update_idle(chan->dname, nick);
 
-      chan = findchan(realto);
-      if (!chan)
+    if (!ignoring || trigger_on_ignore)
+      if (check_tcl_notc(nick, uhost, u, to, msg) == 2)
         return 0;
-    }
 
     if (!ignoring)
       putlog(LOG_PUBLIC, chan->dname, "-%s:%s- %s", nick, to, msg);
-    update_idle(chan->dname, nick);
   }
   return 0;
 }
Index: eggdrop1.7/src/mod/irc.mod/irc.c
diff -u eggdrop1.7/src/mod/irc.mod/irc.c:1.7 eggdrop1.7/src/mod/irc.mod/irc.c:1.8
--- eggdrop1.7/src/mod/irc.mod/irc.c:1.7	Sat Jul 23 17:14:21 2005
+++ eggdrop1.7/src/mod/irc.mod/irc.c	Sat Jul 30 22:49:35 2005
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.7 2005/07/23 22:14:21 wcc Exp $
+ * $Id: irc.c,v 1.8 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -833,9 +833,10 @@
   return 1;
 }
 
-static void check_tcl_pubm(char *nick, char *from, char *chname, char *msg)
+static int check_tcl_pubm(char *nick, char *from, char *chname, char *msg)
 {
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+  int x;
   char buf[1024], host[161];
   struct userrec *u;
 
@@ -848,8 +849,20 @@
   Tcl_SetVar(interp, "_pubm3", u ? u->handle : "*", 0);
   Tcl_SetVar(interp, "_pubm4", chname, 0);
   Tcl_SetVar(interp, "_pubm5", msg, 0);
-  check_tcl_bind(H_pubm, buf, &fr, " $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5",
-                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  x = check_tcl_bind(H_pubm, buf, &fr, " $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5",
+                     MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE | BIND_STACKRET);
+
+  /*
+   * 0 - no match
+   * 1 - match, log
+   * 2 - match, don't log
+   */
+  if (x == BIND_NOMATCH)
+    return 0;
+  if (x == BIND_EXEC_LOG)
+    return 2;
+
+  return 1;
 }
 
 static void check_tcl_need(char *chname, char *type)
Index: eggdrop1.7/src/mod/irc.mod/irc.h
diff -u eggdrop1.7/src/mod/irc.mod/irc.h:1.4 eggdrop1.7/src/mod/irc.mod/irc.h:1.5
--- eggdrop1.7/src/mod/irc.mod/irc.h:1.4	Thu Jan 20 19:43:42 2005
+++ eggdrop1.7/src/mod/irc.mod/irc.h	Sat Jul 30 22:49:35 2005
@@ -1,7 +1,7 @@
 /*
  * irc.h -- part of irc.mod
  *
- * $Id: irc.h,v 1.4 2005/01/21 01:43:42 wcc Exp $
+ * $Id: irc.h,v 1.5 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -49,7 +49,7 @@
 static void check_tcl_part(char *, char *, struct userrec *, char *, char *);
 static void check_tcl_signtopcnick(char *, char *, struct userrec *u, char *,
                                    char *, p_tcl_bind_list);
-static void check_tcl_pubm(char *, char *, char *, char *);
+static int check_tcl_pubm(char *, char *, char *, char *);
 static int check_tcl_pub(char *, char *, char *, char *);
 static int me_op(struct chanset_t *);
 static int me_halfop(struct chanset_t *);
Index: eggdrop1.7/src/mod/server.mod/help/server.help
diff -u eggdrop1.7/src/mod/server.mod/help/server.help:1.1.1.1 eggdrop1.7/src/mod/server.mod/help/server.help:1.2
--- eggdrop1.7/src/mod/server.mod/help/server.help:1.1.1.1	Tue Aug 24 20:02:13 2004
+++ eggdrop1.7/src/mod/server.mod/help/server.help	Sat Jul 30 22:49:35 2005
@@ -55,7 +55,7 @@
       %bcheck-mode-r    ctcp-mode           use-penalties%b
       %bdouble-server   double-mode         double-help%b
       %buse-fastdeq     nick-len            optimize-kicks%b
-      %bstack-limit%b
+      %bstack-limit     exclusive-binds%b
    (Use %b'.help set <variable>'%b for more info)
 %{help=all}%{+o|o}
 ###  %bserver module%b commands
Index: eggdrop1.7/src/mod/server.mod/help/set/server.help
diff -u eggdrop1.7/src/mod/server.mod/help/set/server.help:1.2 eggdrop1.7/src/mod/server.mod/help/set/server.help:1.3
--- eggdrop1.7/src/mod/server.mod/help/set/server.help:1.2	Fri Aug 27 22:24:46 2004
+++ eggdrop1.7/src/mod/server.mod/help/set/server.help	Sat Jul 30 22:49:35 2005
@@ -91,6 +91,12 @@
 ###  %bset trigger-on-ignore%b 0/1
    Enabling this will cause ignored users to trigger bindings anyway,
    normally and ignored user is just that, someone who is ignored.
+%{help=set exclusive-binds}%{+n}
+###  %bset exclusive-binds%b 0/1
+  This setting configures PUBM and MSGM binds to be exclusive of PUB
+  and MSG binds. This means if a MSGM bind with the mask "*help*" exists
+  and is triggered, any MSG bindings with "help" in their mask will not
+  be triggered. Don't enable this unless you know what you are doing!
 %{help=set answer-ctcp}%{+n}
 ###  %bset answer-ctcp%b 0/1
    This sets the maximum number of stacked CTCP's to answer from any
Index: eggdrop1.7/src/mod/server.mod/server.c
diff -u eggdrop1.7/src/mod/server.mod/server.c:1.6 eggdrop1.7/src/mod/server.mod/server.c:1.7
--- eggdrop1.7/src/mod/server.mod/server.c:1.6	Thu Jan 20 19:43:42 2005
+++ eggdrop1.7/src/mod/server.mod/server.c	Sat Jul 30 22:49:35 2005
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.6 2005/01/21 01:43:42 wcc Exp $
+ * $Id: server.c,v 1.7 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -72,6 +72,8 @@
 static int default_port;        /* default IRC port */
 static char oldnick[NICKLEN];   /* previous nickname *before* rehash */
 static int trigger_on_ignore;   /* trigger bindings if user is ignored ? */
+static int exclusive_binds;     /* configures PUBM and MSGM binds to be
+                                 * exclusive of PUB and MSG binds. */
 static int answer_ctcp;         /* answer how many stacked ctcp's ? */
 static int lowercase_ctcp;      /* answer lowercase CTCP's (non-standard) */
 static int check_mode_r;        /* check for IRCnet +r modes */
@@ -1362,6 +1364,7 @@
   {"optimize-kicks",    &optimize_kicks,            0},
   {"isjuped",           &nick_juped,                0},
   {"stack-limit",       &stack_limit,               0},
+  {"exclusive-binds",   &exclusive_binds,           0},
   {NULL,                NULL,                       0}
 };
 
@@ -1825,8 +1828,9 @@
   (Function) ctcp_reply,
   (Function) get_altbotnick,      /* char *                              */
   (Function) & nick_len,          /* int                                 */
-  /* 36 */
-  (Function) check_tcl_notc
+  /* 36 - 37 */
+  (Function) check_tcl_notc,
+  (Function) & exclusive_binds  /* int                                  */
 };
 
 char *server_start(Function *global_funcs)
@@ -1868,6 +1872,7 @@
   default_port = 6667;
   oldnick[0] = 0;
   trigger_on_ignore = 0;
+  exclusive_binds = 0;
   answer_ctcp = 1;
   lowercase_ctcp = 0;
   check_mode_r = 0;
Index: eggdrop1.7/src/mod/server.mod/server.h
diff -u eggdrop1.7/src/mod/server.mod/server.h:1.3 eggdrop1.7/src/mod/server.mod/server.h:1.4
--- eggdrop1.7/src/mod/server.mod/server.h:1.3	Thu Jan 20 19:43:42 2005
+++ eggdrop1.7/src/mod/server.mod/server.h	Sat Jul 30 22:49:35 2005
@@ -1,7 +1,7 @@
 /*
  * server.h -- part of server.mod
  *
- * $Id: server.h,v 1.3 2005/01/21 01:43:42 wcc Exp $
+ * $Id: server.h,v 1.4 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -70,8 +70,9 @@
 #define ctcp_reply ((char *)(server_funcs[33]))
 #define get_altbotnick ((char *(*)(void))(server_funcs[34]))
 #define nick_len (*(int *)(server_funcs[35]))
-/* 36 */
+/* 36 - 37 */
 #define check_tcl_notc ((int (*)(char *,char *,struct userrec *,char *,char *))server_funcs[36])
+#define exclusive_binds (*(int *)(server_funcs[37]))
 
 #else /* MAKING_SERVER */
 
Index: eggdrop1.7/src/mod/server.mod/servmsg.c
diff -u eggdrop1.7/src/mod/server.mod/servmsg.c:1.3 eggdrop1.7/src/mod/server.mod/servmsg.c:1.4
--- eggdrop1.7/src/mod/server.mod/servmsg.c:1.3	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/src/mod/server.mod/servmsg.c	Sat Jul 30 22:49:35 2005
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.3 2005/07/31 02:57:54 wcc Exp $
+ * $Id: servmsg.c,v 1.4 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -112,25 +112,11 @@
   return ((x == BIND_MATCHED) || (x == BIND_EXECUTED) || (x == BIND_EXEC_LOG));
 }
 
-static void check_tcl_notc(char *nick, char *uhost, struct userrec *u,
-                           char *dest, char *arg)
-{
-  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
-
-  get_user_flagrec(u, &fr, NULL);
-  Tcl_SetVar(interp, "_notc1", nick, 0);
-  Tcl_SetVar(interp, "_notc2", uhost, 0);
-  Tcl_SetVar(interp, "_notc3", u ? u->handle : "*", 0);
-  Tcl_SetVar(interp, "_notc4", arg, 0);
-  Tcl_SetVar(interp, "_notc5", dest, 0);
-  check_tcl_bind(H_notc, arg, &fr, " $_notc1 $_notc2 $_notc3 $_notc4 $_notc5",
-                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
-}
-
-static void check_tcl_msgm(char *cmd, char *nick, char *uhost,
+static int check_tcl_msgm(char *cmd, char *nick, char *uhost,
                            struct userrec *u, char *arg)
 {
   struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
+  int x;
   char args[1024];
 
   if (arg[0])
@@ -142,12 +128,50 @@
   Tcl_SetVar(interp, "_msgm2", uhost, 0);
   Tcl_SetVar(interp, "_msgm3", u ? u->handle : "*", 0);
   Tcl_SetVar(interp, "_msgm4", args, 0);
-  check_tcl_bind(H_msgm, args, &fr, " $_msgm1 $_msgm2 $_msgm3 $_msgm4",
-                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  x = check_tcl_bind(H_msgm, args, &fr, " $_msgm1 $_msgm2 $_msgm3 $_msgm4",
+                     MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE | BIND_STACKRET);
+
+  /*
+   * 0 - no match
+   * 1 - match, log
+   * 2 - match, don't log
+   */
+  if (x == BIND_NOMATCH)
+    return 0;
+  if (x == BIND_EXEC_LOG)
+    return 2;
+
+  return 1;
+}
+
+static int check_tcl_notc(char *nick, char *uhost, struct userrec *u,
+                           char *dest, char *arg)
+{
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
+  int x;
+
+  get_user_flagrec(u, &fr, NULL);
+  Tcl_SetVar(interp, "_notc1", nick, 0);
+  Tcl_SetVar(interp, "_notc2", uhost, 0);
+  Tcl_SetVar(interp, "_notc3", u ? u->handle : "*", 0);
+  Tcl_SetVar(interp, "_notc4", arg, 0);
+  Tcl_SetVar(interp, "_notc5", dest, 0);
+  x = check_tcl_bind(H_notc, arg, &fr, " $_notc1 $_notc2 $_notc3 $_notc4 $_notc5",
+                     MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE | BIND_STACKRET);
+
+  /*
+   * 0 - no match
+   * 1 - match, log
+   * 2 - match, don't log
+   */
+  if (x == BIND_NOMATCH)
+    return 0;
+  if (x == BIND_EXEC_LOG)
+    return 2;
+
+  return 1;
 }
 
-/* Return 1 if processed.
- */
 static int check_tcl_raw(char *from, char *code, char *msg)
 {
   int x;
@@ -157,6 +181,8 @@
   Tcl_SetVar(interp, "_raw3", msg, 0);
   x = check_tcl_bind(H_raw, code, 0, " $_raw1 $_raw2 $_raw3",
                      MATCH_EXACT | BIND_STACKABLE | BIND_WANTRET);
+
+  /* Return 1 if processed */
   return (x == BIND_EXEC_LOG);
 }
 
@@ -188,12 +214,19 @@
   Tcl_SetVar(interp, "_wall1", from, 0);
   Tcl_SetVar(interp, "_wall2", msg, 0);
   x = check_tcl_bind(H_wall, msg, 0, " $_wall1 $_wall2",
-                     MATCH_MASK | BIND_STACKABLE);
-  if (x == BIND_EXEC_LOG) {
-    putlog(LOG_WALL, "*", "!%s! %s", from, msg);
-    return 1;
-  } else
+                     MATCH_MASK | BIND_STACKABLE | BIND_STACKRET);
+
+  /*
+   * 0 - no match
+   * 1 - match, log
+   * 2 - match, don't log
+   */
+  if (x == BIND_NOMATCH)
     return 0;
+  if (x == BIND_EXEC_LOG)
+    return 2;
+
+  return 1;
 }
 
 static int check_tcl_flud(char *nick, char *uhost, struct userrec *u,
@@ -414,8 +447,8 @@
  */
 static int gotmsg(char *from, char *msg)
 {
-  char *to, buf[UHOSTLEN], *nick, ctcpbuf[512], *uhost = buf, *ctcp;
-  char *p, *p1, *code;
+  char *to, buf[UHOSTLEN], *nick, ctcpbuf[512], *uhost = buf, *ctcp,
+       *p, *p1, *code;
   struct userrec *u;
   int ctcp_count = 0;
   int ignoring;
@@ -464,9 +497,10 @@
         ctcp_count++;
         if (ctcp[0] != ' ') {
           code = newsplit(&ctcp);
+
+          /* CTCP from oper, don't interpret */
           if ((to[0] == '$') || strchr(to, '.')) {
             if (!ignoring)
-              /* Don't interpret */
               putlog(LOG_PUBLIC, to, "CTCP %s: %s from %s (%s) to %s",
                      code, ctcp, nick, uhost, to);
           } else {
@@ -521,28 +555,33 @@
     }
   }
   if (msg[0]) {
+    int result = 0;
+
+    /* Msg from oper, don't interpret */
     if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
-      /* Msg from oper */
       if (!ignoring) {
         detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
-        /* Do not interpret as command */
         putlog(LOG_MSGS | LOG_SERV, "*", "[%s!%s to %s] %s",
                nick, uhost, to, msg);
       }
-    } else {
-      char *code;
-      struct userrec *u;
+      return 0;
+    }
 
-      detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
-      u = get_user_by_host(from);
-      code = newsplit(&msg);
-      rmspace(msg);
-      if (!ignoring || trigger_on_ignore)
-        check_tcl_msgm(code, nick, uhost, u, msg);
-      if (!ignoring)
-        if (!check_tcl_msg(code, nick, uhost, u, msg))
-          putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
+    detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
+    u = get_user_by_host(from);
+    code = newsplit(&msg);
+    rmspace(msg);
+
+    if (!ignoring || trigger_on_ignore) {
+      result = check_tcl_msgm(code, nick, uhost, u, msg);
+
+      if (!result || !exclusive_binds)
+        if (check_tcl_msg(code, nick, uhost, u, msg))
+          return 0;
     }
+
+    if (!ignoring && result != 2)
+      putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
   }
   return 0;
 }
@@ -587,6 +626,7 @@
       if (ctcp[0] != ' ') {
         char *code = newsplit(&ctcp);
 
+        /* CTCP reply from oper, don't interpret */
         if ((to[0] == '$') || strchr(to, '.')) {
           if (!ignoring)
             putlog(LOG_PUBLIC, "*",
@@ -607,25 +647,36 @@
     }
   }
   if (msg[0]) {
-    if (((to[0] == '$') || strchr(to, '.')) && !ignoring) {
-      detect_flood(nick, uhost, from, FLOOD_NOTICE);
-      putlog(LOG_MSGS | LOG_SERV, "*", "-%s (%s) to %s- %s",
-             nick, uhost, to, msg);
-    } else {
-      /* Server notice? */
-      if ((nick[0] == 0) || (uhost[0] == 0)) {
-        /* Hidden `250' connection count message from server */
-        if (strncmp(msg, "Highest connection count:", 25))
-          putlog(LOG_SERV, "*", "-NOTICE- %s", msg);
-      } else {
+
+    /* Notice from oper, don't interpret */
+    if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
+      if (!ignoring) {
         detect_flood(nick, uhost, from, FLOOD_NOTICE);
-        u = get_user_by_host(from);
-        if (!ignoring || trigger_on_ignore)
-          check_tcl_notc(nick, uhost, u, botname, msg);
-        if (!ignoring)
-          putlog(LOG_MSGS, "*", "-%s (%s)- %s", nick, uhost, msg);
+        putlog(LOG_MSGS | LOG_SERV, "*", "-%s (%s) to %s- %s",
+               nick, uhost, to, msg);
       }
+      return 0;
     }
+    
+    /* Server notice? */
+    if ((nick[0] == 0) || (uhost[0] == 0)) {
+
+      /* Hidden `250' connection count message from server */
+      if (strncmp(msg, "Highest connection count:", 25))
+        putlog(LOG_SERV, "*", "-NOTICE- %s", msg);
+
+      return 0;
+    }
+
+    detect_flood(nick, uhost, from, FLOOD_NOTICE);
+    u = get_user_by_host(from);
+
+    if (!ignoring || trigger_on_ignore)
+      if (check_tcl_notc(nick, uhost, u, botname, msg) == 2)
+        return 0;
+
+    if (!ignoring)
+      putlog(LOG_MSGS, "*", "-%s (%s)- %s", nick, uhost, msg);
   }
   return 0;
 }
@@ -663,15 +714,10 @@
 static int gotwall(char *from, char *msg)
 {
   char *nick;
-  int r;
 
   fixcolon(msg);
-  r = check_tcl_wall(from, msg);
 
-  if (r == 0) {
-    /* Following is not needed at all, but we'll keep it for compatibility sake,
-     * so not to confuse possible scripts that are parsing log files.
-     */
+  if (check_tcl_wall(from, msg) != 2) {
     if (strchr(from, '!')) {
       nick = splitnick(&from);
       putlog(LOG_WALL, "*", "!%s(%s)! %s", nick, from, msg);
Index: eggdrop1.7/src/patch.h
diff -u eggdrop1.7/src/patch.h:1.34 eggdrop1.7/src/patch.h:1.35
--- eggdrop1.7/src/patch.h:1.34	Sat Jul 30 22:04:54 2005
+++ eggdrop1.7/src/patch.h	Sat Jul 30 22:49:35 2005
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.34 2005/07/31 03:04:54 wcc Exp $
+ * $Id: patch.h,v 1.35 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1122779168");            /* current unixtime */
+patch("1122781920");            /* current unixtime */
 /*
  *
  *
  */
-patch("sync3");
+patch("sync4");
 /*
  *
  *
Index: eggdrop1.7/src/tclegg.h
diff -u eggdrop1.7/src/tclegg.h:1.4 eggdrop1.7/src/tclegg.h:1.5
--- eggdrop1.7/src/tclegg.h:1.4	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/src/tclegg.h	Sat Jul 30 22:49:35 2005
@@ -2,7 +2,7 @@
  * tclegg.h
  *   stuff used by tcl.c and tclhash.c
  *
- * $Id: tclegg.h,v 1.4 2005/07/31 02:57:54 wcc Exp $
+ * $Id: tclegg.h,v 1.5 2005/07/31 03:49:35 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -32,26 +32,62 @@
 #  include "proto.h" /* This file needs this */
 #endif
 
-/* Match types for check_tcl_bind: */
+
+/*
+ * Match types for check_tcl_bind
+ */
 #define MATCH_PARTIAL       0
 #define MATCH_EXACT         1
 #define MATCH_MASK          2
 #define MATCH_CASE          3
 
-/* Bitwise 'or' these: */
-#define BIND_USE_ATTR       0x04 /* Check flags. */
-#define BIND_STACKABLE      0x08 /* Stackable. */
-#define BIND_HAS_BUILTINS   0x10 /* ??? Used for dcc, fil, msg, pub. */
-#define BIND_WANTRET        0x20 /* Return tcl proc result. */
-#define BIND_ALTER_ARGS     0x40 /* Use return value from tcl proc as args for command. */
+/*
+ * Bitwise 'or' these:
+ */
+
+/* Check flags; make sure the user has the flags required */
+#define BIND_USE_ATTR       0x04
+
+/* Bind is stackable; more than one bind can have the same name */
+#define BIND_STACKABLE      0x08
+
+/* Additional flag checking; check for +d, +k, etc.
+ * Currently used for dcc, fil, msg, and pub bind types.
+ * Note that this just causes the flag checking to use flagrec_ok()
+ * instead of flagrec_eq().
+ */
+/* FIXME: Should this really be used for the dcc and fil types since
+ *        they are only available to the partyline/filesys (+p/+x)?
+ *        Eggdrop's revenge code does not add default flags when
+ *        adding a user record for +d or +k flags. */
+/* FIXME: This type actually seems to be obsolete. This was originally
+ *        used to check built-in types in Eggdrop version 1.0. */
+#define BIND_HAS_BUILTINS   0x10
+
+/* Want return; we want to know if the proc returns 1
+ * Side effect: immediate return; don't do any further
+ * processing of stacked binds
+ */
+#define BIND_WANTRET        0x20
 
-/* Return values: */
+/* Alternate args; replace args with the return result from the Tcl proc. */
+#define BIND_ALTER_ARGS     0x40
+
+/* Stacked return; we want to know if any proc returns 1,
+ * and also want to process all stacked binds
+ */
+#define BIND_STACKRET       0x80
+
+
+/*
+ * Return values
+ */
 #define BIND_NOMATCH    0
 #define BIND_AMBIGUOUS  1
 #define BIND_MATCHED    2       /* But the proc couldn't be found */
 #define BIND_EXECUTED   3
 #define BIND_EXEC_LOG   4       /* Proc returned 1 -> wants to be logged */
-#define BIND_EXEC_BRK   5       /* Proc returned BREAK (quit) */
+#define BIND_QUIT       5       /* CMD_LEAVE 'quit' from partyline or filesys */
 
 /* Extra commands are stored in Tcl hash tables (one hash table for each type
  * of command: msg, dcc, etc)
@@ -64,14 +100,13 @@
 } tcl_timer_t;
 
 
-/* Used for stub functions:
- */
-
+/* Used for Tcl stub functions */
 #define STDVAR (cd, irp, argc, argv)                                    \
         ClientData cd;                                                  \
         Tcl_Interp *irp;                                                \
         int argc;                                                       \
         char *argv[];
+
 #define BADARGS(nl, nh, example) do {                                   \
         if ((argc < (nl)) || (argc > (nh))) {                           \
                 Tcl_AppendResult(irp, "wrong # args: should be \"",     \
Index: eggdrop1.7/src/tclhash.c
diff -u eggdrop1.7/src/tclhash.c:1.15 eggdrop1.7/src/tclhash.c:1.16
--- eggdrop1.7/src/tclhash.c:1.15	Sat Jul 30 21:57:54 2005
+++ eggdrop1.7/src/tclhash.c	Sat Jul 30 22:49:35 2005
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: tclhash.c,v 1.15 2005/07/31 02:57:54 wcc Exp $
+ * $Id: tclhash.c,v 1.16 2005/07/31 03:49:35 wcc Exp $
  */
 
 #include "main.h"
@@ -692,26 +692,28 @@
     return BIND_EXECUTED;
   } else {
     if (!strcmp(interp->result, "break"))
-      return BIND_EXEC_BRK;
+      return BIND_QUIT;
     return (atoi(interp->result) > 0) ? BIND_EXEC_LOG : BIND_EXECUTED;
   }
 }
 
+/* FIXME: this function is very ugly and really should be redesigned */
 int check_tcl_bind(tcl_bind_list_t *tl, const char *match,
                    struct flag_record *atr, const char *param, int match_type)
 {
   tcl_bind_mask_t *tm, *tm_last = NULL, *tm_p = NULL;
-  int cnt = 0;
+  int cnt = 0, result = 0, finish = 0, atrok, x, ok;
   char *proc = NULL, *fullmatch = NULL;
   tcl_cmd_t *tc, *htc = NULL;
-  int finish = 0, atrok, x, ok;
 
   for (tm = tl->first; tm && !finish; tm_last = tm, tm = tm->next) {
     if (tm->flags & TBM_DELETED)
       continue;
+
     /* Find out whether this bind matches the mask or provides
      * the the requested atcributes, depending on the specified
-     * requirements. */
+     * requirements.
+     */
     switch (match_type & 0x03) {
     case MATCH_PARTIAL:
       ok = !egg_strncasecmp(match, tm->mask, strlen(match));
@@ -732,11 +734,14 @@
       continue;                 /* This bind does not match. */
 
     if (match_type & BIND_STACKABLE) {
+
       /* Could be multiple commands/triggers. */
       for (tc = tm->first; tc; tc = tc->next) {
         if (match_type & BIND_USE_ATTR) {
+
           /* Check whether the provided flags suffice for
-           * this command/trigger. */
+           * this command/trigger.
+           */
           if (match_type & BIND_HAS_BUILTINS)
             atrok = flagrec_ok(&tc->flags, atr);
           else
@@ -753,20 +758,26 @@
           if (match_type & BIND_ALTER_ARGS) {
             if (interp->result == NULL || !interp->result[0])
               return x;
+          } else if ((match_type & BIND_STACKRET) && x == BIND_EXEC_LOG) {
+
+            /* If we have multiple commands/triggers,
+             * and if any of the commands return 1, we accept it.
+             */
+            if (!result)
+              result = x;
+            continue;
           } else if ((match_type & BIND_WANTRET) && x == BIND_EXEC_LOG)
             return x;
         }
       }
-
-      /* If it's stackable search for more binds. */
-      if (!(match_type & BIND_STACKABLE))
-        finish = 1;
     } else {
+
       /* Search for valid entry. */
       for (tc = tm->first; tc; tc = tc->next)
         if (!(tc->attributes & TC_DELETED))
           break;
       if (tc) {
+
         /* Check if the provided flags suffice for this command/trigger. */
         if (match_type & BIND_USE_ATTR) {
           if (match_type & BIND_HAS_BUILTINS)
@@ -778,15 +789,18 @@
 
         if (atrok) {
           cnt++;
+
           /* Remember information about this bind and its only
-           * command/trigger. */
+           * command/trigger.
+           */
           proc = tc->func_name;
           fullmatch = tm->mask;
           htc = tc;
           tm_p = tm_last;
 
           /* Either this is a non-partial match, which means we
-           * only want to execute _one_ bind ... */
+           * only want to execute _one_ bind ...
+           */
           if ((match_type & 3) != MATCH_PARTIAL ||
               /* ... or this is happens to be an exact match. */
               !egg_strcasecmp(match, tm->mask))
@@ -798,23 +812,33 @@
 
   if (!cnt)
     return BIND_NOMATCH;
+
+  /* Do this before updating the preferred entries information,
+   * since we don't want to change the order of stacked binds
+   */
+  if (result)           /* BIND_STACKRET */
+    return result;
+
   if ((match_type & 0x03) == MATCH_MASK || (match_type & 0x03) == MATCH_CASE)
     return BIND_EXECUTED;
 
-  /* Now that we have found at least one bind, we can update the
-   * preferred entries information. */
+  /* Hit counter */
   if (htc)
     htc->hits++;
+
+  /* Now that we have found at least one bind, we can update the
+   * preferred entries information.
+   */
   if (tm_p) {
-    /* Move mask to front of bind's mask list. */
-    tm = tm_p->next;
-    tm_p->next = tm->next;      /* Unlink mask from list.       */
+    tm = tm_p->next;            /* Move mask to front of bind's mask list. */
+    tm_p->next = tm->next;      /* Unlink mask from list. */
     tm->next = tl->first;       /* Readd mask to front of list. */
     tl->first = tm;
   }
 
   if (cnt > 1)
     return BIND_AMBIGUOUS;
+
   Tcl_SetVar(interp, "lastbind", (char *) fullmatch, TCL_GLOBAL_ONLY);
   return trigger_bind(proc, param);
 }
@@ -843,7 +867,7 @@
     dprintf(idx, MISC_NOSUCHCMD);
     return 0;
   }
-  if (x == BIND_EXEC_BRK)
+  if (x == BIND_QUIT)
     return 1;                   /* quit */
   if (x == BIND_EXEC_LOG)
     putlog(LOG_CMDS, "*", "#%s# %s %s", dcc[idx].nick, cmd, args);
----------------------- End of diff -----------------------



More information about the Changes mailing list