Просмотр исходного кода

* Removing an ignore by number now displays which ignore was removed. (#126)

svn: 2386
Bryan Drewery 21 лет назад
Родитель
Сommit
3525a351af
4 измененных файлов с 11 добавлено и 8 удалено
  1. 1 0
      doc/UPDATES
  2. 3 3
      src/cmds.c
  3. 6 4
      src/users.c
  4. 1 1
      src/users.h

+ 1 - 0
doc/UPDATES

@@ -20,6 +20,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed hub forgetting it's uplink.
 * Fixed hubs not correctly installing/checking crontab on startup. (#156)
 * Fixed hub segfaults (on Linux) with bot links. (#155)
+* Removing an ignore by number now displays which ignore was removed. (#126)
 
 1.2.7
 * Forgot 'log_bad = 0;' to fix the '!' showing up for aliases.

+ 3 - 3
src/cmds.c

@@ -3224,12 +3224,12 @@ static void cmd_mns_ignore(int idx, char *par)
     return;
   }
 
-  char buf[UHOSTLEN] = "";
+  char buf[UHOSTLEN] = "", *expanded_buf = NULL;
 
   strlcpy(buf, par, sizeof buf);
-  if (delignore(buf)) {
+  if ((expanded_buf = delignore(buf)) && expanded_buf[0]) {
     putlog(LOG_CMDS, "*", "#%s# -ignore %s", dcc[idx].nick, buf);
-    dprintf(idx, "No longer ignoring: %s\n", buf);
+    dprintf(idx, "No longer ignoring: %s\n", expanded_buf);
     if (conf.bot->hub)
       write_userfile(idx);
   } else

+ 6 - 4
src/users.c

@@ -63,11 +63,11 @@ int equals_ignore(char *uhost)
   return 0;
 }
 
-int delignore(char *ign)
+char *delignore(char *ign)
 {
   int i = 0, j;
   struct igrec **u = NULL, *t = NULL;
-  char temp[256] = "";
+  static char temp[256] = "";
 
   if (!strchr(ign, '!') && (j = atoi(ign))) {
     for (u = &global_ign, j--; *u && j; u = &((*u)->next), j--);
@@ -101,8 +101,10 @@ int delignore(char *ign)
     t = *u;
     *u = (*u)->next;
     free(t);
-  }
-  return i;
+  } else
+    temp[0] = 0;
+
+  return temp;
 }
 
 void addignore(char *ign, char *from, const char *mnote, time_t expire_time)

+ 1 - 1
src/users.h

@@ -162,7 +162,7 @@ void def_display(int idx, struct user_entry *e, struct userrec *u);
 
 void backup_userfile();
 void addignore(char *, char *, const char *, time_t);
-int delignore(char *);
+char *delignore(char *);
 void tell_ignores(int, char *);
 bool match_ignore(char *);
 void check_expired_ignores();