Преглед изворни кода

* Fix cmd_mns_[ban|exempt|invite] 0 removing first ban, instead of failing. (#55)

svn: 2082
Bryan Drewery пре 21 година
родитељ
комит
d69598cad3
2 измењених фајлова са 12 додато и 8 уклоњено
  1. 1 0
      doc/UPDATES
  2. 11 8
      src/mod/channels.mod/userchan.c

+ 1 - 0
doc/UPDATES

@@ -129,6 +129,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed, or
 * The mode queue being flushed could cause excess flood, reverted back to eggdrop code for flushing the mode queue.
 * Added errno output to "Can't create new socket" error.
 * Display channel name from console if one is not used with cmd_chanset
+* Fix cmd_mns_[ban|exempt|invite] 0 removing first ban, instead of failing. (#55)
 
 1.2.1
 

+ 11 - 8
src/mod/channels.mod/userchan.c

@@ -235,15 +235,18 @@ int u_delmask(char type, struct chanset_t *c, char *who, int doit)
 
   if (!strchr(who, '!') && str_isdigit(who)) {
     j = atoi(who);
-    j--;		/* our list starts at 0 */
-    if (c)
-      j -= n_mask;	/* subtract out the globals as the number given is globals+j */
-    for (; (*u) && j; u = &((*u)->next), j--);
-    if (*u) {
-      strlcpy(temp, (*u)->mask, sizeof temp);
-      i = 1;
+    if (j) {
+      j--;		/* our list starts at 0 */
+      if (c)
+        j -= n_mask;	/* subtract out the globals as the number given is globals+j */
+      for (; (*u) && j; u = &((*u)->next), j--);
+      if (*u) {
+        strlcpy(temp, (*u)->mask, sizeof temp);
+        i = 1;
+      } else
+        return -j - 1;
     } else
-      return -j - 1;
+      return 0;
   } else {
     /* Find matching host, if there is one */
     for (; *u && !i; u = &((*u)->next))