summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h2
-rw-r--r--src/channels.cpp7
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp5
-rw-r--r--src/users.cpp53
4 files changed, 30 insertions, 37 deletions
diff --git a/include/channels.h b/include/channels.h
index bf025ec56..940b9b555 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -344,7 +344,7 @@ class CoreExport Channel : public Extensible
* @return The number of users left on the channel. If this is zero
* when the method returns, you MUST delete the Channel immediately!
*/
- long ServerKickUser(User* user, const char* reason, bool triggerevents);
+ long ServerKickUser(User* user, const char* reason, bool triggerevents, const char* servername = NULL);
/** Part a user from this channel with the given reason.
* If the reason field is NULL, no reason will be sent.
diff --git a/src/channels.cpp b/src/channels.cpp
index 49c289784..effc47d73 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -523,7 +523,7 @@ long Channel::PartUser(User *user, const char* reason)
return this->GetUserCounter();
}
-long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents)
+long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents, const char* servername)
{
bool silent = false;
@@ -539,6 +539,9 @@ long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents)
}
}
+ if (servername == NULL)
+ servername = ServerInstance->Config->ServerName;
+
if (triggerevents)
{
FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent));
@@ -548,7 +551,7 @@ long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents)
if (i != user->chans.end())
{
if (!silent)
- this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
+ this->WriteChannelWithServ(servername, "KICK %s %s :%s", this->name, user->nick, reason);
user->chans.erase(i);
this->RemoveAllPrefixes(user);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 67e235e0a..c99402af0 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -452,11 +452,12 @@ bool TreeSocket::ProcessLine(std::string &line)
{
if (params.size() == 3)
{
+ TreeServer* pf = Utils->FindServer(prefix);
User* user = this->Instance->FindNick(params[1]);
Channel* chan = this->Instance->FindChan(params[0]);
- if (user && chan)
+ if (pf && user && chan)
{
- if (!chan->ServerKickUser(user, params[2].c_str(), false))
+ if (!chan->ServerKickUser(user, params[2].c_str(), false, pf->GetName().c_str()))
/* Yikes, the channels gone! */
delete chan;
}
diff --git a/src/users.cpp b/src/users.cpp
index 0ece0aadd..0dfe54f65 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -989,46 +989,35 @@ void User::InvalidateCache()
bool User::ForceNickChange(const char* newnick)
{
- /*
- * XXX this makes no sense..
- * why do we do nothing for change on users not REG_ALL?
- * why do we trigger events twice for everyone previously (and just them now)
- * i think the first if () needs removing totally, or? -- w00t
- */
- if (this->registered != REG_ALL)
- {
- int MOD_RESULT = 0;
+ int MOD_RESULT = 0;
- this->InvalidateCache();
+ this->InvalidateCache();
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
- if (MOD_RESULT)
- {
- ServerInstance->stats->statsCollisions++;
- return false;
- }
+ if (MOD_RESULT)
+ {
+ ServerInstance->stats->statsCollisions++;
+ return false;
+ }
- if (ServerInstance->XLines->MatchesLine("Q",newnick))
- {
- ServerInstance->stats->statsCollisions++;
- return false;
- }
+ if (ServerInstance->XLines->MatchesLine("Q",newnick))
+ {
+ ServerInstance->stats->statsCollisions++;
+ return false;
}
- else
+
+ std::deque<classbase*> dummy;
+ Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
+ if (nickhandler) // wtfbbq, when would this not be here
{
- std::deque<classbase*> dummy;
- Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
- if (nickhandler) // wtfbbq, when would this not be here
- {
- nickhandler->HandleInternal(1, dummy);
- bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
- nickhandler->HandleInternal(0, dummy);
- return result;
- }
+ nickhandler->HandleInternal(1, dummy);
+ bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
+ nickhandler->HandleInternal(0, dummy);
+ return result;
}
- // Unreachable.
+ // Unreachable, we hope
return false;
}