src/parse.c
changeset 19 66114d944208
parent 18 4435146391ae
child 21 138537d81dd1
--- a/src/parse.c
+++ b/src/parse.c
@@ -43,6 +43,11 @@
 #define    TIME 17
 #define    TELL 18
 #define      OP 19
+#define    DEOP 20
+#define    KICK 21
+#define     BAN 22
+#define   UNBAN 23
+#define KICKBAN 24
 
 const
 char *COMMAND_LIST[] = {
@@ -74,8 +79,11 @@
     "!list", "!search", "!info",
     "!ping", "!on", "!off",
     "!debug", "!vaccuum", "!logout",
-    "!who", "!whois", "!time", "!tell",
-    "!op", NULL
+    "!who", "!whois", "!time",
+    "!tell", "!op", "!deop",
+    "!kick", "!ban", "!unban",
+    "!kickban",
+    NULL
 };
 
 char *parse (MSG * message)
@@ -284,6 +292,42 @@
                         snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token);
                 }
                 return msg;
+
+            case DEOP:
+                if ((token = strtok (NULL, "\r\n")) != NULL) {
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        snprintf (msg, 512, "MODE %s -o %s\r\n", message->channel, token);
+                }
+                return msg;
+
+            case KICK:
+                if ((token = strtok (NULL, "\r\n")) != NULL) {
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        snprintf (msg, 512, "KICK %s %s\r\n", message->channel, token);
+                }
+                return msg;
+
+            case BAN:
+                if ((token = strtok (NULL, "\r\n")) != NULL) {
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        snprintf (msg, 512, "MODE %s +b %s\r\n", message->channel, token);
+                }
+                return msg;
+
+            case UNBAN:
+                if ((token = strtok (NULL, "\r\n")) != NULL) {
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        snprintf (msg, 512, "MODE %s -b %s\r\n", message->channel, token);
+                }
+                return msg;
+
+            case KICKBAN:
+                if ((token = strtok (NULL, "\r\n")) != NULL) {
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        snprintf (msg, 512, "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token,
+                                  message->channel, token);
+                }
+                return msg;
             }
         }
         i++;