bs_unassign.c

Go to the documentation of this file.
00001 /* BotServ 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: bs_unassign.c 1345 2008-01-13 12:54:14Z geniusdex $
00012  *
00013  */
00014 /*************************************************************************/
00015 
00016 #include "module.h"
00017 
00018 int do_unassign(User * u);
00019 void myBotServHelp(User * u);
00020 
00027 int AnopeInit(int argc, char **argv)
00028 {
00029     Command *c;
00030 
00031     moduleAddAuthor("Anope");
00032     moduleAddVersion("$Id: bs_unassign.c 1345 2008-01-13 12:54:14Z geniusdex $");
00033     moduleSetType(CORE);
00034     c = createCommand("UNASSIGN", do_unassign, NULL, BOT_HELP_UNASSIGN, -1,
00035                       -1, -1, -1);
00036     moduleAddCommand(BOTSERV, c, MOD_UNIQUE);
00037 
00038     moduleSetBotHelp(myBotServHelp);
00039 
00040     return MOD_CONT;
00041 }
00042 
00046 void AnopeFini(void)
00047 {
00048 
00049 }
00050 
00051 
00052 
00057 void myBotServHelp(User * u)
00058 {
00059     notice_lang(s_BotServ, u, BOT_HELP_CMD_UNASSIGN);
00060 }
00061 
00067 int do_unassign(User * u)
00068 {
00069     char *chan = strtok(NULL, " ");
00070     ChannelInfo *ci;
00071 
00072     if (readonly)
00073         notice_lang(s_BotServ, u, BOT_ASSIGN_READONLY);
00074     else if (!chan)
00075         syntax_error(s_BotServ, u, "UNASSIGN", BOT_UNASSIGN_SYNTAX);
00076     else if (!(ci = cs_findchan(chan)))
00077         notice_lang(s_BotServ, u, CHAN_X_NOT_REGISTERED, chan);
00078     else if (ci->flags & CI_VERBOTEN)
00079         notice_lang(s_BotServ, u, CHAN_X_FORBIDDEN, chan);
00080     else if (!is_services_admin(u) && !check_access(u, ci, CA_ASSIGN))
00081         notice_lang(s_BotServ, u, ACCESS_DENIED);
00082     else if (!ci->bi)
00083         notice_help(s_BotServ, u, BOT_NOT_ASSIGNED);
00084     else {
00085         unassign(u, ci);
00086         notice_lang(s_BotServ, u, BOT_UNASSIGN_UNASSIGNED, ci->name);
00087     }
00088     return MOD_CONT;
00089 }

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