ircd: channel: implement an option to strip color codes from channel topics

This commit is contained in:
William Pitcock 2016-01-13 17:03:40 -06:00
parent b4e3861bf9
commit 14482679ce
5 changed files with 10 additions and 0 deletions

View file

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

View file

@ -822,6 +822,9 @@ channel {
* such as LIST >0. * such as LIST >0.
*/ */
displayed_usercount = 3; displayed_usercount = 3;
/* strip_topic_colors: whether or not color codes in TOPIC should be stripped. */
strip_topic_colors = no;
}; };

View file

@ -263,6 +263,7 @@ struct config_channel_entry
int disable_local_channels; int disable_local_channels;
unsigned int autochanmodes; unsigned int autochanmodes;
int displayed_usercount; int displayed_usercount;
int strip_topic_colors;
}; };
struct config_server_hide struct config_server_hide

View file

@ -43,6 +43,7 @@
#include "logger.h" #include "logger.h"
#include "ipv4_from_ipv6.h" #include "ipv4_from_ipv6.h"
#include "s_assert.h" #include "s_assert.h"
#include "inline/stringops.h"
struct config_channel_entry ConfigChannel; struct config_channel_entry ConfigChannel;
rb_dlink_list global_channel_list; rb_dlink_list global_channel_list;
@ -1158,6 +1159,9 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in
rb_strlcpy(chptr->topic, topic, TOPICLEN + 1); rb_strlcpy(chptr->topic, topic, TOPICLEN + 1);
rb_strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN); rb_strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN);
chptr->topic_time = topicts; chptr->topic_time = topicts;
if (ConfigChannel.strip_topic_colors)
strip_colour(chptr->topic);
} }
else else
{ {

View file

@ -2456,6 +2456,7 @@ static struct ConfEntry conf_channel_table[] =
{ "disable_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.disable_local_channels }, { "disable_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.disable_local_channels },
{ "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL }, { "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL },
{ "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount }, { "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount },
{ "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors },
{ "\0", 0, NULL, 0, NULL } { "\0", 0, NULL, 0, NULL }
}; };