X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_opmode.c;h=829b32323db7a347bcd80a44cc859ef1b7309967;hb=refs%2Fheads%2Fupstream;hp=c67eb029e5e3d0d86b7ebd2cdea35506f98df432;hpb=0c6d8d5a811c67955dd40ad0a4e279a21f2cd3cd;p=ircu2.10.12-pk.git diff --git a/ircd/m_opmode.c b/ircd/m_opmode.c index c67eb02..829b323 100644 --- a/ircd/m_opmode.c +++ b/ircd/m_opmode.c @@ -1,5 +1,5 @@ /* - * IRC - Internet Relay Chat, ircd/m_tmpl.c + * IRC - Internet Relay Chat, ircd/m_opmode.c * Copyright (C) 1990 Jarkko Oikarinen and * University of Oulu, Computing Center * Copyright (C) 2000 Kevin L. Mitchell @@ -80,26 +80,23 @@ * note: it is guaranteed that parv[0]..parv[parc-1] are all * non-NULL pointers. */ -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ -#include "handlers.h" -#endif /* 0 */ +#include "config.h" + #include "client.h" #include "channel.h" #include "hash.h" #include "ircd.h" +#include "ircd_features.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msg.h" #include "numeric.h" #include "numnicks.h" #include "send.h" +#include "s_conf.h" -#include +/* #include -- Now using assert in ircd_log.h */ /* * ms_opmode - server message handler @@ -116,7 +113,7 @@ int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; if ('#' != *parv[1] || !(chptr = FindChannel(parv[1]))) - return send_error_to_client(sptr, ERR_NOSUCHCHANNEL, parv[1]); + return send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]); modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */ @@ -128,7 +125,8 @@ int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2, (MODE_PARSE_SET | /* Set the modes on the channel */ MODE_PARSE_STRICT | /* Be strict about it */ - MODE_PARSE_FORCE)); /* And force them to be accepted */ + MODE_PARSE_FORCE), /* And force them to be accepted */ + NULL); modebuf_flush(&mbuf); /* flush the modes */ @@ -140,23 +138,37 @@ int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { -#ifndef CONFIG_OPERCMDS - return send_error_to_client(sptr, ERR_DISABLED, "OPMODE"); -#else struct Channel *chptr = 0; struct ModeBuf mbuf; - struct Membership *member; + char *chname; + const char *qreason; + int force = 0; + + if (!feature_bool(FEAT_CONFIG_OPERCMDS)) + return send_reply(sptr, ERR_DISABLED, "OPMODE"); if (parc < 3) return need_more_params(sptr, "OPMODE"); - clean_channelname(parv[1]); + chname = parv[1]; + if (*chname == '!') + { + chname++; + if (!HasPriv(sptr, IsLocalChannel(chname) ? PRIV_FORCE_LOCAL_OPMODE + : PRIV_FORCE_OPMODE)) + return send_reply(sptr, ERR_NOPRIVILEGES); + force = 1; + } + + if (!HasPriv(sptr, + IsLocalChannel(chname) ? PRIV_LOCAL_OPMODE : PRIV_OPMODE)) + return send_reply(sptr, ERR_NOPRIVILEGES); - if (('#' != *parv[1] && '&' != *parv[1]) || !(chptr = FindChannel(parv[1]))) - return send_error_to_client(sptr, ERR_NOSUCHCHANNEL, parv[1]); + if (!IsChannelName(chname) || !(chptr = FindChannel(chname))) + return send_reply(sptr, ERR_NOSUCHCHANNEL, chname); - if (!(member = find_member_link(chptr, sptr))) - return send_error_to_client(sptr, ERR_NOTONCHANNEL, chptr->chname); + if (!force && (qreason = find_quarantine(chptr->chname))) + return send_reply(sptr, ERR_QUARANTINED, chptr->chname, qreason); modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */ @@ -167,11 +179,11 @@ int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2, (MODE_PARSE_SET | /* set the modes on the channel */ - MODE_PARSE_FORCE)); /* And force them to be accepted */ + MODE_PARSE_FORCE), /* And force them to be accepted */ + NULL); modebuf_flush(&mbuf); /* flush the modes */ return 0; -#endif /* CONFIG_OPERCMDS */ }