diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 12 | ||||
-rw-r--r-- | src/commands/cmd_part.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_cycle.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_remove.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/svspart.cpp | 7 |
6 files changed, 14 insertions, 16 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index fbec272b3..47dfd91b6 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -485,15 +485,9 @@ bool Channel::IsExtBanned(User *user, char type) * * XXX: bleh, string copy of reason, fixme! -- w00t */ -long Channel::PartUser(User *user, const char* reason) +long Channel::PartUser(User *user, std::string &reason) { bool silent = false; - std::string freason; - - if (reason) - freason = reason; - else - freason = ""; if (!user) return this->GetUserCounter(); @@ -501,10 +495,10 @@ 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, freason, silent)); + FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason, silent)); if (!silent) - this->WriteChannel(user, "PART %s%s%s", this->name.c_str(), reason ? " :" : "", reason ? reason : ""); + this->WriteChannel(user, "PART %s%s%s", this->name.c_str(), reason.empty() ? "" : ":", reason.c_str()); user->chans.erase(i); this->RemoveAllPrefixes(user); diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp index 352b967b5..dcc50609b 100644 --- a/src/commands/cmd_part.cpp +++ b/src/commands/cmd_part.cpp @@ -47,8 +47,7 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User if (c) { - const char *rreason = reason.empty() ? NULL : reason.c_str(); - if (!c->PartUser(user, rreason)) + if (!c->PartUser(user, reason)) /* Arse, who stole our channel! :/ */ delete c; } diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 037e570f6..5b562631d 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -59,7 +59,7 @@ class CommandCycle : public Command } /* XXX in the future, this may move to a static Channel method (the delete.) -- w00t */ - if (!channel->PartUser(user, reason.c_str())) + if (!channel->PartUser(user, reason)) delete channel; Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 4dfa0bfb5..d35f1f8dd 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -180,7 +180,7 @@ class RemoveBase channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name.c_str(), user->nick.c_str(), target->nick.c_str()); target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick.c_str(), user->nick.c_str(), channel->name.c_str(), reasonparam.c_str()); - if (!channel->PartUser(target, reason.c_str())) + if (!channel->PartUser(target, reason)) delete channel; } else diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 1baabc463..f01cb1564 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -31,7 +31,7 @@ class CommandSapart : public Command { User* dest = ServerInstance->FindNick(parameters[0]); Channel* channel = ServerInstance->FindChan(parameters[1]); - std::string reason; + std::string reason = ""; if (dest && channel) { @@ -50,7 +50,7 @@ class CommandSapart : public Command */ if (IS_LOCAL(dest)) { - if (!channel->PartUser(dest, reason.empty() ? NULL : reason.c_str())) + if (!channel->PartUser(dest, reason)) delete channel; Channel* n = ServerInstance->FindChan(parameters[1]); diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp index 639792be9..bcb73741b 100644 --- a/src/modules/m_spanningtree/svspart.cpp +++ b/src/modules/m_spanningtree/svspart.cpp @@ -35,6 +35,11 @@ bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> if (params.size() < 2) return true; + std::string reason = "Services forced part"; + + if (params.size() == 3) + reason = params[2]; + User* u = this->Instance->FindNick(params[0]); Channel* c = this->Instance->FindChan(params[1]); @@ -42,7 +47,7 @@ bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> { /* only part if it's local, otherwise just pass it on! */ if (IS_LOCAL(u)) - if (!c->PartUser(u, "Services forced part")) + if (!c->PartUser(u, reason)) delete c; Utils->DoOneToAllButSender(prefix,"SVSPART",params,prefix); } |