[cvslog] (2008-07-01 00:20:14 UTC) Module eggdrop1.6: Change committed!

cvslog cvs at tsss.org
Mon Jun 30 18:20:14 CST 2008


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2008-07-01 00:20:14 UTC
Commited by: Tothwolf <tothwolf at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/mod/channels.mod/tclchan.c
     src/mod/irc.mod/chan.c src/mod/irc.mod/irc.c
     src/mod/server.mod/servmsg.c

Log message:

Bot would send 'JOIN #chan ' to the server with trailing whitespace when joining channels that didn't require a key.

Found by: simple - Patch by: Tothwolf

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.659 eggdrop1.6/doc/UPDATES1.6:1.660
--- eggdrop1.6/doc/UPDATES1.6:1.659	Mon Jun 30 14:12:27 2008
+++ eggdrop1.6/doc/UPDATES1.6	Mon Jun 30 19:20:03 2008
@@ -1,4 +1,4 @@
-$Id: UPDATES1.6,v 1.659 2008-06-30 19:12:27 tothwolf Exp $
+$Id: UPDATES1.6,v 1.660 2008-07-01 00:20:03 tothwolf Exp $
 
 Eggdrop Changes (since v1.6.0)
     _____________________________________________________________________
@@ -12,6 +12,10 @@
 
 
   1.6.20:
+    - Bot would send 'JOIN #chan ' to the server with trailing whitespace
+      when joining channels that didn't require a key.
+    * Found by: simple - Patch by: Tothwolf
+
     - Make the JOIN in check_expired_chanstuff() use DP_SERVER instead of
       DP_MODE to prevent the bot from sending multiple JOIN requests.
     * Found by: simple - Patch by: thommey
Index: eggdrop1.6/src/mod/channels.mod/tclchan.c
diff -u eggdrop1.6/src/mod/channels.mod/tclchan.c:1.97 eggdrop1.6/src/mod/channels.mod/tclchan.c:1.98
--- eggdrop1.6/src/mod/channels.mod/tclchan.c:1.97	Sat Feb 16 15:41:07 2008
+++ eggdrop1.6/src/mod/channels.mod/tclchan.c	Mon Jun 30 19:20:03 2008
@@ -1,7 +1,7 @@
 /*
  * tclchan.c -- part of channels.mod
  *
- * $Id: tclchan.c,v 1.97 2008-02-16 21:41:07 guppy Exp $
+ * $Id: tclchan.c,v 1.98 2008-07-01 00:20:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1466,10 +1466,17 @@
       if (channel_inactive(chan) && (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
         dprintf(DP_SERVER, "PART %s\n", chan->name);
       if (!channel_inactive(chan) &&
-          !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
-        dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ?
-                chan->name : chan->dname,
-                chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+          !(chan->status & (CHAN_ACTIVE | CHAN_PEND))) {
+        char *key;
+
+        key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+        if (key[0])
+          dprintf(DP_SERVER, "JOIN %s %s\n",
+                  chan->name[0] ? chan->name : chan->dname, key);
+        else
+          dprintf(DP_SERVER, "JOIN %s\n",
+                  chan->name[0] ? chan->name : chan->dname);
+      }
     }
     if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS | CHAN_OPONJOIN |
                                        CHAN_BITCH | CHAN_AUTOVOICE |
@@ -1924,8 +1931,12 @@
     ret = TCL_ERROR;
   }
   Tcl_Free((char *) item);
-  if (join && !channel_inactive(chan) && module_find("irc", 0, 0))
-    dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
+  if (join && !channel_inactive(chan) && module_find("irc", 0, 0)) {
+    if (chan->key_prot[0])
+      dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
+    else
+      dprintf(DP_SERVER, "JOIN %s\n", chan->dname);
+  }
   return ret;
 }
 
Index: eggdrop1.6/src/mod/irc.mod/chan.c
diff -u eggdrop1.6/src/mod/irc.mod/chan.c:1.126 eggdrop1.6/src/mod/irc.mod/chan.c:1.127
--- eggdrop1.6/src/mod/irc.mod/chan.c:1.126	Mon Apr 28 18:54:23 2008
+++ eggdrop1.6/src/mod/irc.mod/chan.c	Mon Jun 30 19:20:03 2008
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.126 2008-04-28 23:54:23 guppy Exp $
+ * $Id: chan.c,v 1.127 2008-07-01 00:20:03 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1099,7 +1099,7 @@
  */
 static int got315(char *from, char *msg)
 {
-  char *chname;
+  char *chname, *key;
   struct chanset_t *chan;
 
   newsplit(&msg);
@@ -1115,9 +1115,14 @@
            chan->dname);
     clear_channel(chan, 1);
     chan->status &= ~CHAN_ACTIVE;
-    dprintf(DP_SERVER, "JOIN %s %s\n",
-            (chan->name[0]) ? chan->name : chan->dname,
-            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+
+    key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+    if (key[0])
+      dprintf(DP_SERVER, "JOIN %s %s\n",
+              chan->name[0] ? chan->name : chan->dname, key);
+    else
+      dprintf(DP_SERVER, "JOIN %s\n",
+              chan->name[0] ? chan->name : chan->dname);
   } else if (me_op(chan))
     recheck_channel(chan, 1);
   else if (chan->channel.members == 1)
@@ -1446,7 +1451,11 @@
       nfree(chan->channel.key);
       chan->channel.key = (char *) channel_malloc(1);
       chan->channel.key[0] = 0;
-      dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
+
+      if (chan->key_prot[0])
+        dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
+      else
+        dprintf(DP_SERVER, "JOIN %s\n", chan->dname);
     } else {
       check_tcl_need(chan->dname, "key");
 
@@ -1466,7 +1475,7 @@
  */
 static int gotinvite(char *from, char *msg)
 {
-  char *nick;
+  char *nick, *key;
   struct chanset_t *chan;
 
   newsplit(&msg);
@@ -1486,9 +1495,16 @@
 
   if (chan && (channel_pending(chan) || channel_active(chan)))
     dprintf(DP_HELP, "NOTICE %s :I'm already here.\n", nick);
-  else if (chan && !channel_inactive(chan))
-    dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ? chan->name : chan->dname,
-            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+  else if (chan && !channel_inactive(chan)) {
+
+    key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+    if (key[0])
+      dprintf(DP_SERVER, "JOIN %s %s\n",
+              chan->name[0] ? chan->name : chan->dname, key);
+    else
+      dprintf(DP_SERVER, "JOIN %s\n",
+              chan->name[0] ? chan->name : chan->dname);
+  }
   return 0;
 }
 
@@ -1894,7 +1910,7 @@
  */
 static int gotpart(char *from, char *msg)
 {
-  char *nick, *chname;
+  char *nick, *chname, *key;
   struct chanset_t *chan;
   struct userrec *u;
 
@@ -1939,10 +1955,16 @@
     if (match_my_nick(nick)) {
       clear_channel(chan, 1);
       chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-      if (!channel_inactive(chan))
-        dprintf(DP_SERVER, "JOIN %s %s\n",
-                (chan->name[0]) ? chan->name : chan->dname,
-                chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+      if (!channel_inactive(chan)) {
+
+        key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+        if (key[0])
+          dprintf(DP_SERVER, "JOIN %s %s\n",
+                  chan->name[0] ? chan->name : chan->dname, key);
+        else
+          dprintf(DP_SERVER, "JOIN %s\n",
+                  chan->name[0] ? chan->name : chan->dname);
+      }
     } else
       check_lonely_channel(chan);
   }
@@ -1954,7 +1976,7 @@
 static int gotkick(char *from, char *origmsg)
 {
   char *nick, *whodid, *chname, s1[UHOSTLEN], buf[UHOSTLEN], *uhost = buf;
-  char buf2[511], *msg;
+  char buf2[511], *msg, *key;
   memberlist *m;
   struct chanset_t *chan;
   struct userrec *u;
@@ -1971,9 +1993,14 @@
   if (match_my_nick(nick) && channel_pending(chan) &&
       !channel_inactive(chan)) {
     chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-    dprintf(DP_SERVER, "JOIN %s %s\n",
-            (chan->name[0]) ? chan->name : chan->dname,
-            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+
+    key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+    if (key[0])
+      dprintf(DP_SERVER, "JOIN %s %s\n",
+              chan->name[0] ? chan->name : chan->dname, key);
+    else
+      dprintf(DP_SERVER, "JOIN %s\n",
+              chan->name[0] ? chan->name : chan->dname);
     clear_channel(chan, 1);
     return 0;                   /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
   }
@@ -2014,9 +2041,14 @@
     /* Kicked ME?!? the sods! */
     if (match_my_nick(nick) && !channel_inactive(chan)) {
       chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
-      dprintf(DP_SERVER, "JOIN %s %s\n",
-              (chan->name[0]) ? chan->name : chan->dname,
-              chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+
+      key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+      if (key[0])
+        dprintf(DP_SERVER, "JOIN %s %s\n",
+                chan->name[0] ? chan->name : chan->dname, key);
+      else
+        dprintf(DP_SERVER, "JOIN %s\n",
+                chan->name[0] ? chan->name : chan->dname);
       clear_channel(chan, 1);
     } else {
       killmember(chan, nick);
Index: eggdrop1.6/src/mod/irc.mod/irc.c
diff -u eggdrop1.6/src/mod/irc.mod/irc.c:1.110 eggdrop1.6/src/mod/irc.mod/irc.c:1.111
--- eggdrop1.6/src/mod/irc.mod/irc.c:1.110	Mon Jun 30 14:12:27 2008
+++ eggdrop1.6/src/mod/irc.mod/irc.c	Mon Jun 30 19:20:04 2008
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.110 2008-06-30 19:12:27 tothwolf Exp $
+ * $Id: irc.c,v 1.111 2008-07-01 00:20:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -536,9 +536,14 @@
     if (chan->name[0] != '+') { /* Its pointless to cycle + chans for ops */
       putlog(LOG_MISC, "*", "Trying to cycle %s to regain ops.", chan->dname);
       dprintf(DP_MODE, "PART %s\n", chan->name);
+
       /* If it's a !chan, we need to recreate the channel with !!chan <cybah> */
-      dprintf(DP_MODE, "JOIN %s%s %s\n", (chan->dname[0] == '!') ? "!" : "",
-              chan->dname, chan->key_prot);
+      if (chan->key_prot[0])
+        dprintf(DP_MODE, "JOIN %s%s %s\n", (chan->dname[0] == '!') ? "!" : "",
+                chan->dname, chan->key_prot);
+      else
+        dprintf(DP_MODE, "JOIN %s%s\n", (chan->dname[0] == '!') ? "!" : "",
+                chan->dname);
       whined = 0;
     }
   } else if (any_ops(chan)) {
@@ -587,7 +592,7 @@
 {
   masklist *b, *e;
   memberlist *m, *n;
-  char s[UHOSTLEN];
+  char *key, s[UHOSTLEN];
   struct chanset_t *chan;
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
@@ -683,10 +688,16 @@
         m = n;
       }
       check_lonely_channel(chan);
-    } else if (!channel_inactive(chan) && !channel_pending(chan))
-      dprintf(DP_SERVER, "JOIN %s %s\n",
-              (chan->name[0]) ? chan->name : chan->dname,
-              chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+    } else if (!channel_inactive(chan) && !channel_pending(chan)) {
+
+      key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+      if (key[0])
+        dprintf(DP_SERVER, "JOIN %s %s\n",
+                chan->name[0] ? chan->name : chan->dname, key);
+      else
+        dprintf(DP_SERVER, "JOIN %s\n",
+                chan->name[0] ? chan->name : chan->dname);
+    }
   }
 }
 
@@ -1097,7 +1108,9 @@
 {
   struct chanset_t *chan;
 
+  /* Force bot to part all channels */
   dprintf(DP_MODE, "JOIN 0\n");
+
   for (chan = chanset; chan; chan = chan->next)
     clear_channel(chan, 1);
   del_bind_table(H_topc);
@@ -1190,9 +1203,14 @@
     return "This module requires channels module 1.0 or later.";
   }
   for (chan = chanset; chan; chan = chan->next) {
-    if (!channel_inactive(chan))
-      dprintf(DP_SERVER, "JOIN %s %s\n",
-              (chan->name[0]) ? chan->name : chan->dname, chan->key_prot);
+    if (!channel_inactive(chan)) {
+      if (chan->key_prot[0])
+        dprintf(DP_SERVER, "JOIN %s %s\n",
+                chan->name[0] ? chan->name : chan->dname, chan->key_prot);
+      else
+        dprintf(DP_SERVER, "JOIN %s\n",
+                chan->name[0] ? chan->name : chan->dname);
+    }
     chan->status &= ~(CHAN_ACTIVE | CHAN_PEND | CHAN_ASKEDBANS);
     chan->ircnet_status &= ~(CHAN_ASKED_INVITED | CHAN_ASKED_EXEMPTS);
   }
Index: eggdrop1.6/src/mod/server.mod/servmsg.c
diff -u eggdrop1.6/src/mod/server.mod/servmsg.c:1.97 eggdrop1.6/src/mod/server.mod/servmsg.c:1.98
--- eggdrop1.6/src/mod/server.mod/servmsg.c:1.97	Tue Apr 29 20:07:37 2008
+++ eggdrop1.6/src/mod/server.mod/servmsg.c	Mon Jun 30 19:20:04 2008
@@ -1,7 +1,7 @@
 /*
  * servmsg.c -- part of server.mod
  *
- * $Id: servmsg.c,v 1.97 2008-04-30 01:07:37 guppy Exp $
+ * $Id: servmsg.c,v 1.98 2008-07-01 00:20:04 tothwolf Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -255,9 +255,10 @@
 /* 001: welcome to IRC (use it to fix the server name) */
 static int got001(char *from, char *msg)
 {
-  struct server_list *x = serverlist;
   int i;
+  char *key;
   struct chanset_t *chan;
+  struct server_list *x = serverlist;
 
   /* FIXME - x should never be NULL anywhere in this function, but
    * apparently it sometimes is. */
@@ -295,9 +296,14 @@
     for (chan = chanset; chan; chan = chan->next) {
       chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
       if (!channel_inactive(chan)) {
-        dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ? chan->name :
-                chan->dname, chan->channel.key[0] ? chan->channel.key :
-                chan->key_prot);
+
+        key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+        if (key[0])
+          dprintf(DP_SERVER, "JOIN %s %s\n",
+                  chan->name[0] ? chan->name : chan->dname, key);
+        else
+          dprintf(DP_SERVER, "JOIN %s\n",
+                  chan->name[0] ? chan->name : chan->dname);
       }
     }
   }
@@ -309,7 +315,7 @@
  */
 static int got442(char *from, char *msg)
 {
-  char *chname;
+  char *chname, *key;
   struct chanset_t *chan;
 
   if (!realservername || egg_strcasecmp(from, realservername))
@@ -317,18 +323,20 @@
   newsplit(&msg);
   chname = newsplit(&msg);
   chan = findchan(chname);
-  if (chan)
-    if (!channel_inactive(chan)) {
-      module_entry *me = module_find("channels", 0, 0);
-
-      putlog(LOG_MISC, chname, IRC_SERVNOTONCHAN, chname);
-      if (me && me->funcs)
-        (me->funcs[CHANNEL_CLEAR]) (chan, 1);
-      chan->status &= ~CHAN_ACTIVE;
-      dprintf(DP_SERVER, "JOIN %s %s\n", chan->name,
-              chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-    }
+  if (chan && !channel_inactive(chan)) {
+    module_entry *me = module_find("channels", 0, 0);
 
+    putlog(LOG_MISC, chname, IRC_SERVNOTONCHAN, chname);
+    if (me && me->funcs)
+      (me->funcs[CHANNEL_CLEAR]) (chan, 1);
+    chan->status &= ~CHAN_ACTIVE;
+
+    key = chan->channel.key[0] ? chan->channel.key : chan->key_prot;
+    if (key[0])
+      dprintf(DP_SERVER, "JOIN %s %s\n", chan->name, key);
+    else
+      dprintf(DP_SERVER, "JOIN %s\n", chan->name);
+  }
   return 0;
 }
 
----------------------- End of diff -----------------------



More information about the Changes mailing list