From 87e96d6f528fd38aef754c3a1f5d837d2ad67614 Mon Sep 17 00:00:00 2001 From: Adam- Date: Thu, 15 Apr 2010 17:36:23 +0000 Subject: [PATCH] Fixed bug #1153 - Always save channel topics internally, even if the new topic matches the last saved topic. Also only call the topic updated event once we are uplinked, as then the topic really is being changed by someone. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/stable@2896 5417fbe8-f217-4b02-8779-1006273d7864 --- src/channels.c | 19 +++++++++++++++---- version.log | 3 ++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/channels.c b/src/channels.c index aa7ed4712..3a038cab4 100644 --- a/src/channels.c +++ b/src/channels.c @@ -1274,10 +1274,18 @@ void do_topic(const char *source, int ac, char **av) /* If the current topic we have matches the last known topic for this * channel exactly, there's no need to update anything and we can as * well just return silently without updating anything. -GD + * But we still need to update the topic internally for the channel - Adam */ if ((ac > 3) && *av[3] && ci && ci->last_topic && (strcmp(av[3], ci->last_topic) == 0) && (strcmp(topicsetter, ci->last_topic_setter) == 0)) { + + if (c->topic) + free(c->topic); + c->topic = sstrdup(av[3]); + strscpy(c->topic_setter, topicsetter, sizeof(c->topic_setter)); + c->topic_time = topic_time; + free(topicsetter); return; } @@ -1301,10 +1309,13 @@ void do_topic(const char *source, int ac, char **av) record_topic(av[0]); - if (ci && ci->last_topic) { - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ci->last_topic); - } else { - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); + /* Only call events if we are synced with the uplink */ + if (serv_uplink && is_sync(serv_uplink)) { + if (ci && ci->last_topic) { + send_event(EVENT_TOPIC_UPDATED, 2, av[0], ci->last_topic); + } else { + send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); + } } } diff --git a/version.log b/version.log index 00982edd8..f87a4c79b 100644 --- a/version.log +++ b/version.log @@ -9,9 +9,10 @@ VERSION_MAJOR="1" VERSION_MINOR="8" VERSION_PATCH="4" VERSION_EXTRA="-svn" -VERSION_BUILD="2895" +VERSION_BUILD="2896" # $Log$ # Changes since the 1.8.4 Release +#Revision 2896 - Fixed bug #1153 - Always save channel topics internally, even if the new topic matches the last saved topic #Revision 2895 - Fixed bug #1154 - Fixed a potential crash in cs_clear ops #Revision 2894 - Check if a command routine exists before all command calls #Revision 2893 - Closed a forgotten file pointer in os_info that would make Windows backups of os_info.db fail