From 7f273676eb203a1be6ca179c6ee1b3d3a4e81a78 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 5 Jun 2016 14:16:36 +0100 Subject: Convert global channel operator support to OFTC's God mode. OFTC's God mode is very similar to the global channel operator mode, with the following differences: - gaining God mode notifies all operators - uses of God mode privileges notifies all operators - God mode times out after a configurable period - uses umode S rather than O - S is taken for SSL clients in hybrid 8.1.13. So align with OFTC's implementation, but omit these features. --- src/channel.c | 8 +++++--- src/channel_mode.c | 5 ++++- src/conf.c | 2 +- src/conf_parser.y | 6 +++--- src/s_user.c | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/channel.c b/src/channel.c index f96f705..fb453e3 100644 --- a/src/channel.c +++ b/src/channel.c @@ -436,7 +436,7 @@ channel_member_names(struct Client *source_p, struct Channel *chptr, int multi_prefix = HasCap(source_p, CAP_MULTI_PREFIX) != 0; int uhnames = HasCap(source_p, CAP_UHNAMES) != 0; - if (PubChannel(chptr) || is_member) + if (PubChannel(chptr) || is_member || HasUMode(source_p, UMODE_GOD)) { t = lbuf + snprintf(lbuf, sizeof(lbuf), form_str(RPL_NAMREPLY), me.name, source_p->name, @@ -447,7 +447,8 @@ channel_member_names(struct Client *source_p, struct Channel *chptr, { const struct Membership *ms = ptr->data; - if (HasUMode(ms->client_p, UMODE_INVISIBLE) && !is_member) + if (HasUMode(ms->client_p, UMODE_INVISIBLE) && !is_member && + !HasUMode(source_p, UMODE_GOD)) continue; if (!uhnames) @@ -750,7 +751,8 @@ can_send(struct Channel *chptr, struct Client *source_p, { struct MaskItem *conf = NULL; - if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE) || HasUMode(source_p, UMODE_GCHANOP)) + if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE) || + HasUMode(source_p, UMODE_GOD)) return CAN_SEND_OPV; if (MyClient(source_p) && !IsExemptResv(source_p)) diff --git a/src/channel_mode.c b/src/channel_mode.c index 5a11d79..fc6771b 100644 --- a/src/channel_mode.c +++ b/src/channel_mode.c @@ -1578,7 +1578,7 @@ get_channel_access(const struct Client *source_p, const struct Membership *member) { /* Let hacked servers in for now... */ - if (!MyClient(source_p) || HasUMode(source_p, UMODE_GCHANOP)) + if (!MyClient(source_p)) return CHACCESS_CHANOP; if (member == NULL) @@ -1595,6 +1595,9 @@ get_channel_access(const struct Client *source_p, return CHACCESS_HALFOP; #endif + if (HasUMode(source_p, UMODE_GOD)) + return CHACCESS_GOD; + return CHACCESS_PEON; } diff --git a/src/conf.c b/src/conf.c index 1464d07..e488dec 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1172,7 +1172,7 @@ set_default_conf(void) ConfigFileEntry.true_no_oper_flood = 0; ConfigFileEntry.oper_pass_resv = 1; ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT; - ConfigFileEntry.oper_only_umodes = UMODE_GCHANOP | UMODE_DEBUG; + ConfigFileEntry.oper_only_umodes = UMODE_GOD | UMODE_DEBUG; ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_OPERWALL | UMODE_WALLOP; ConfigFileEntry.throttle_time = 1; diff --git a/src/conf_parser.y b/src/conf_parser.y index f77db44..4274b6a 100644 --- a/src/conf_parser.y +++ b/src/conf_parser.y @@ -1271,7 +1271,7 @@ oper_umodes_item: T_BOTS } | T_GCHANOPS { if (conf_parser_ctx.pass == 2) - block_state.modes.value |= UMODE_GCHANOP; + block_state.modes.value |= UMODE_GOD; }; oper_flags: IRCD_FLAGS @@ -2781,7 +2781,7 @@ umode_oitem: T_BOTS ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT; } | T_GCHANOPS { - ConfigFileEntry.oper_umodes |= UMODE_GCHANOP; + ConfigFileEntry.oper_umodes |= UMODE_GOD; }; general_oper_only_umodes: OPER_ONLY_UMODES @@ -2855,7 +2855,7 @@ umode_item: T_BOTS ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT; } | T_GCHANOPS { - ConfigFileEntry.oper_only_umodes |= UMODE_GCHANOP; + ConfigFileEntry.oper_only_umodes |= UMODE_GOD; }; general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';' diff --git a/src/s_user.c b/src/s_user.c index 751684b..d89038f 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -97,7 +97,7 @@ const unsigned int user_modes[256] = 0, /* L */ 0, /* M */ 0, /* N */ - UMODE_GCHANOP, /* O */ + UMODE_GOD, /* O */ 0, /* P */ 0, /* Q */ UMODE_REGONLY, /* R */ -- cgit