updated DATABASE.txt and implemented suspended channels
[NeonServV5.git] / modcmd.c
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)) {