Explorar o código

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 %!s(int64=14) %!d(string=hai) anos
pai
achega
902563880c
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  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)