瀏覽代碼

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 年之前
父節點
當前提交
902563880c
共有 1 個文件被更改,包括 5 次插入0 次删除
  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)