Browse Source

Clear a bot's local list setting if it matches the global (#36)

This is due to the default (global) being added when adding to the list.
So if after removing from the list, it now matches the global, it should
do the inverse, and reset to match the global via being cleared.

This is mainly to aide in groups auto adding 'main' and auto removing
'main'
Bryan Drewery 14 years ago
parent
commit
902563880c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/set.c

+ 5 - 0
src/set.c

@@ -895,6 +895,11 @@ static char *var_rem_list(const char *botnick, variable_t *var, const char *elem
       strlcpy(ret, word, sizeof(ret));
   }
 
+  // If the data now matches the default global, just set to NULL
+  if (botnick && var->gdata && data && !strcmp(var->gdata, data)) {
+    data[0] = 0;
+  }
+
   if (num <= i && ret[0]) {
     var_set(var, botnick, data);
     if (botnick)