X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/f1fe7b4b28739cd593b82ec4f146b5df465ab234..8f0c3422e75189b7f39a7555ded278ab6027707b:/extensions/m_omode.c diff --git a/extensions/m_omode.c b/extensions/m_omode.c index 418ed214..04524898 100644 --- a/extensions/m_omode.c +++ b/extensions/m_omode.c @@ -1,5 +1,5 @@ /* - * Charybdis: an advanced Internet Relay Chat Daemon(ircd). + * Solanum: a slightly advanced ircd * m_omode.c: allows oper mode hacking * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center @@ -21,8 +21,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA - * - * $Id: m_omode.c 3121 2007-01-02 13:23:04Z jilles $ */ #include "stdinc.h" @@ -44,23 +42,25 @@ #include "messages.h" #include "logger.h" -static int mo_omode(struct Client *, struct Client *, int, const char **); +static const char omode_desc[] = "Allow admins to forcibly change modes on channels with the OMODE command"; + +static void mo_omode(struct MsgBuf *, struct Client *, struct Client *, int, const char **); struct Message omode_msgtab = { - "OMODE", 0, 0, 0, MFLG_SLOW, + "OMODE", 0, 0, 0, 0, {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_omode, 3}} }; mapi_clist_av1 omode_clist[] = { &omode_msgtab, NULL }; -DECLARE_MODULE_AV1(omode, NULL, NULL, omode_clist, NULL, NULL, "$Revision: 3121 $"); +DECLARE_MODULE_AV2(omode, NULL, NULL, omode_clist, NULL, NULL, NULL, NULL, omode_desc); /* * mo_omode - MODE command handler * parv[1] - channel */ -static int -mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Channel *chptr = NULL; struct membership *msptr; @@ -72,7 +72,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char if(!IsOperAdmin(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); - return 0; + return; } /* Now, try to find the channel in question */ @@ -80,7 +80,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char { sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[1]); - return 0; + return; } chptr = find_channel(parv[1]); @@ -89,7 +89,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), parv[1]); - return 0; + return; } /* Now know the channel exists */ @@ -99,7 +99,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char if (is_chanop(msptr)) { sendto_one_notice(source_p, ":Use a normal MODE you idiot"); - return 0; + return; } params[0] = '\0'; @@ -110,20 +110,20 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char rb_strlcat(params, parv[i], sizeof params); } - sendto_wallops_flags(UMODE_WALLOP, &me, + sendto_wallops_flags(UMODE_WALLOP, &me, "OMODE called for [%s] [%s] by %s!%s@%s", parv[1], params, source_p->name, source_p->username, source_p->host); ilog(L_MAIN, "OMODE called for [%s] [%s] by %s", parv[1], params, get_oper_name(source_p)); if(*chptr->chname != '&') - sendto_server(NULL, NULL, NOCAPS, NOCAPS, + sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s", me.name, parv[1], params, source_p->name, source_p->username, source_p->host); #if 0 - set_channel_mode(client_p, source_p->servptr, chptr, msptr, + set_channel_mode(client_p, source_p->servptr, chptr, msptr, parc - 2, parv + 2); #else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) @@ -133,9 +133,9 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char { sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname); - return 0; + return; } - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s", + sendto_channel_local(&me, ALL_MEMBERS, chptr, ":%s MODE %s +o %s", me.name, parv[1], source_p->name); sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s TMODE %ld %s +o %s", @@ -153,7 +153,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char add_user_to_channel(chptr, source_p, CHFL_CHANOP); msptr = find_channel_membership(chptr, source_p); } - set_channel_mode(client_p, source_p, chptr, msptr, + set_channel_mode(client_p, source_p, chptr, msptr, parc - 2, parv + 2); /* We know they were not opped before and they can't have opped * themselves as set_channel_mode() does not allow that @@ -164,5 +164,4 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char remove_user_from_channel(msptr); } #endif - return 0; }