summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-01-08 12:41:01 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-01-08 12:41:01 +0100
commitd379dcab405bd4b0542e3c645a2de3c1a27832b8 (patch)
treeb67b9882cf5ea9df81599732362f71106edc17c6
parentade1500382366b0cf24147370aea0a3e5bbe50bf (diff)
Read uline state in spanningtree; remove ConfigReader::ulines
-rw-r--r--include/configreader.h4
-rw-r--r--src/commands/cmd_stats.cpp9
-rw-r--r--src/configreader.cpp13
-rw-r--r--src/modules/m_spanningtree/override_stats.cpp11
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp21
5 files changed, 28 insertions, 30 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 46b8c5365..e8c439933 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -474,10 +474,6 @@ class CoreExport ServerConfig
*/
std::string CustomVersion;
- /** List of u-lined servers
- */
- std::map<irc::string, bool> ulines;
-
/** If set to true, provide syntax hints for unknown commands
*/
bool SyntaxHints;
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 5aa608f14..411e9d5e1 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -149,15 +149,6 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
}
break;
- case 'U':
- {
- for(std::map<irc::string, bool>::iterator i = ServerInstance->Config->ulines.begin(); i != ServerInstance->Config->ulines.end(); ++i)
- {
- results.push_back(sn+" 248 "+user->nick+" U "+std::string(i->first.c_str()));
- }
- }
- break;
-
case 'P':
{
unsigned int idx = 0;
diff --git a/src/configreader.cpp b/src/configreader.cpp
index b1cc746df..2320a44b1 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -444,19 +444,6 @@ void ServerConfig::Fill()
else
ServerInstance->SE->Close(socktest);
}
- ConfigTagList tags = ConfTags("uline");
- for(ConfigIter i = tags.first; i != tags.second; ++i)
- {
- ConfigTag* tag = i->second;
- std::string server;
- if (!tag->readString("server", server))
- throw CoreException("<uline> tag missing server at " + tag->getTagLocation());
-
- if (ServerName == server)
- throw CoreException("Servers should not uline themselves (at " + tag->getTagLocation() + ")");
-
- ulines[assign(server)] = tag->getBool("silent");
- }
ReadXLine(this, "badip", "ipmask", ServerInstance->XLines->GetFactory("Z"));
ReadXLine(this, "badnick", "nick", ServerInstance->XLines->GetFactory("Q"));
diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp
index 9762ecf4e..bdfc6ef43 100644
--- a/src/modules/m_spanningtree/override_stats.cpp
+++ b/src/modules/m_spanningtree/override_stats.cpp
@@ -37,6 +37,17 @@ ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &r
}
return MOD_RES_DENY;
}
+ else if (statschar == 'U')
+ {
+ ConfigTagList tags = ServerInstance->Config->ConfTags("uline");
+ for (ConfigIter i = tags.first; i != tags.second; ++i)
+ {
+ std::string name = i->second->getString("server");
+ if (!name.empty())
+ results.push_back(ServerInstance->Config->ServerName+" 248 "+user->nick+" U "+name);
+ }
+ return MOD_RES_DENY;
+ }
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index ecde17261..b51c21db6 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -160,11 +160,24 @@ int TreeServer::QuitUsers(const std::string &reason)
void TreeServer::CheckULine()
{
uline = silentuline = false;
- std::map<irc::string, bool>::iterator it = ServerInstance->Config->ulines.find(GetName().c_str());
- if (it != ServerInstance->Config->ulines.end())
+
+ ConfigTagList tags = ServerInstance->Config->ConfTags("uline");
+ for (ConfigIter i = tags.first; i != tags.second; ++i)
{
- uline = true;
- silentuline = it->second;
+ ConfigTag* tag = i->second;
+ std::string server = tag->getString("server");
+ if (!strcasecmp(server.c_str(), GetName().c_str()))
+ {
+ if (this->IsRoot())
+ {
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Servers should not uline themselves (at " + tag->getTagLocation() + ")");
+ return;
+ }
+
+ uline = true;
+ silentuline = tag->getBool("silent");
+ break;
+ }
}
}