updated DATABASE.txt and implemented suspended channels
authorpk910 <philipp@zoelle1.de>
Tue, 20 Sep 2011 20:00:22 +0000 (22:00 +0200)
committerpk910 <philipp@zoelle1.de>
Tue, 20 Sep 2011 20:00:22 +0000 (22:00 +0200)
DATABASE.txt
bot_NeonServ.c
modcmd.c

index 1448119fda339701d078a041fd7d9813ab3ebedf..a7039af484caa0bd5453e858bb78399d6e111d4d 100644 (file)
@@ -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
index a2fd98619736beff53c04c8495dbddaacf831bfb..c426cace6dcf9d63d1b897168e0d55c5dc3cee45 100644 (file)
@@ -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) {
index 95d47b06e4a36b6548095b6be400767c6083941b..31ea320607b2101863338366def9d2653a196e6a 100644 (file)
--- 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)) {