Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
902563880c
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  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)