0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-16 15:38:36 +02:00

TOPIC: strip channel topic colors here if configured, instead of in set_channel_topic()

This commit is contained in:
William Pitcock 2016-01-13 17:17:14 -06:00
parent e4af89f4d7
commit 633531a4aa
2 changed files with 8 additions and 5 deletions

View file

@ -43,7 +43,6 @@
#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;
@ -1159,9 +1158,6 @@ 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

@ -41,6 +41,7 @@
#include "packet.h" #include "packet.h"
#include "tgchange.h" #include "tgchange.h"
#include "logger.h" #include "logger.h"
#include "inline/stringops.h"
static int m_topic(struct Client *, struct Client *, int, const char **); static int m_topic(struct Client *, struct Client *, int, const char **);
static int ms_topic(struct Client *, struct Client *, int, const char **); static int ms_topic(struct Client *, struct Client *, int, const char **);
@ -123,10 +124,16 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
(!MyClient(source_p) || (!MyClient(source_p) ||
can_send(chptr, source_p, msptr))) can_send(chptr, source_p, msptr)))
{ {
char topic[TOPICLEN + 1];
char topic_info[USERHOST_REPLYLEN]; char topic_info[USERHOST_REPLYLEN];
rb_strlcpy(topic, parv[2], sizeof(topic));
rb_sprintf(topic_info, "%s!%s@%s", rb_sprintf(topic_info, "%s!%s@%s",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
set_channel_topic(chptr, parv[2], topic_info, rb_current_time());
if (ConfigChannel.strip_topic_colors)
strip_colour(topic);
set_channel_topic(chptr, topic, topic_info, rb_current_time());
sendto_server(client_p, chptr, CAP_TS6, NOCAPS, sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s TOPIC %s :%s", ":%s TOPIC %s :%s",