]> jfr.im git - irc/quakenet/newserv.git/blobdiff - qabot/qabot_commands.c
CHANSERV: remove E type escapes
[irc/quakenet/newserv.git] / qabot / qabot_commands.c
index f7d7d7c5c6b7205a83f30091940bf2ccf60bfbab..1f0b962d552c8c559f4073dc0eb7ae6fd121e9c2 100644 (file)
-#include <stdio.h>\r
-#include <string.h>\r
-#include <time.h>\r
-\r
-#include "../nick/nick.h"\r
-#include "../localuser/localuserchannel.h"\r
-#include "../core/hooks.h"\r
-#include "../core/schedule.h"\r
-#include "../lib/array.h"\r
-#include "../lib/base64.h"\r
-#include "../lib/irc_string.h"\r
-#include "../lib/splitline.h"\r
-\r
-#include "qabot.h"\r
-\r
-int qabot_doshowcommands(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  Command* cmdlist[150];\r
-  int i, j;\r
-\r
-  sendnoticetouser(qabot_nick, np, "The following commands are registered at present:");\r
-  for (i = 0, j = getcommandlist(qabot_commands, cmdlist, 150); i < j; i++) {\r
-    if (cmdlist[i]->level)\r
-      sendnoticetouser(qabot_nick, np, "%s (%s)", cmdlist[i]->command->content, qabot_uflagtostr(cmdlist[i]->level));\r
-    else\r
-      sendnoticetouser(qabot_nick, np, "%s", cmdlist[i]->command->content);\r
-  }\r
-  sendnoticetouser(qabot_nick, np, "End of list.");\r
-\r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dohelp(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: help <command>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  return qabot_showhelp(np, cargv[0]);\r
-}\r
-\r
-int qabot_dohello(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-\r
-  if (!IsOper(np)) {\r
-    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");\r
-    return CMD_ERROR;\r
-  }\r
-\r
-  if (qabot_users) {\r
-    sendnoticetouser(qabot_nick, np, "This command cannot be used once the initial account has been created.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  qabot_adduser(np->authname, QAUFLAG_STAFF|QAUFLAG_ADMIN|QAUFLAG_DEVELOPER, time(0));\r
-  qabot_savedb();\r
-  sendnoticetouser(qabot_nick, np, "An account has been created with admin privileges.");\r
-\r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dosave(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  \r
-  sendnoticetouser(qabot_nick, np, "Saving...");\r
-  qabot_savedb();\r
-  sendnoticetouser(qabot_nick, np, "Done.");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dolistbots(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  qab_bot* b;\r
-  \r
-  if (!qab_bots) {\r
-    sendnoticetouser(qabot_nick, np, "There are no bots currently added.");\r
-    return CMD_OK;\r
-  }\r
-  \r
-  sendnoticetouser(qabot_nick, np, "The following bots are added:");\r
-  for (b = qab_bots; b; b = b->next)\r
-    sendnoticetouser(qabot_nick, np, "%s (%s@%s)", b->nick, b->user, b->host);\r
-  sendnoticetouser(qabot_nick, np, "End of list.");\r
-}\r
-\r
-int qabot_dolistusers(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  qab_user* u;\r
-  \r
-  if (!qabot_users) {\r
-    sendnoticetouser(qabot_nick, np, "There are no users currently added.");\r
-    return CMD_OK;\r
-  }\r
-  \r
-  sendnoticetouser(qabot_nick, np, "The following users are added:");\r
-  for (u = qabot_users; u; u = u->next)\r
-    sendnoticetouser(qabot_nick, np, "%-15s (%s)", u->authname, qabot_uflagtostr(u->flags));\r
-  sendnoticetouser(qabot_nick, np, "End of list.");\r
-}\r
-\r
-int qabot_doshowbot(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  qab_bot* bot;\r
-  nick* botnick;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: showbot <nick>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(botnick = getnickbynick(cargv[0]))) {\r
-    sendnoticetouser(qabot_nick, np, "No such nickname.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  bot = botnick->exts[qabot_nickext];\r
-  if (!bot) {\r
-    sendnoticetouser(qabot_nick, np, "%s is not a QABot.", botnick->nick);\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  sendnoticetouser(qabot_nick, np, "- Information for %s ---", bot->nick);\r
-  sendnoticetouser(qabot_nick, np, "User:                     %s", bot->user);\r
-  sendnoticetouser(qabot_nick, np, "Host:                     %s", bot->host);\r
-  sendnoticetouser(qabot_nick, np, "Public chan:              %s", bot->public_chan->name->content);\r
-  sendnoticetouser(qabot_nick, np, "Question chan:            %s", bot->question_chan->name->content);\r
-  sendnoticetouser(qabot_nick, np, "Staff chan:               %s", bot->staff_chan->name->content);\r
-  sendnoticetouser(qabot_nick, np, "Spam interval:            %d", bot->spam_interval);\r
-  sendnoticetouser(qabot_nick, np, "Nick block interval:      %d", bot->ask_wait);\r
-  sendnoticetouser(qabot_nick, np, "Queued question interval: %d", bot->queued_question_interval);  \r
-  sendnoticetouser(qabot_nick, np, "Lines spammed:            %d", bot->spammed);\r
-  sendnoticetouser(qabot_nick, np, "Questions asked:          %d", bot->lastquestionID);\r
-  sendnoticetouser(qabot_nick, np, "Questions answered:       %d", bot->answered);\r
-  sendnoticetouser(qabot_nick, np, "Blocks:                   %d", bot->block_count);\r
-  sendnoticetouser(qabot_nick, np, "Block control chars:      %s", (bot->flags & QAB_CONTROLCHAR) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Block colour:             %s", (bot->flags & QAB_COLOUR) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Authed users only:        %s", (bot->flags & QAB_AUTHEDONLY) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Line break:               %s", (bot->flags & QAB_LINEBREAK) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Question flood detection: %s", (bot->flags & QAB_FLOODDETECT) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Question flood blocking:  %s", (bot->flags & QAB_FLOODSTOP) ? "Yes" : "No");\r
-  sendnoticetouser(qabot_nick, np, "Blocks mark as spam:      %s", (bot->flags & QAB_BLOCKMARK) ? "Yes" : "No");\r
-  if (bot->micnumeric) {\r
-    nick* mnick = getnickbynumeric(bot->micnumeric);\r
-    \r
-    sendnoticetouser(qabot_nick, np, "Mic:                      Enabled (%s)", mnick ? mnick->nick : "UNKNOWN");\r
-  }\r
-  else\r
-    sendnoticetouser(qabot_nick, np, "Mic:                      Disabled");\r
-  sendnoticetouser(qabot_nick, sender, "Mic timeout:              %d", bot->mic_timeout);\r
-  sendnoticetouser(qabot_nick, np, "End of list.");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_doaddbot(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  qab_bot* bot;\r
-  channel* cp;\r
-  \r
-  if (cargc < 3) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: addbot <nick> <user> <host> <public channel> <question channel> <staff channel>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!IsOper(np)) {\r
-    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!qabot_addbot(cargv[0], cargv[1], cargv[2], cargv[3], cargv[4], cargv[5], DEFAULTBOTFLAGS, SPAMINTERVAL, ASKWAIT, QUEUEDQUESTIONINTERVAL, np))\r
-    return CMD_ERROR;\r
-  \r
-  sendnoticetouser(qabot_nick, np, "Created %s!%s@%s (%s, %s, %s).", cargv[0], cargv[1], cargv[2], cargv[3], cargv[4], cargv[5]);\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dodelbot(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  nick* botnick;\r
-  qab_bot* bot;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: delbot <nick>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!IsOper(np)) {\r
-    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(botnick = getnickbynick(cargv[0]))) {\r
-    sendnoticetouser(qabot_nick, np, "No such nickname.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  bot = botnick->exts[qabot_nickext];\r
-  if (!bot) {\r
-    sendnoticetouser(qabot_nick, np, "%s is not a QABot.", botnick->nick);\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  qabot_delbot(bot);\r
-  sendnoticetouser(qabot_nick, np, "Bot deleted.");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_doadduser(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  nick* target;\r
-  char* ch;\r
-  flag_t flags = 0;\r
-  char* victim;\r
-  \r
-  if (cargc < 2) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: adduser <nick> <flags>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(victim = qabot_getvictim(np, cargv[0])))\r
-    return CMD_ERROR;\r
-  \r
-  if (qabot_getuser(victim)) {\r
-    sendnoticetouser(qabot_nick, np, "Account %s already exists.", target->authname);\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  for (ch = cargv[1]; *ch; ch++) {\r
-    switch (*ch) {\r
-    case '+':\r
-      break;\r
-      \r
-    case 'a':\r
-      flags |= (QAUFLAG_ADMIN|QAUFLAG_STAFF);\r
-      break;\r
-      \r
-    case 'd':\r
-      flags |= (QAUFLAG_DEVELOPER|QAUFLAG_ADMIN|QAUFLAG_STAFF);\r
-      \r
-    case 's':\r
-      flags |= QAUFLAG_STAFF;\r
-      break;\r
-      \r
-    default:\r
-      sendnoticetouser(qabot_nick, np, "Unknown flag '%c'.", *ch);\r
-      return;\r
-    }\r
-  }\r
-  \r
-  qabot_adduser(victim, flags, time(0));\r
-  sendnoticetouser(qabot_nick, np, "Account created.");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dodeluser(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  qab_user* u;\r
-  char* victim;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: <account>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(victim = qabot_getvictim(np, cargv[0])))\r
-    return CMD_ERROR;\r
-  \r
-  if (!(u = qabot_getuser(victim))) {\r
-    sendnoticetouser(qabot_nick, np, "Account does not exist.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!ircd_strcmp(u->authname, np->authname)) {\r
-    sendnoticetouser(qabot_nick, np, "You cannot delete your own account.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  qabot_squelchuser(u);\r
-  sendnoticetouser(qabot_nick, np, "Account deleted.");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dochangelev(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  char* victim;\r
-  qab_user* u;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: changelev <nick|#authname> <flags>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(victim = qabot_getvictim(np, cargv[0])))\r
-    return CMD_ERROR;\r
-  \r
-  if (!(u = qabot_getuser(victim))) {\r
-    sendnoticetouser(qabot_nick, np, "Account does not exist.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  sendnoticetouser(qabot_nick, np, "TODO: Finish this! :)");\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dowhois(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  char* victim;\r
-  qab_user* u;\r
-  \r
-  if (cargc < 1) {\r
-    sendnoticetouser(qabot_nick, np, "Syntax: whois <nick|#authname>");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  if (!(victim = qabot_getvictim(np, cargv[0])))\r
-    return CMD_ERROR;\r
-  \r
-  if (!(u = qabot_getuser(victim))) {\r
-    sendnoticetouser(qabot_nick, np, "Account does not exist.");\r
-    return CMD_ERROR;\r
-  }\r
-  \r
-  sendnoticetouser(qabot_nick, np, "Account: %s", u->authname);\r
-  sendnoticetouser(qabot_nick, np, "Flags:   %s", qabot_uflagtostr(u->flags));\r
-  sendnoticetouser(qabot_nick, np, "Created: %s", qabot_formattime(u->created));\r
-  \r
-  return CMD_OK;\r
-}\r
-\r
-int qabot_dostatus(void* sender, int cargc, char** cargv) {\r
-  nick* np = (nick*)sender;\r
-  int botc = 0, blockc = 0, userc = 0, spamc = 0, qc = 0, qac = 0;\r
-  qab_bot* b;\r
-  qab_user* u;\r
-  \r
-  for (b = qab_bots; b; b = b->next) {\r
-    botc++;\r
-    blockc += b->block_count;\r
-    spamc += b->spammed;\r
-    qc += b->lastquestionID;\r
-    qac += b->answered;\r
-  }\r
-  \r
-  for (u = qabot_users; u; u = u->next)\r
-    userc++;\r
-  \r
-  sendnoticetouser(qabot_nick, np, "Up since:                 %s", qabot_formattime(qab_startime));\r
-  sendnoticetouser(qabot_nick, np, "Bots:                     %d", botc);\r
-  sendnoticetouser(qabot_nick, np, "Blocks:                   %d", blockc);\r
-  sendnoticetouser(qabot_nick, np, "Users:                    %d", userc);\r
-  sendnoticetouser(qabot_nick, np, "Total lines spammed:      %d", spamc);\r
-  sendnoticetouser(qabot_nick, np, "Total questions asked:    %d", qc);\r
-  sendnoticetouser(qabot_nick, np, "Total questions answered: %d", qac);\r
-  \r
-  return CMD_OK;\r
-}\r
+#include <stdio.h>
+#include <time.h>
+
+#include "../nick/nick.h"
+#include "../localuser/localuserchannel.h"
+#include "../core/hooks.h"
+#include "../core/schedule.h"
+#include "../lib/array.h"
+#include "../lib/base64.h"
+#include "../lib/irc_string.h"
+#include "../lib/splitline.h"
+
+#include "qabot.h"
+
+int qabot_doshowcommands(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  Command* cmdlist[150];
+  int i, j;
+
+  sendnoticetouser(qabot_nick, np, "The following commands are registered at present:");
+  for (i = 0, j = getcommandlist(qabot_commands, cmdlist, 150); i < j; i++) {
+    if (cmdlist[i]->level)
+      sendnoticetouser(qabot_nick, np, "%s (%s)", cmdlist[i]->command->content, qabot_uflagtostr(cmdlist[i]->level));
+    else
+      sendnoticetouser(qabot_nick, np, "%s", cmdlist[i]->command->content);
+  }
+  sendnoticetouser(qabot_nick, np, "End of list.");
+
+  return CMD_OK;
+}
+
+int qabot_dohelp(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: help <command>");
+    return CMD_ERROR;
+  }
+  
+  return qabot_showhelp(np, cargv[0]);
+}
+
+int qabot_dohello(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+
+  if (!IsOper(np)) {
+    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");
+    return CMD_ERROR;
+  }
+
+  if (qabot_users) {
+    sendnoticetouser(qabot_nick, np, "This command cannot be used once the initial account has been created.");
+    return CMD_ERROR;
+  }
+  
+  qabot_adduser(np->authname, QAUFLAG_STAFF|QAUFLAG_ADMIN|QAUFLAG_DEVELOPER, time(0));
+  qabot_savedb();
+  sendnoticetouser(qabot_nick, np, "An account has been created with admin privileges.");
+
+  return CMD_OK;
+}
+
+int qabot_dosave(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  
+  sendnoticetouser(qabot_nick, np, "Saving...");
+  qabot_savedb();
+  sendnoticetouser(qabot_nick, np, "Done.");
+  
+  return CMD_OK;
+}
+
+int qabot_dolistbots(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  qab_bot* b;
+  
+  if (!qab_bots) {
+    sendnoticetouser(qabot_nick, np, "There are no bots currently added.");
+    return CMD_OK;
+  }
+  
+  sendnoticetouser(qabot_nick, np, "The following bots are added:");
+  for (b = qab_bots; b; b = b->next)
+    sendnoticetouser(qabot_nick, np, "%s (%s@%s)", b->nick, b->user, b->host);
+  sendnoticetouser(qabot_nick, np, "End of list.");
+
+  return CMD_OK;
+}
+
+int qabot_dolistusers(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  qab_user* u;
+  
+  if (!qabot_users) {
+    sendnoticetouser(qabot_nick, np, "There are no users currently added.");
+    return CMD_OK;
+  }
+  
+  sendnoticetouser(qabot_nick, np, "The following users are added:");
+  for (u = qabot_users; u; u = u->next)
+    sendnoticetouser(qabot_nick, np, "%-15s (%s)", u->authname, qabot_uflagtostr(u->flags));
+  sendnoticetouser(qabot_nick, np, "End of list.");
+
+  return CMD_OK;
+}
+
+int qabot_doshowbot(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  qab_bot* bot;
+  nick* botnick;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: showbot <nick>");
+    return CMD_ERROR;
+  }
+  
+  if (!(botnick = getnickbynick(cargv[0]))) {
+    sendnoticetouser(qabot_nick, np, "No such nickname.");
+    return CMD_ERROR;
+  }
+  
+  bot = botnick->exts[qabot_nickext];
+  if (!bot) {
+    sendnoticetouser(qabot_nick, np, "%s is not a QABot.", botnick->nick);
+    return CMD_ERROR;
+  }
+  
+  sendnoticetouser(qabot_nick, np, "- Information for %s ---", bot->nick);
+  sendnoticetouser(qabot_nick, np, "User:                     %s", bot->user);
+  sendnoticetouser(qabot_nick, np, "Host:                     %s", bot->host);
+  sendnoticetouser(qabot_nick, np, "Public chan:              %s", bot->public_chan->name->content);
+  sendnoticetouser(qabot_nick, np, "Question chan:            %s", bot->question_chan->name->content);
+  sendnoticetouser(qabot_nick, np, "Staff chan:               %s", bot->staff_chan->name->content);
+  sendnoticetouser(qabot_nick, np, "Spam interval:            %d", bot->spam_interval);
+  sendnoticetouser(qabot_nick, np, "Nick block interval:      %d", bot->ask_wait);
+  sendnoticetouser(qabot_nick, np, "Queued question interval: %d", bot->queued_question_interval);  
+  sendnoticetouser(qabot_nick, np, "Lines spammed:            %d", bot->spammed);
+  sendnoticetouser(qabot_nick, np, "Questions asked:          %d", bot->lastquestionID);
+  sendnoticetouser(qabot_nick, np, "Questions answered:       %d", bot->answered);
+  sendnoticetouser(qabot_nick, np, "Blocks:                   %d", bot->block_count);
+  sendnoticetouser(qabot_nick, np, "Block control chars:      %s", (bot->flags & QAB_CONTROLCHAR) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Block colour:             %s", (bot->flags & QAB_COLOUR) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Authed users only:        %s", (bot->flags & QAB_AUTHEDONLY) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Line break:               %s", (bot->flags & QAB_LINEBREAK) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Question flood detection: %s", (bot->flags & QAB_FLOODDETECT) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Question flood blocking:  %s", (bot->flags & QAB_FLOODSTOP) ? "Yes" : "No");
+  sendnoticetouser(qabot_nick, np, "Blocks mark as spam:      %s", (bot->flags & QAB_BLOCKMARK) ? "Yes" : "No");
+  if (bot->micnumeric) {
+    nick* mnick = getnickbynumeric(bot->micnumeric);
+    
+    sendnoticetouser(qabot_nick, np, "Mic:                      Enabled (%s)", mnick ? mnick->nick : "UNKNOWN");
+  }
+  else
+    sendnoticetouser(qabot_nick, np, "Mic:                      Disabled");
+  sendnoticetouser(qabot_nick, sender, "Mic timeout:              %d", bot->mic_timeout);
+  sendnoticetouser(qabot_nick, np, "End of list.");
+  
+  return CMD_OK;
+}
+
+int qabot_doaddbot(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  
+  if (cargc < 3) {
+    sendnoticetouser(qabot_nick, np, "Syntax: addbot <nick> <user> <host> <public channel> <question channel> <staff channel>");
+    return CMD_ERROR;
+  }
+  
+  if (!IsOper(np)) {
+    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");
+    return CMD_ERROR;
+  }
+  
+  if (!qabot_addbot(cargv[0], cargv[1], cargv[2], cargv[3], cargv[4], cargv[5], DEFAULTBOTFLAGS, SPAMINTERVAL, ASKWAIT, QUEUEDQUESTIONINTERVAL, np))
+    return CMD_ERROR;
+  
+  sendnoticetouser(qabot_nick, np, "Created %s!%s@%s (%s, %s, %s).", cargv[0], cargv[1], cargv[2], cargv[3], cargv[4], cargv[5]);
+  
+  return CMD_OK;
+}
+
+int qabot_dodelbot(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  nick* botnick;
+  qab_bot* bot;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: delbot <nick>");
+    return CMD_ERROR;
+  }
+  
+  if (!IsOper(np)) {
+    sendnoticetouser(qabot_nick, np, "You must be opered to use this command.");
+    return CMD_ERROR;
+  }
+  
+  if (!(botnick = getnickbynick(cargv[0]))) {
+    sendnoticetouser(qabot_nick, np, "No such nickname.");
+    return CMD_ERROR;
+  }
+  
+  bot = botnick->exts[qabot_nickext];
+  if (!bot) {
+    sendnoticetouser(qabot_nick, np, "%s is not a QABot.", botnick->nick);
+    return CMD_ERROR;
+  }
+  
+  qabot_delbot(bot);
+  sendnoticetouser(qabot_nick, np, "Bot deleted.");
+  
+  return CMD_OK;
+}
+
+int qabot_doadduser(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  char* ch;
+  flag_t flags = 0;
+  char* victim;
+  
+  if (cargc < 2) {
+    sendnoticetouser(qabot_nick, np, "Syntax: adduser <nick> <flags>");
+    return CMD_ERROR;
+  }
+  
+  if (!(victim = qabot_getvictim(np, cargv[0])))
+    return CMD_ERROR;
+  
+  if (qabot_getuser(victim)) {
+    sendnoticetouser(qabot_nick, np, "Account %s already exists.", victim);
+    return CMD_ERROR;
+  }
+  
+  for (ch = cargv[1]; *ch; ch++) {
+    switch (*ch) {
+    case '+':
+      break;
+      
+    case 'a':
+      flags |= (QAUFLAG_ADMIN|QAUFLAG_STAFF);
+      break;
+      
+    case 'd':
+      flags |= (QAUFLAG_DEVELOPER|QAUFLAG_ADMIN|QAUFLAG_STAFF);
+      
+    case 's':
+      flags |= QAUFLAG_STAFF;
+      break;
+      
+    default:
+      sendnoticetouser(qabot_nick, np, "Unknown flag '%c'.", *ch);
+      return CMD_ERROR;
+    }
+  }
+  
+  qabot_adduser(victim, flags, time(0));
+  sendnoticetouser(qabot_nick, np, "Account created.");
+  
+  return CMD_OK;
+}
+
+int qabot_dodeluser(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  qab_user* u;
+  char* victim;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: <account>");
+    return CMD_ERROR;
+  }
+  
+  if (!(victim = qabot_getvictim(np, cargv[0])))
+    return CMD_ERROR;
+  
+  if (!(u = qabot_getuser(victim))) {
+    sendnoticetouser(qabot_nick, np, "Account does not exist.");
+    return CMD_ERROR;
+  }
+  
+  if (!ircd_strcmp(u->authname, np->authname)) {
+    sendnoticetouser(qabot_nick, np, "You cannot delete your own account.");
+    return CMD_ERROR;
+  }
+  
+  qabot_squelchuser(u);
+  sendnoticetouser(qabot_nick, np, "Account deleted.");
+  
+  return CMD_OK;
+}
+
+int qabot_dochangelev(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  char* victim;
+  qab_user* u;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: changelev <nick|#authname> <flags>");
+    return CMD_ERROR;
+  }
+  
+  if (!(victim = qabot_getvictim(np, cargv[0])))
+    return CMD_ERROR;
+  
+  if (!(u = qabot_getuser(victim))) {
+    sendnoticetouser(qabot_nick, np, "Account does not exist.");
+    return CMD_ERROR;
+  }
+  
+  sendnoticetouser(qabot_nick, np, "TODO: Finish this! :)");
+  
+  return CMD_OK;
+}
+
+int qabot_dowhois(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  char* victim;
+  qab_user* u;
+  
+  if (cargc < 1) {
+    sendnoticetouser(qabot_nick, np, "Syntax: whois <nick|#authname>");
+    return CMD_ERROR;
+  }
+  
+  if (!(victim = qabot_getvictim(np, cargv[0])))
+    return CMD_ERROR;
+  
+  if (!(u = qabot_getuser(victim))) {
+    sendnoticetouser(qabot_nick, np, "Account does not exist.");
+    return CMD_ERROR;
+  }
+  
+  sendnoticetouser(qabot_nick, np, "Account: %s", u->authname);
+  sendnoticetouser(qabot_nick, np, "Flags:   %s", qabot_uflagtostr(u->flags));
+  sendnoticetouser(qabot_nick, np, "Created: %s", qabot_formattime(u->created));
+  
+  return CMD_OK;
+}
+
+int qabot_dostatus(void* sender, int cargc, char** cargv) {
+  nick* np = (nick*)sender;
+  int botc = 0, blockc = 0, userc = 0, spamc = 0, qc = 0, qac = 0;
+  qab_bot* b;
+  qab_user* u;
+  
+  for (b = qab_bots; b; b = b->next) {
+    botc++;
+    blockc += b->block_count;
+    spamc += b->spammed;
+    qc += b->lastquestionID;
+    qac += b->answered;
+  }
+  
+  for (u = qabot_users; u; u = u->next)
+    userc++;
+  
+  sendnoticetouser(qabot_nick, np, "Up since:                 %s", qabot_formattime(qab_startime));
+  sendnoticetouser(qabot_nick, np, "Bots:                     %d", botc);
+  sendnoticetouser(qabot_nick, np, "Blocks:                   %d", blockc);
+  sendnoticetouser(qabot_nick, np, "Users:                    %d", userc);
+  sendnoticetouser(qabot_nick, np, "Total lines spammed:      %d", spamc);
+  sendnoticetouser(qabot_nick, np, "Total questions asked:    %d", qc);
+  sendnoticetouser(qabot_nick, np, "Total questions answered: %d", qac);
+  
+  return CMD_OK;
+}