From 04e5ed6c57154114cca330767e3bfb1006b46ee9 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Tue, 27 Feb 2018 22:49:13 +0000 Subject: [PATCH] Make 5614c9e6f0b (opmod as fake statusmsg) optional This adds a channel { ... } option, opmod_send_statusmsg, disabled by default for compatibility reasons. --- doc/ircd.conf.example | 1 + doc/reference.conf | 5 +++++ include/s_conf.h | 1 + ircd/newconf.c | 1 + ircd/s_conf.c | 1 + ircd/send.c | 14 +++++++------- modules/m_info.c | 6 ++++++ 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index dbe97c2b..40dbfe80 100644 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -374,6 +374,7 @@ channel { autochanmodes = "+nt"; displayed_usercount = 3; strip_topic_colors = no; + opmod_send_statusmsg = no; }; serverhide { diff --git a/doc/reference.conf b/doc/reference.conf index 72af5182..64270b46 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -837,6 +837,11 @@ channel { /* strip_topic_colors: whether or not color codes in TOPIC should be stripped. */ strip_topic_colors = no; + + /* opmod_send_statusmsg: format messages sent to ops due to +z + * as PRIVMSG @#channel when sent to clients. + */ + opmod_send_statusmsg = no; }; diff --git a/include/s_conf.h b/include/s_conf.h index fec5c8a8..94a3b8f7 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -273,6 +273,7 @@ struct config_channel_entry unsigned int autochanmodes; int displayed_usercount; int strip_topic_colors; + int opmod_send_statusmsg; }; struct config_server_hide diff --git a/ircd/newconf.c b/ircd/newconf.c index b69c3bfc..5d9bdf8f 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -2830,6 +2830,7 @@ static struct ConfEntry conf_channel_table[] = { "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL }, { "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount }, { "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors }, + { "opmod_send_statusmsg", CF_YESNO, NULL, 0, &ConfigChannel.opmod_send_statusmsg }, { "\0", 0, NULL, 0, NULL } }; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 20211851..33077c1f 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -804,6 +804,7 @@ set_default_conf(void) ConfigChannel.channel_target_change = true; ConfigChannel.disable_local_channels = false; ConfigChannel.displayed_usercount = 3; + ConfigChannel.opmod_send_statusmsg = false; ConfigChannel.autochanmodes = MODE_TOPICLIMIT | MODE_NOPRIVMSGS; diff --git a/ircd/send.c b/ircd/send.c index 1ecddab7..d2a92d16 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -598,22 +598,23 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p, build_msgbuf_tags(&msgbuf, source_p); current_serial++; + const char *statusmsg_prefix = (ConfigChannel.opmod_send_statusmsg ? "@" : ""); if(IsServer(source_p)) { msgbuf_cache_initf(&msgbuf_cache, &msgbuf, &strings, - ":%s %s @%s :", - source_p->name, command, chptr->chname); + ":%s %s %s%s :", + source_p->name, command, statusmsg_prefix, chptr->chname); } else { msgbuf_cache_initf(&msgbuf_cache, &msgbuf, &strings, - ":%s!%s@%s %s @%s :", + ":%s!%s@%s %s %s%s :", source_p->name, source_p->username, - source_p->host, command, chptr->chname); + source_p->host, command, statusmsg_prefix, chptr->chname); } if (chptr->mode.mode & MODE_MODERATED) { linebuf_put_msgf(&rb_linebuf_old, &strings, - ":%s %s @%s :", - use_id(source_p), command, chptr->chname, text); + ":%s %s %s%s :", + use_id(source_p), command, statusmsg_prefix, chptr->chname, text); } else { linebuf_put_msgf(&rb_linebuf_old, &strings, ":%s NOTICE @%s :<%s:%s> ", @@ -623,7 +624,6 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p, linebuf_put_msgf(&rb_linebuf_new, &strings, ":%s %s =%s :", use_id(source_p), command, chptr->chname); - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head) { msptr = ptr->data; diff --git a/modules/m_info.c b/modules/m_info.c index d3c8e8c0..fa930084 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -632,6 +632,12 @@ static struct InfoStruct info_table[] = { &ConfigChannel.resv_forcepart, "Force-part local users on channel RESV" }, + { + "opmod_send_statusmsg", + OUTPUT_BOOLEAN_YN, + &ConfigChannel.opmod_send_statusmsg, + "Send messages to @#channel if affected by +z" + }, { "disable_hidden", OUTPUT_BOOLEAN_YN,