[cvslog] (2004-02-04 02:40:52 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Tue Feb 3 20:40:52 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2004-02-04 02:40:52 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/chanprog.c src/match.c src/userrec.c
     src/mod/server.mod/server.c

Log message:

* Fixed _wild_match() to not try to read before the beginning of the mask
* Changed correct_handle() to copy the handle onto itself, in case it's called
  like correct_handle(u->handle)
* Changed rmspace to use memmove instead of strcpy; also made it more
  efficient (only 1 call to strlen)
* queue_server() wasn't adding messages to the queue correctly... doh!

---------------------- diff included ----------------------
Index: eggdrop1.6/src/chanprog.c
diff -u eggdrop1.6/src/chanprog.c:1.47 eggdrop1.6/src/chanprog.c:1.48
--- eggdrop1.6/src/chanprog.c:1.47	Thu Jan  8 23:56:36 2004
+++ eggdrop1.6/src/chanprog.c	Tue Feb  3 20:40:42 2004
@@ -7,7 +7,7 @@
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts
  *
- * $Id: chanprog.c,v 1.47 2004/01/09 05:56:36 wcc Exp $
+ * $Id: chanprog.c,v 1.48 2004/02/04 02:40:42 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -67,17 +67,21 @@
 {
 #define whitespace(c) (((c) == 32) || ((c) == 9) || ((c) == 13) || ((c) == 10))
   char *p;
+  int len;
 
-  if (*s == '\0')
+  if (!*s)
     return;
 
   /* Wipe end of string */
   for (p = s + strlen(s) - 1; ((whitespace(*p)) && (p >= s)); p--);
-  if (p != s + strlen(s) - 1)
-    *(p + 1) = 0;
+  *(p + 1) = 0;
+  len = p+1 - s;
   for (p = s; ((whitespace(*p)) && (*p)); p++);
-  if (p != s)
-    strcpy(s, p);
+  len -= (p - s);
+  if (p != s) {
+    /* +1 to include the null in the copy */
+    memmove(s, p, len+1);
+  }
 }
 
 /* Returns memberfields if the nick is in the member list.
Index: eggdrop1.6/src/match.c
diff -u eggdrop1.6/src/match.c:1.8 eggdrop1.6/src/match.c:1.9
--- eggdrop1.6/src/match.c:1.8	Tue Jan 28 00:37:24 2003
+++ eggdrop1.6/src/match.c	Tue Feb  3 20:40:42 2004
@@ -2,7 +2,7 @@
  * match.c
  *   wildcard matching functions
  *
- * $Id: match.c,v 1.8 2003/01/28 06:37:24 wcc Exp $
+ * $Id: match.c,v 1.9 2004/02/04 02:40:42 stdarg Exp $
  *
  * Once this code was working, I added support for % so that I could
  * use the same code both in Eggdrop and in my IrcII client.
@@ -145,6 +145,18 @@
   n--;
 
   while (n >= na) {
+    /* If the mask runs out of chars before the string, fall back on
+     * a wildcard or fail. */
+    if (m < ma) {
+      if (lsm) {
+        n = --lsn;
+        m = lsm;
+        if (n < na) lsm = 0;
+        sofar = 0;
+      }
+      else return NOMATCH;
+    }
+
     switch (*m) {
     case WILDS:                /* Matches anything */
       do
@@ -154,6 +166,7 @@
       lsn = n;
       match += sofar;
       sofar = 0;                /* Update fallback pos */
+      if (m < ma) return MATCH;
       continue;                 /* Next char, please */
     case WILDQ:
       m--;
Index: eggdrop1.6/src/mod/server.mod/server.c
diff -u eggdrop1.6/src/mod/server.mod/server.c:1.111 eggdrop1.6/src/mod/server.mod/server.c:1.112
--- eggdrop1.6/src/mod/server.mod/server.c:1.111	Sat Jan 10 02:41:38 2004
+++ eggdrop1.6/src/mod/server.mod/server.c	Tue Feb  3 20:40:42 2004
@@ -2,7 +2,7 @@
  * server.c -- part of server.mod
  *   basic irc server support
  *
- * $Id: server.c,v 1.111 2004/01/10 08:41:38 wcc Exp $
+ * $Id: server.c,v 1.112 2004/02/04 02:40:42 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -861,24 +861,24 @@
     }
 
     q = nmalloc(sizeof(struct msgq));
-    if (qnext)
-      q->next = h->head;
-    else
-      q->next = NULL;
-
-    if (h->head) {
-      if (!qnext)
-        h->last->next = q;
-    } else
-      h->head = q;
 
-    if (qnext)
+    /* Insert into queue. */
+    if (qnext) {
+      q->next = h->head;
       h->head = q;
+      if (!h->last) h->last = q;
+    }
+    else {
+      q->next = NULL;
+      if (h->last) h->last->next = q;
+      else h->head = q;
+      h->last = q;
+    }
 
-    h->last = q;
     q->len = len;
     q->msg = nmalloc(len + 1);
-    strncpyz(q->msg, buf, len);
+    memcpy(q->msg, buf, len);
+    q->msg[len] = 0;
     h->tot++;
     h->warned = 0;
     double_warned = 0;
Index: eggdrop1.6/src/userrec.c
diff -u eggdrop1.6/src/userrec.c:1.47 eggdrop1.6/src/userrec.c:1.48
--- eggdrop1.6/src/userrec.c:1.47	Thu Jan  8 23:56:37 2004
+++ eggdrop1.6/src/userrec.c	Tue Feb  3 20:40:42 2004
@@ -4,7 +4,7 @@
  *   a bunch of functions to find and change user records
  *   change and check user (and channel-specific) flags
  *
- * $Id: userrec.c,v 1.47 2004/01/09 05:56:37 wcc Exp $
+ * $Id: userrec.c,v 1.48 2004/02/04 02:40:42 stdarg Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -241,7 +241,7 @@
   struct userrec *u;
 
   u = get_user_by_handle(userlist, handle);
-  if (u == NULL)
+  if (u == NULL || handle == u->handle)
     return;
   strcpy(handle, u->handle);
 }
----------------------- End of diff -----------------------



More information about the Changes mailing list