From: pk910 Date: Tue, 20 Sep 2011 20:00:22 +0000 (+0200) Subject: updated DATABASE.txt and implemented suspended channels X-Git-Tag: v5.3~394 X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=ed610e06a0a1e027aa0baeb3d5c791917509e68e;p=NeonServV5.git updated DATABASE.txt and implemented suspended channels --- diff --git a/DATABASE.txt b/DATABASE.txt index 1448119..a7039af 100644 --- a/DATABASE.txt +++ b/DATABASE.txt @@ -42,3 +42,20 @@ ALTER TABLE `bot_binds` CHANGE `botid` `botclass` INT( 11 ) NOT NULL; ALTER TABLE `bots` DROP `whoisbot` ; ALTER TABLE `bots` DROP `bindFrom` ; +CREATE TABLE IF NOT EXISTS `help` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `lang` varchar(6) NOT NULL, + `ident` varchar(64) NOT NULL, + `text` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `language` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `lang` varchar(5) NOT NULL, + `ident` varchar(64) NOT NULL, + `text` varchar(256) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +ALTER TABLE `bot_channels` ADD `suspended` TINYINT( 1 ) NOT NULL; \ No newline at end of file diff --git a/bot_NeonServ.c b/bot_NeonServ.c index a2fd986..c426cac 100644 --- a/bot_NeonServ.c +++ b/bot_NeonServ.c @@ -297,7 +297,7 @@ static void neonserv_bot_ready(struct ClientSocket *client) { putsock(client, "MODE %s +%s", client->user->nick, row[0]); } - printf_mysql_query("SELECT `channel_name`, `channel_key` FROM `bot_channels` LEFT JOIN `channels` ON `chanid` = `channel_id` WHERE `botid` = '%d'", client->clientid); + printf_mysql_query("SELECT `channel_name`, `channel_key` FROM `bot_channels` LEFT JOIN `channels` ON `chanid` = `channel_id` WHERE `botid` = '%d' AND `suspended` = '0'", client->clientid); res = mysql_use(); while ((row = mysql_fetch_row(res)) != NULL) { diff --git a/modcmd.c b/modcmd.c index 95d47b0..31ea320 100644 --- a/modcmd.c +++ b/modcmd.c @@ -36,8 +36,9 @@ static struct ClientSocket *tmp_text_client; static const struct default_language_entry msgtab[] = { {"MODCMD_LESS_PARAM_COUNT", "This command requires more parameters."}, - {"MODCMD_CHAN_REQUIRED", "You must provide the name of a channel that exists."}, + {"MODCMD_CHAN_REQUIRED", "You must provide the name of a channel that exists and the bot is on."}, {"MODCMD_AUTH_REQUIRED", "You need to be authenticated with AuthServ to use this command."}, + {"MODCMD_CHAN_SUSPENDED", "This channel is currently suspended."}, {"MODCMD_PRIVILEGED", "$b%s$b is a privileged command."}, /* {ARGS: "god"} */ {"MODCMD_PUBCMD", "Public commands in $b%s$b are restricted."}, /* {ARGS: "#TestChan"} */ {"MODCMD_ACCESS_DENIED", "Access denied."}, @@ -339,11 +340,14 @@ static void handle_command_async(struct ClientSocket *client, struct UserNode *u reply(tmp_text_client, user, "MODCMD_CHAN_REQUIRED"); return; } - printf_mysql_query("SELECT `botid` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chan->channel_id, client->botid); + printf_mysql_query("SELECT `botid`, `suspended` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chan->channel_id, client->botid); res = mysql_use(); if ((row = mysql_fetch_row(res)) == NULL) { reply(tmp_text_client, user, "MODCMD_CHAN_REQUIRED"); return; + } else if(!strcmp(row[1], "1")) { + reply(tmp_text_client, user, "MODCMD_CHAN_SUSPENDED"); + return; } } if((cbind->func->flags & CMDFLAG_REQUIRE_GOD) && !isGodMode(user)) {