diff options
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | src/channels.cpp | 10 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_auditorium.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_foobar.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_invisible.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nopartmsg.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 2 |
11 files changed, 20 insertions, 14 deletions
diff --git a/include/modules.h b/include/modules.h index 7ae620752..ca331e334 100644 --- a/include/modules.h +++ b/include/modules.h @@ -498,11 +498,11 @@ class CoreExport Module : public Extensible * and the details of the channel they have left is available in the variable Channel *channel * @param user The user who is parting * @param channel The channel being parted - * @param partmessage The part message, or an empty string + * @param partmessage The part message, or an empty string (may be modified) * @param silent Change this to true if you want to conceal the PART command from the other users * of the channel (useful for modules such as auditorium) */ - virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent); + virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); /** Called on rehash. * This method is called prior to a /REHASH or when a SIGHUP is received from the operating diff --git a/src/channels.cpp b/src/channels.cpp index 219979dc9..fbec272b3 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -482,10 +482,18 @@ bool Channel::IsExtBanned(User *user, char type) /* Channel::PartUser * remove a channel from a users record, and return the number of users left. * Therefore, if this function returns 0 the caller should delete the Channel. + * + * XXX: bleh, string copy of reason, fixme! -- w00t */ long Channel::PartUser(User *user, const char* reason) { bool silent = false; + std::string freason; + + if (reason) + freason = reason; + else + freason = ""; if (!user) return this->GetUserCounter(); @@ -493,7 +501,7 @@ long Channel::PartUser(User *user, const char* reason) UCListIter i = user->chans.find(this); if (i != user->chans.end()) { - FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : "", silent)); + FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, freason, silent)); if (!silent) this->WriteChannel(user, "PART %s%s%s", this->name.c_str(), reason ? " :" : "", reason ? reason : ""); diff --git a/src/modules.cpp b/src/modules.cpp index 0867390fd..e25f4bf10 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -111,7 +111,7 @@ void Module::OnUserQuit(User*, const std::string&, const std::string&) { } void Module::OnUserDisconnect(User*) { } void Module::OnUserJoin(User*, Channel*, bool, bool&) { } void Module::OnPostJoin(User*, Channel*) { } -void Module::OnUserPart(User*, Channel*, const std::string&, bool&) { } +void Module::OnUserPart(User*, Channel*, std::string&, bool&) { } void Module::OnRehash(User*, const std::string&) { } void Module::OnServerRaw(std::string&, bool, User*) { } int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return 0; } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index cba99d471..c1da8ca8c 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -126,7 +126,7 @@ class ModuleAuditorium : public Module } } - void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) + void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent) { if (channel->IsModeSet('u')) { diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index cd84d9c5f..014590745 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -329,7 +329,7 @@ class ModuleChanProtect : public Module user->Shrink("cm_protect_"+std::string(chan->name)); } - virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent) + virtual void OnUserPart(User* user, Channel* channel, std::string &partreason, bool &silent) { // FIX: when someone parts a channel we must remove their Extensibles! user->Shrink("cm_founder_"+std::string(channel->name)); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index f8a1d0e9f..6b6f0c5a1 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -117,7 +117,7 @@ class ModuleDelayJoin : public Module } } - void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) + void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent) { if (channel->IsModeSet('D')) { diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index 7a8ac8e32..1f8d0c3bd 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -77,7 +77,7 @@ class ModuleFoobar : public Module ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" joined "+c); } - virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent) + virtual void OnUserPart(User* user, Channel* channel, std::string &partreason, bool &silent) { // method called when a user parts a channel diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 999151f79..f8aae9cb5 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -205,7 +205,7 @@ class ModuleInvisible : public Module conf = new ConfigReader(ServerInstance); } - void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) + void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent) { if (user->IsModeSet('Q')) { diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 648626a23..46b79b51f 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -35,15 +35,13 @@ class ModulePartMsgBan : public Module } - virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) + virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent) { if (!IS_LOCAL(user)) return; -#if 0 if (channel->IsExtBanned(user, 'p')) partmessage = ""; -#endif return; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 9688cfb7d..91c13e559 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -610,7 +610,7 @@ void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos) Utils->DoOneToMany(user->uuid,"FNAME",params); } -void ModuleSpanningTree::OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent) +void ModuleSpanningTree::OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent) { if (IS_LOCAL(user)) { diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index f62b9e779..98294b9fd 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -160,7 +160,7 @@ class ModuleSpanningTree : public Module virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent); virtual void OnChangeHost(User* user, const std::string &newhost); virtual void OnChangeName(User* user, const std::string &gecos); - virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent); + virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); virtual void OnUserPostNick(User* user, const std::string &oldnick); virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent); |