# HG changeset patch # User Markus Bröker # Date 1229179306 -3600 # Node ID 66114d94420829570c10c7e38499c3fe42ed2f5b # Parent 4435146391ae67a13b1cb69a69999dbaf9095050 op, deop, ban, unban, kick, kickban implemented committer: Markus Bröker diff --git a/debian/changelog b/debian/changelog --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mcbot (0.95-1) unstable; urgency=low +mcbot (0.95-3) unstable; urgency=low * Initial Release * the location of mcbot.cgi is stored in the db @@ -16,5 +16,6 @@ * many small improvements, reduced codebase * IRC access without password added * Help System was able to start a botwar. Fixed + * op, deop, kick, ban, unban, kickban implemented - -- Markus Broeker Mon, 11 Aug 2008 20:45:54 +0200 + -- Markus Broeker Mon, 11 Aug 2008 23:00:01 +0200 diff --git a/src/irc.c b/src/irc.c --- a/src/irc.c +++ b/src/irc.c @@ -32,6 +32,7 @@ #define PRIVMSG 9 #define QUIT 10 #define NICK 11 +#define KICK 12 #define VERSION_STRING "MCBOT on GNU/LINUX" @@ -39,7 +40,7 @@ "NOTICE", "MODE", "JOIN", "PART", "TOPIC", "PING", "ENOMEM", "ERROR", "VERSION", "PRIVMSG", "QUIT", "NICK", - NULL + "KICK", NULL }; FILE *irc_connect (char *server, unsigned int port) @@ -275,6 +276,9 @@ case NICK: message->channel = message->user; return command; + case KICK: + message->channel = message->user; + return command; } } i++; diff --git a/src/parse.c b/src/parse.c --- 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++;