ms_staff.c

Go to the documentation of this file.
00001 /* MemoServ core functions
00002  *
00003  * (C) 2003-2008 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: ms_staff.c 1345 2008-01-13 12:54:14Z geniusdex $
00012  *
00013  */
00014 /*************************************************************************/
00015 
00016 #include "module.h"
00017 
00018 int do_staff(User * u);
00019 void myMemoServHelp(User * u);
00020 
00027 int AnopeInit(int argc, char **argv)
00028 {
00029     Command *c;
00030 
00031     moduleAddAuthor("Anope");
00032     moduleAddVersion
00033         ("$Id: ms_staff.c 1345 2008-01-13 12:54:14Z geniusdex $");
00034     moduleSetType(CORE);
00035     c = createCommand("STAFF", do_staff, is_services_oper, -1, -1,
00036                       MEMO_HELP_STAFF, MEMO_HELP_STAFF, MEMO_HELP_STAFF);
00037     moduleAddCommand(MEMOSERV, c, MOD_UNIQUE);
00038     moduleSetMemoHelp(myMemoServHelp);
00039 
00040     return MOD_CONT;
00041 }
00042 
00046 void AnopeFini(void)
00047 {
00048 
00049 }
00050 
00051 
00052 
00057 void myMemoServHelp(User * u)
00058 {
00059     if (is_services_oper(u)) {
00060         notice_lang(s_MemoServ, u, MEMO_HELP_CMD_STAFF);
00061     }
00062 }
00063 
00069 int do_staff(User * u)
00070 {
00071     NickCore *nc;
00072     int i, z = 0;
00073     char *text = strtok(NULL, "");
00074 
00075     if (readonly) {
00076         notice_lang(s_MemoServ, u, MEMO_SEND_DISABLED);
00077         return MOD_CONT;
00078     } else if (checkDefCon(DEFCON_NO_NEW_MEMOS)) {
00079         notice_lang(s_MemoServ, u, OPER_DEFCON_DENIED);
00080         return MOD_CONT;
00081     } else if (text == NULL) {
00082         syntax_error(s_MemoServ, u, "SEND", MEMO_SEND_SYNTAX);
00083         return MOD_CONT;
00084     }
00085 
00086     for (i = 0; i < 1024; i++) {
00087         for (nc = nclists[i]; nc; nc = nc->next) {
00088             if (nick_is_services_oper(nc))
00089                 memo_send(u, nc->display, text, z);
00090         }
00091     }
00092     return MOD_CONT;
00093 }

Generated on Sun Oct 5 09:06:55 2008 for Anope by  doxygen 1.5.7.1