diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-11 14:44:17 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-11 14:44:17 +0000 |
commit | 4e599dd4fbfe5abc0d60a05008344e35e6bc870d (patch) | |
tree | 1e9dd14e5ba82788428a43b5e0d8ab6c7725de7b /src | |
parent | 19331dee13bf1021873dc9d2e3d72b56870c499c (diff) |
Fix m_nopartmsg to work via API modification, involves a string copy that won't last too long. Compiles cleanly.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9953 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-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 |
10 files changed, 18 insertions, 12 deletions
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); |