summaryrefslogtreecommitdiff
path: root/src/modules/mysql/db_mysql_read.cpp
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-03-28 07:57:05 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-03-28 07:57:05 +0000
commitf4bcf833ecb4c139544bf6de5fadabca56e016e9 (patch)
tree16beb2e9a5aa055aebb1e8391207fff7000b68f6 /src/modules/mysql/db_mysql_read.cpp
parentaa90411f3ad2361db810a064906c2d8047a8ff92 (diff)
Finish rest of BotServ SQL stuff
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2839 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/modules/mysql/db_mysql_read.cpp')
-rw-r--r--src/modules/mysql/db_mysql_read.cpp74
1 files changed, 72 insertions, 2 deletions
diff --git a/src/modules/mysql/db_mysql_read.cpp b/src/modules/mysql/db_mysql_read.cpp
index 36c48b4eb..2cbcd669c 100644
--- a/src/modules/mysql/db_mysql_read.cpp
+++ b/src/modules/mysql/db_mysql_read.cpp
@@ -202,6 +202,33 @@ static void LoadDatabase()
}
}
+ query << "SELECT * FROM `anope_bs_info_metadata`";
+ qres = StoreQuery(query);
+
+ if (qres)
+ {
+ for (size_t i = 0; i < qres.num_rows(); ++i)
+ {
+ BotInfo *bi = findbot(SQLAssign(qres[i]["botname"]));
+ if (!bi)
+ {
+ Alog() << "MySQL: BotInfo metadata for nonexistant bot " << qres[i]["botname"];
+ continue;
+ }
+
+ try
+ {
+ EventReturn MOD_RESULT;
+ std::vector<std::string> Params = MakeVector(SQLAssign(qres[i]["value"]));
+ FOREACH_RESULT(I_OnDatabaseReadMetadata, OnDatabaseReadMetadata(bi, SQLAssign(qres[i]["name"]), Params));
+ }
+ catch (const char *err)
+ {
+ Alog() << "[db_mysql_read]: " << err;
+ }
+ }
+ }
+
query << "SELECT * FROM `anope_cs_info`";
qres = StoreQuery(query);
@@ -336,7 +363,7 @@ static void LoadDatabase()
if (!qres[i]["capspercent"].empty())
ci->capspercent = atoi(qres[i]["capspercent"].c_str());
if (!qres[i]["floodlines"].empty())
- ci->floodlines = atoi(qres[i]["capspercent"].c_str());
+ ci->floodlines = atoi(qres[i]["floodlines"].c_str());
if (!qres[i]["floodsecs"].empty())
ci->floodsecs = atoi(qres[i]["floodsecs"].c_str());
if (!qres[i]["repeattimes"].empty())
@@ -344,6 +371,49 @@ static void LoadDatabase()
}
}
+ query << "SELECT * FROM `anope_cs_ttb";
+ qres = StoreQuery(query);
+
+ if (qres)
+ {
+ for (size_t i = 0; i < qres.num_rows(); ++i)
+ {
+ ChannelInfo *ci = cs_findchan(SQLAssign(qres[i]["channel"]));
+ if (!ci)
+ {
+ Alog() << "MySQL: Channel ttb for nonexistant channel " << qres[i]["channel"];
+ continue;
+ }
+
+ ci->ttb[atoi(qres[i]["ttb_id"].c_str())] = atoi(qres[i]["value"].c_str());
+ }
+ }
+
+ query << "SELECT * FROM `anope_bs_badwords`";
+ qres = StoreQuery(query);
+
+ if (qres)
+ {
+ for (size_t i = 0; i < qres.num_rows(); ++i)
+ {
+ ChannelInfo *ci = cs_findchan(SQLAssign(qres[i]["channel"]));
+ if (!ci)
+ {
+ Alog() << "MySQL: Channel badwords entry for nonexistant channel " << qres[i]["channel"];
+ continue;
+ }
+
+ BadWordType BWTYPE = BW_ANY;
+ if (qres[i]["type"] == "SINGLE")
+ BWTYPE = BW_SINGLE;
+ else if (qres[i]["type"] == "START")
+ BWTYPE = BW_START;
+ else if (qres[i]["type"] == "END")
+ BWTYPE = BW_END;
+ ci->AddBadWord(SQLAssign(qres[i]["word"]), BWTYPE);
+ }
+ }
+
query << "SELECT * FROM `anope_cs_access`";
qres = StoreQuery(query);
@@ -395,7 +465,7 @@ static void LoadDatabase()
ChannelInfo *ci = cs_findchan(SQLAssign(qres[i]["channel"]));
if (!ci)
{
- Alog() << "MySQL: Channel level entry for nonexistant channel " << qres[i]["channel"];
+ Alog() << "MySQL: Channel metadata for nonexistant channel " << qres[i]["channel"];
continue;
}
try