summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp15
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp10
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp5
4 files changed, 25 insertions, 9 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 8d8a51ede..8c04d6c90 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -63,6 +63,7 @@ void ModuleSpanningTree::init()
delete ServerInstance->PI;
ServerInstance->PI = new SpanningTreeProtocolInterface;
loopCall = false;
+ SplitInProgress = false;
// update our local user count
Utils->TreeRoot->UserCount = ServerInstance->Users->local_users.size();
@@ -547,13 +548,25 @@ void ModuleSpanningTree::OnUserPart(Membership* memb, std::string &partmessage,
void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
{
- if ((IS_LOCAL(user)) && (user->registered == REG_ALL))
+ if (IS_LOCAL(user))
{
if (oper_message != reason)
ServerInstance->PI->SendMetaData(user, "operquit", oper_message);
CmdBuilder(user, "QUIT").push_last(reason).Broadcast();
}
+ else
+ {
+ // Hide the message if one of the following is true:
+ // - User is being quit due to a netsplit and quietbursts is on
+ // - Server is a silent uline
+ bool hide = (((this->SplitInProgress) && (Utils->quiet_bursts)) || (ServerInstance->SilentULine(user->server)));
+ if (!hide)
+ {
+ ServerInstance->SNO->WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]",
+ user->server.c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str());
+ }
+ }
// Regardless, We need to modify the user Counts..
TreeServer* SourceServer = Utils->FindServer(user->server);
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index c275207bf..bef94a53b 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -73,6 +73,10 @@ class ModuleSpanningTree : public Module
*/
bool loopCall;
+ /** True if users are quitting due to a netsplit
+ */
+ bool SplitInProgress;
+
/** Constructor
*/
ModuleSpanningTree();
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 8af3e777d..2fce9a504 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -139,7 +139,7 @@ void TreeServer::FinishBurst()
int TreeServer::QuitUsers(const std::string &reason)
{
- const char* reason_s = reason.c_str();
+ std::string publicreason = ServerInstance->Config->HideSplits ? "*.net *.split" : reason;
std::vector<User*> time_to_die;
for (user_hash::iterator n = ServerInstance->Users->clientlist->begin(); n != ServerInstance->Users->clientlist->end(); n++)
{
@@ -153,13 +153,7 @@ int TreeServer::QuitUsers(const std::string &reason)
User* a = (User*)*n;
if (!IS_LOCAL(a))
{
- if (Utils->quiet_bursts)
- a->quietquit = true;
-
- if (ServerInstance->Config->HideSplits)
- ServerInstance->Users->QuitUser(a, "*.net *.split", reason_s);
- else
- ServerInstance->Users->QuitUser(a, reason_s);
+ ServerInstance->Users->QuitUser(a, publicreason, &reason);
}
}
return time_to_die.size();
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 3c838177d..fa8a94f72 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -192,7 +192,12 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason)
int num_lost_servers = 0;
int num_lost_users = 0;
std::string from = Current->GetParent()->GetName()+" "+Current->GetName();
+
+ ModuleSpanningTree* st = Utils->Creator;
+ st->SplitInProgress = true;
SquitServer(from, Current, num_lost_servers, num_lost_users);
+ st->SplitInProgress = false;
+
ServerInstance->SNO->WriteToSnoMask(LocalSquit ? 'l' : 'L', "Netsplit complete, lost \002%d\002 user%s on \002%d\002 server%s.",
num_lost_users, num_lost_users != 1 ? "s" : "", num_lost_servers, num_lost_servers != 1 ? "s" : "");
Current->Tidy();