diff options
-rw-r--r-- | include/modules.h | 6 | ||||
-rw-r--r-- | src/channels.cpp | 5 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/include/modules.h b/include/modules.h index fdc6e35b2..4af979118 100644 --- a/include/modules.h +++ b/include/modules.h @@ -423,7 +423,7 @@ enum Implementation I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, - I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, + I_OnPostTopicChange, I_OnEvent, I_OnRequest, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncNetwork, I_OnSetAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin, @@ -1219,13 +1219,13 @@ class CoreExport Module : public Extensible */ virtual ModResult OnLocalTopicChange(User* user, Channel* chan, const std::string &topic); - /** Called whenever a local topic has been changed. + /** Called whenever a topic has been changed. * To block topic changes you must use OnLocalTopicChange instead. * @param user The user changing the topic * @param chan The channels who's topic is being changed * @param topic The actual topic text */ - virtual void OnPostLocalTopicChange(User* user, Channel* chan, const std::string &topic); + virtual void OnPostTopicChange(User* user, Channel* chan, const std::string &topic); /** Called whenever an Event class is sent to all module by another module. * Please see the documentation of Event::Send() for further information. The Event sent can diff --git a/src/channels.cpp b/src/channels.cpp index b53f780e6..e559f399f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -104,9 +104,10 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) this->topicset = ServerInstance->Time(); - if (u && IS_LOCAL(u)) + // XXX: this check for 'u' is probably pre-fake-user, and it fucking sucks anyway. we need to change this. + if (u) { - FOREACH_MOD(I_OnPostLocalTopicChange,OnPostLocalTopicChange(u, this, this->topic)); + FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic)); } return CMD_SUCCESS; diff --git a/src/modules.cpp b/src/modules.cpp index cec146f76..fe7f3fb02 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -168,7 +168,7 @@ void Module::OnUserMessage(User*, void*, int, const std::string&, char, const C void Module::OnUserNotice(User*, void*, int, const std::string&, char, const CUList&) { } void Module::OnRemoteKill(User*, User*, const std::string&, const std::string&) { } void Module::OnUserInvite(User*, User*, Channel*, time_t) { } -void Module::OnPostLocalTopicChange(User*, Channel*, const std::string&) { } +void Module::OnPostTopicChange(User*, Channel*, const std::string&) { } void Module::OnGetServerDescription(const std::string&, std::string&) { } void Module::OnSyncUser(User*, Module*, void*) { } void Module::OnSyncChannel(Channel*, Module*, void*) { } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index e074f71ef..726b0713e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -45,7 +45,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) Implementation eventlist[] = { - I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange, + I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange, I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin, I_OnChangeLocalUserHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule, I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash, @@ -446,8 +446,12 @@ void ModuleSpanningTree::OnUserInvite(User* source,User* dest,Channel* channel, } } -void ModuleSpanningTree::OnPostLocalTopicChange(User* user, Channel* chan, const std::string &topic) +void ModuleSpanningTree::OnPostTopicChange(User* user, Channel* chan, const std::string &topic) { + // Drop remote events on the floor. + if (!IS_LOCAL(user)) + return; + parameterlist params; params.push_back(chan->name); params.push_back(":"+topic); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 2a7248f48..04f281b28 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -162,7 +162,7 @@ class ModuleSpanningTree : public Module virtual void OnGetServerDescription(const std::string &servername,std::string &description); virtual void OnUserConnect(User* source); virtual void OnUserInvite(User* source,User* dest,Channel* channel, time_t); - virtual void OnPostLocalTopicChange(User* user, Channel* chan, const std::string &topic); + virtual void OnPostTopicChange(User* user, Channel* chan, const std::string &topic); virtual void OnWallops(User* user, const std::string &text); virtual void OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list); virtual void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list); |