X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_mode.c;h=e85398d26646e57790efc55f261ebbaaeeb5e04f;hb=refs%2Fheads%2Fupstream;hp=051fc630e7d606fbeeb2f14498374d9ee1ad8664;hpb=534a8b34c9ece2d6aa4d003394b397ed48aa4ea9;p=ircu2.10.12-pk.git diff --git a/ircd/m_mode.c b/ircd/m_mode.c index 051fc63..e85398d 100644 --- a/ircd/m_mode.c +++ b/ircd/m_mode.c @@ -86,6 +86,7 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -112,7 +113,22 @@ m_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) return need_more_params(sptr, "MODE"); if (!IsChannelName(parv[1]) || !(chptr = FindChannel(parv[1]))) - return set_user_mode(cptr, sptr, parc, parv); + { + struct Client *acptr; + + acptr = FindUser(parv[1]); + if (!acptr) + { + send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]); + return 0; + } + else if (sptr != acptr) + { + send_reply(sptr, ERR_USERSDONTMATCH); + return 0; + } + return set_user_mode(cptr, sptr, parc, parv, ALLOWMODES_ANY); + } ClrFlag(sptr, FLAG_TS8); @@ -167,7 +183,23 @@ ms_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) return 0; if (!(chptr = FindChannel(parv[1]))) - return set_user_mode(cptr, sptr, parc, parv); + { + struct Client *acptr; + + acptr = FindUser(parv[1]); + if (!acptr) + { + return 0; + } + else if (sptr != acptr) + { + sendwallto_group_butone(&me, WALL_WALLOPS, 0, + "MODE for User %s from %s!%s", parv[1], + cli_name(cptr), cli_name(sptr)); + return 0; + } + return set_user_mode(cptr, sptr, parc, parv, ALLOWMODES_ANY); + } ClrFlag(sptr, FLAG_TS8); @@ -177,10 +209,15 @@ ms_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) (MODEBUF_DEST_CHANNEL | /* Send mode to clients */ MODEBUF_DEST_SERVER | /* Send mode to servers */ MODEBUF_DEST_HACK4)); /* Send a HACK(4) message */ + else if (!feature_bool(FEAT_OPLEVELS)) + modebuf_init(&mbuf, sptr, cptr, chptr, + (MODEBUF_DEST_CHANNEL | /* Send mode to clients */ + MODEBUF_DEST_SERVER | /* Send mode to servers */ + MODEBUF_DEST_HACK3)); /* Send a HACK(3) message */ else /* Servers need to be able to op people who join using the Apass - * or upass, as well as people joining a zannel, therefore we no - * longer generate HACK3. */ + * or upass, as well as people joining a zannel, therefore we do + * not generate HACK3 when oplevels are on. */ modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_CHANNEL | /* Send mode to clients */ MODEBUF_DEST_SERVER)); /* Send mode to servers */ @@ -191,9 +228,7 @@ ms_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) MODE_PARSE_FORCE), /* And force it to be accepted */ NULL); } else { - if (!(member = find_member_link(chptr, sptr)) - /* Allow people to op themselves on an empty channel. */ - || (!IsChanOp(member) && chptr->users > 1)) { + if (!(member = find_member_link(chptr, sptr)) || !IsChanOp(member)) { modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_SERVER | /* Send mode to server */ MODEBUF_DEST_HACK2 | /* Send a HACK(2) message */