X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2FNeonServ.mod%2Fcmd_neonserv_unvisited.c;h=5f1572e17ee823fc4075f1ce1f8359d064bf9768;hb=ee39770362f69ced5b52104b622582e882af0b77;hp=455583c26a359d8a22f1d4c21686097597733dcc;hpb=e192ffc0fed753aa5a5c5081674511f90c5a953b;p=NeonServV5.git diff --git a/src/modules/NeonServ.mod/cmd_neonserv_unvisited.c b/src/modules/NeonServ.mod/cmd_neonserv_unvisited.c index 455583c..5f1572e 100644 --- a/src/modules/NeonServ.mod/cmd_neonserv_unvisited.c +++ b/src/modules/NeonServ.mod/cmd_neonserv_unvisited.c @@ -1,4 +1,4 @@ -/* cmd_neonserv_unvisited.c - NeonServ v5.4 +/* cmd_neonserv_unvisited.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -34,11 +34,11 @@ static TIMEQ_CALLBACK(neonserv_check_unvisited_timer); CMD_BIND(neonserv_cmd_unvisited) { int duration = (argc ? strToTime(user, argv[0]) : 60*60*24*7*3); - reply(getTextBot(), user, "NS_SEARCH_HEADER"); + reply(textclient, user, "NS_SEARCH_HEADER"); int unreg = 0; if(argc > 1 && !stricmp(argv[1], "unregister")) unreg = 1; - neonserv_check_unvisited(client, getTextBot(), user, duration, unreg); + neonserv_check_unvisited(client, textclient, user, duration, unreg); } void neonserv_cmd_unvisited_init() { @@ -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; @@ -69,7 +69,7 @@ static void neonserv_check_unvisited(struct ClientSocket *client, struct ClientS struct ChanNode *channel; struct neonserv_cmd_unvisited_cache *cache = malloc(sizeof(*cache)); if (!cache) { - perror("malloc() failed"); + printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return; } cache->client = client; @@ -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(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);