X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2Fglobal.mod%2Fcmd_global_unregister.c;h=843caf0451707cdc11a7d4e0c88b37a772506be2;hb=78e040af3fcc36ab684611c0f98b4381ff420878;hp=daa173715825188f974c3265ed78d1753af111ed;hpb=ee3a72eb4a412a0a504d070db1b41c6907f7604d;p=NeonServV5.git diff --git a/src/modules/global.mod/cmd_global_unregister.c b/src/modules/global.mod/cmd_global_unregister.c index daa1737..843caf0 100644 --- a/src/modules/global.mod/cmd_global_unregister.c +++ b/src/modules/global.mod/cmd_global_unregister.c @@ -1,4 +1,4 @@ -/* cmd_global_unregister.c - NeonServ v5.4 +/* cmd_global_unregister.c - NeonServ v5.5 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -30,7 +30,7 @@ CMD_BIND(global_cmd_unregister) { else channel = (chan ? chan->name : ""); if(!is_valid_chan(channel)) { - reply(getTextBot(), user, "NS_INVALID_CHANNEL_NAME", channel); + reply(textclient, user, "NS_INVALID_CHANNEL_NAME", channel); return; } int chanid; @@ -39,11 +39,11 @@ CMD_BIND(global_cmd_unregister) { if ((row = mysql_fetch_row(res)) != NULL) { chanid = atoi(row[0]); } else { - reply(getTextBot(), user, "NS_UNREGISTER_NOT_REGISTERED", channel, client->user->nick); + reply(textclient, user, "NS_UNREGISTER_NOT_REGISTERED", channel, client->user->nick); return; } if(client->botid == NEONSERV_BOTID && !strcmp(row[1], "1")) { - reply(getTextBot(), user, "NS_UNREGISTER_NODELETE", channel); + reply(textclient, user, "NS_UNREGISTER_NODELETE", channel); return; } int sync_neonspam_unreg = get_int_field("General.sync_neonspam_unreg"); @@ -53,7 +53,7 @@ CMD_BIND(global_cmd_unregister) { printf_mysql_query("SELECT `botid`, `bot_channels`.`id`, `suspended` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chanid, client->botid); res = mysql_use(); if ((row = mysql_fetch_row(res)) == NULL) { - reply(getTextBot(), user, "NS_UNREGISTER_NOT_REGISTERED", channel, client->user->nick); + reply(textclient, user, "NS_UNREGISTER_NOT_REGISTERED", channel, client->user->nick); return; } int botid = atoi(row[0]); @@ -63,24 +63,22 @@ CMD_BIND(global_cmd_unregister) { break; } printf_mysql_query("DELETE FROM `bot_channels` WHERE `id` = '%s'", row[1]); - reply(getTextBot(), user, "NS_UNREGISTER_DONE", channel); + reply(textclient, user, "NS_UNREGISTER_DONE", channel); if(bot && strcmp(row[2], "1")) { putsock(bot, "PART %s :Channel unregistered.", channel); } if(client->botid == NEONSERV_BOTID && sync_neonspam_unreg) { printf_mysql_query("SELECT `botid`, `bot_channels`.`id`, `suspended` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` LEFT JOIN `channels` ON `chanid` = `channel_id` WHERE `channel_name` = '%s' AND `botclass` = '%d'", escape_string(channel), NEONSPAM_BOTID); res = mysql_use(); - if ((row = mysql_fetch_row(res)) == NULL) { - return; - } - botid = atoi(row[0]); - for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { - if(bot->clientid == botid) - break; - } - printf_mysql_query("DELETE FROM `bot_channels` WHERE `id` = '%s'", row[1]); - if(bot && strcmp(row[2], "1")) { - putsock(bot, "PART %s :Channel unregistered.", channel); + if ((row = mysql_fetch_row(res))) { + botid = atoi(row[0]); + for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { + if(bot->clientid == botid) + break; + } + printf_mysql_query("DELETE FROM `bot_channels` WHERE `id` = '%s'", row[1]); + if(bot && strcmp(row[2], "1")) + putsock(bot, "PART %s :Channel unregistered.", channel); } } // NeonBackup SubBlock