Make 5614c9e6f0b (opmod as fake statusmsg) optional

This adds a channel { ... } option, opmod_send_statusmsg, disabled by
default for compatibility reasons.
This commit is contained in:
Janik Kleinhoff 2018-02-27 22:49:13 +00:00 committed by Ed Kellett
parent 09bb659680
commit 04e5ed6c57
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC
7 changed files with 22 additions and 7 deletions

View file

@ -374,6 +374,7 @@ channel {
autochanmodes = "+nt";
displayed_usercount = 3;
strip_topic_colors = no;
opmod_send_statusmsg = no;
};
serverhide {

View file

@ -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;
};

View file

@ -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

View file

@ -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 }
};

View file

@ -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;

View file

@ -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;

View file

@ -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,