added NeonBackup bot
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_unvisited.c
index 455583c26a359d8a22f1d4c21686097597733dcc..62f86c0bd2cfaaf4e93f8671865658240f715db4 100644 (file)
@@ -49,14 +49,14 @@ void neonserv_cmd_unvisited_init() {
 static TIMEQ_CALLBACK(neonserv_check_unvisited_timer) {
     char tmp[200];
     char *modname = get_module_name(module_id);
-    sprintf(tmp, "modules/%s/chan_expire_freq", modname);
+    sprintf(tmp, "modules.%s.chan_expire_freq", modname);
     char *check_freq_str = get_string_field(tmp);
     int check_freq;
     if(!check_freq_str || (check_freq = strToTime(NULL, check_freq_str)) < (60*60)) {
         timeq_add_name("neonserv_unvisited", 1800, module_id, neonserv_check_unvisited_timer, NULL);
         return;
     }
-    sprintf(tmp, "modules/%s/chan_expire_delay", modname);
+    sprintf(tmp, "modules.%s.chan_expire_delay", modname);
     char *check_expire_str = get_string_field(tmp);
     int duration;
     if(!check_expire_str || (duration = strToTime(NULL, check_expire_str)) < 60*60*24*7) return;
@@ -156,7 +156,7 @@ static void neonserv_cmd_unvisited_async2(struct neonserv_cmd_unvisited_cache *c
 static void neonserv_cmd_unvisited_unreg(struct ClientSocket *client, char *channel) {
     MYSQL_RES *res;
     MYSQL_ROW row;
-    int sync_neonspam_unreg = get_int_field("General/sync_neonspam_unreg");
+    int sync_neonspam_unreg = get_int_field("General.sync_neonspam_unreg");
     int botid;
     if(client)
         botid = client->botid;
@@ -195,6 +195,12 @@ static void neonserv_cmd_unvisited_unreg(struct ClientSocket *client, char *chan
             putsock(bot, "PART %s :Channel unregistered.", channel);
         }
     }
+    if(client->botid == NEONSERV_BOTID) {
+        char setting[128];
+        sprintf(setting, "modules.%s.auto_backup_unregister", get_module_name(module_id));
+        if(get_int_field(setting))
+            module_global_cmd_unregister_neonbackup(channel);
+    }
     char *alertchan = get_string_field("General.alertchan");
     if(alertchan) {
         struct ChanNode *alertchan_chan = getChanByName(alertchan);