os_noop.c

Go to the documentation of this file.
00001 /* OperServ core functions
00002  *
00003  * (C) 2003-2007 Anope Team
00004  * Contact us at info@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church. 
00010  * 
00011  * $Id: os_noop.c 1265 2007-08-26 15:33:06Z geniusdex $
00012  *
00013  */
00014 /*************************************************************************/
00015 
00016 #include "module.h"
00017 
00018 int do_noop(User * u);
00019 void myOperServHelp(User * u);
00020 
00027 int AnopeInit(int argc, char **argv)
00028 {
00029     Command *c;
00030 
00031     moduleAddAuthor("Anope");
00032     moduleAddVersion("$Id: os_noop.c 1265 2007-08-26 15:33:06Z geniusdex $");
00033     moduleSetType(CORE);
00034 
00035     c = createCommand("NOOP", do_noop, is_services_admin, OPER_HELP_NOOP,
00036                       -1, -1, -1, -1);
00037     moduleAddCommand(OPERSERV, c, MOD_UNIQUE);
00038 
00039     moduleSetOperHelp(myOperServHelp);
00040 
00041     return MOD_CONT;
00042 }
00043 
00047 void AnopeFini(void)
00048 {
00049 
00050 }
00051 
00052 
00057 void myOperServHelp(User * u)
00058 {
00059     if (is_services_admin(u)) {
00060         notice_lang(s_OperServ, u, OPER_HELP_CMD_NOOP);
00061     }
00062 }
00063 
00069 int do_noop(User * u)
00070 {
00071     char *cmd = strtok(NULL, " ");
00072     char *server = strtok(NULL, " ");
00073 
00074     if (!cmd || !server) {
00075         syntax_error(s_OperServ, u, "NOOP", OPER_NOOP_SYNTAX);
00076     } else if (!stricmp(cmd, "SET")) {
00077         User *u2;
00078         User *u3 = NULL;
00079         char reason[NICKMAX + 32];
00080 
00081         /* Remove the O:lines */
00082         anope_cmd_svsnoop(server, 1);
00083 
00084         snprintf(reason, sizeof(reason), "NOOP command used by %s",
00085                  u->nick);
00086         if (WallOSNoOp)
00087             anope_cmd_global(s_OperServ, "\2%s\2 used NOOP on \2%s\2",
00088                              u->nick, server);
00089         notice_lang(s_OperServ, u, OPER_NOOP_SET, server);
00090 
00091         /* Kill all the IRCops of the server */
00092         for (u2 = firstuser(); u2; u2 = u3) {
00093             u3 = nextuser();
00094             if ((u2) && is_oper(u2) && (u2->server->name)
00095                 && match_wild(server, u2->server->name)) {
00096                 kill_user(s_OperServ, u2->nick, reason);
00097             }
00098         }
00099     } else if (!stricmp(cmd, "REVOKE")) {
00100         anope_cmd_svsnoop(server, 0);
00101         notice_lang(s_OperServ, u, OPER_NOOP_REVOKE, server);
00102     } else {
00103         syntax_error(s_OperServ, u, "NOOP", OPER_NOOP_SYNTAX);
00104     }
00105     return MOD_CONT;
00106 }

Generated on Sun Dec 30 09:26:48 2007 for Anope by  doxygen 1.5.1-20070107