summaryrefslogtreecommitdiff
path: root/src/core/db_plain.cpp
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-02 08:20:59 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-02 08:20:59 +0000
commita819cb0cc0f54a042a088dfba9c1f6b817928641 (patch)
tree7931a9d81367c184ca2550a1819ef685e3e0c927 /src/core/db_plain.cpp
parent3617d7978899f830d952d9bac70ed14bb0cc0fd6 (diff)
Rewrote the vhost code, and moved it to be part of nickalias instead of in its own list. This also fixes being able to steal other users vhosts with /hs on
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2724 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/db_plain.cpp')
-rw-r--r--src/core/db_plain.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp
index 4648378a8..5862e679c 100644
--- a/src/core/db_plain.cpp
+++ b/src/core/db_plain.cpp
@@ -63,8 +63,10 @@ static void ReadDatabase(Module *m = NULL)
if (buf[0] == ':')
{
buf.erase(buf.begin());
- if (!buf.empty())
+ if (!buf.empty() && !sep.StreamEnd())
params.push_back(buf + " " + sep.GetRemaining());
+ else if (!buf.empty())
+ params.push_back(buf);
}
else
params.push_back(buf);
@@ -457,15 +459,6 @@ static void LoadChanInfo(const std::vector<std::string> &params)
alog("[db_plain]: loaded channel %s", ci->name);
}
-static void LoadHostInfo(const std::vector<std::string> &params)
-{
- if (!findnick(params[0].c_str()))
- return;
- addHostCore(params[0].c_str(), params[4].empty() ? NULL : const_cast<char *>(params[4].c_str()), const_cast<char *>(params[3].c_str()), params[1].c_str(), strtol(params[2].c_str(), NULL, 10)); // XXX
- if (debug > 1)
- alog("[db_plain]: loaded vhost for %s", params[0].c_str());
-}
-
static void LoadOperInfo(const std::vector<std::string> &params)
{
if (params[0] == "STATS")
@@ -538,8 +531,6 @@ class DBPlain : public Module
LoadBotInfo(otherparams);
else if (key == "CH")
LoadChanInfo(otherparams);
- else if (key == "HI")
- LoadHostInfo(otherparams);
else if (key == "OS")
LoadOperInfo(otherparams);
@@ -617,6 +608,10 @@ class DBPlain : public Module
na->SetFlag(NS_NO_EXPIRE);
}
}
+ else if (key == "VHOST")
+ {
+ na->hostinfo.SetVhost(params.size() > 3 ? params[3] : "", params[2], params[0], strtol(params[1].c_str(), NULL, 10));
+ }
return EVENT_CONTINUE;
}
@@ -927,6 +922,10 @@ class DBPlain : public Module
{
db << "MD FLAGS" << (na->HasFlag(NS_FORBIDDEN) ? " FORBIDDEN" : "") << (na->HasFlag(NS_NO_EXPIRE) ? " NOEXPIRE " : "") << endl;
}
+ if (na->hostinfo.HasVhost())
+ {
+ db << "MD VHOST " << na->hostinfo.GetCreator() << " " << na->hostinfo.GetTime() << " " << na->hostinfo.GetHost() << " :" << na->hostinfo.GetIdent() << endl;
+ }
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, na));
}
@@ -1083,12 +1082,6 @@ class DBPlain : public Module
}
}
- HostCore *hc;
- for (hc = hostCoreListHead(); hc; hc = hc->next)
- {
- db << "HI " << hc->nick << " " << hc->creator << " " << hc->time << " " << hc->vHost << " :" << hc->vIdent << endl;
- }
-
for (i = 0; i < akills.count; ++i)
{
Akill *ak = static_cast<Akill *>(akills.list[i]);