cs_drop.c

Go to the documentation of this file.
00001 /* ChanServ 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: cs_drop.c 1345 2008-01-13 12:54:14Z geniusdex $
00012  *
00013  */
00014 /*************************************************************************/
00015 
00016 #include "module.h"
00017 
00018 int do_drop(User * u);
00019 void myChanServHelp(User * u);
00020 
00027 int AnopeInit(int argc, char **argv)
00028 {
00029     Command *c;
00030 
00031     moduleAddAuthor("Anope");
00032     moduleAddVersion("$Id: cs_drop.c 1345 2008-01-13 12:54:14Z geniusdex $");
00033     moduleSetType(CORE);
00034 
00035     c = createCommand("DROP", do_drop, NULL, -1, CHAN_HELP_DROP, -1,
00036                       CHAN_SERVADMIN_HELP_DROP, CHAN_SERVADMIN_HELP_DROP);
00037     moduleAddCommand(CHANSERV, c, MOD_UNIQUE);
00038 
00039     moduleSetChanHelp(myChanServHelp);
00040 
00041     return MOD_CONT;
00042 }
00043 
00047 void AnopeFini(void)
00048 {
00049 
00050 }
00051 
00052 
00053 
00058 void myChanServHelp(User * u)
00059 {
00060     notice_lang(s_ChanServ, u, CHAN_HELP_CMD_DROP);
00061 }
00062 
00068 int do_drop(User * u)
00069 {
00070     char *chan = strtok(NULL, " ");
00071     ChannelInfo *ci;
00072     int is_servadmin = is_services_admin(u);
00073 
00074     if (readonly && !is_servadmin) {
00075         notice_lang(s_ChanServ, u, CHAN_DROP_DISABLED);
00076         return MOD_CONT;
00077     }
00078 
00079     if (!chan) {
00080         syntax_error(s_ChanServ, u, "DROP", CHAN_DROP_SYNTAX);
00081     } else if (!(ci = cs_findchan(chan))) {
00082         notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan);
00083     } else if (!is_servadmin && (ci->flags & CI_VERBOTEN)) {
00084         notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan);
00085     } else if (!is_servadmin && (ci->flags & CI_SUSPENDED)) {
00086         notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan);
00087     } else if (!is_servadmin
00088                && (ci->
00089                    flags & CI_SECUREFOUNDER ? !is_real_founder(u,
00090                                                                ci) :
00091                    !is_founder(u, ci))) {
00092         notice_lang(s_ChanServ, u, ACCESS_DENIED);
00093     } else {
00094         int level = get_access(u, ci);
00095 
00096         if (readonly)           /* in this case we know they're a Services admin */
00097             notice_lang(s_ChanServ, u, READ_ONLY_MODE);
00098 
00099         if (ci->c) {
00100             if (ircd->regmode) {
00101                 ci->c->mode &= ~ircd->regmode;
00102                 anope_cmd_mode(whosends(ci), ci->name, "-r");
00103             }
00104         }
00105 
00106         if (ircd->chansqline && (ci->flags & CI_VERBOTEN)) {
00107             anope_cmd_unsqline(ci->name);
00108         }
00109 
00110         alog("%s: Channel %s dropped by %s!%s@%s (founder: %s)",
00111              s_ChanServ, ci->name, u->nick, u->username,
00112              u->host, (ci->founder ? ci->founder->display : "(none)"));
00113 
00114         delchan(ci);
00115 
00116         /* We must make sure that the Services admin has not normally the right to
00117          * drop the channel before issuing the wallops.
00118          */
00119         if (WallDrop && is_servadmin && level < ACCESS_FOUNDER)
00120             anope_cmd_global(s_ChanServ,
00121                              "\2%s\2 used DROP on channel \2%s\2", u->nick,
00122                              chan);
00123 
00124         notice_lang(s_ChanServ, u, CHAN_DROPPED, chan);
00125         send_event(EVENT_CHAN_DROP, 1, chan);
00126     }
00127     return MOD_CONT;
00128 }

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