1 /* cmd_neonspam_delbad.c - NeonServ v5.6
2 * Copyright (C) 2011-2012 Philipp Kreil (pk910)
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "cmd_neonspam.h"
20 CMD_BIND(neonspam_cmd_delbad) {
23 loadChannelSettings(chan);
24 loadNeonSpamSettings(chan);
25 struct NeonSpamSettings *settings = chan->spam_settings;
27 int badword_id = atoi(argv[0]);
28 printf_mysql_query("SELECT `badword_match` FROM `spamserv_badwords` WHERE `badword_id` = '%d' AND `badword_cid` = '%d'", badword_id, chan->channel_id);
30 if(!(row = mysql_fetch_row(res))) {
31 reply(textclient, user, "SS_BADWORD_ID_UNKNOWN", badword_id, chan->name);
34 struct NeonSpamBadword *badword, *prev = NULL;
35 for(badword = settings->badwords; badword; badword = badword->next) {
36 if(badword->id == badword_id) {
38 prev->next = badword->next;
40 settings->badwords = badword->next;
41 free(badword->badword);
47 printf_mysql_query("DELETE FROM `spamserv_badwords` WHERE `badword_id` = '%d'", badword_id);
48 reply(textclient, user, "SS_BADWORD_DELETED", row[0], badword_id);