summaryrefslogtreecommitdiff
path: root/src/bots.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
committerAdam <Adam@anope.org>2011-09-25 04:19:15 -0400
commit1f2399de364c09adcce4193895cd362d80ffdfc5 (patch)
tree5f40fc531f22c174b6e10bb7bc12842a4a21d30b /src/bots.cpp
parent43201ead9575a74e350710bc191f4ac67366aca7 (diff)
Added a new database format and sqlite support. Also moved db-convert to a module.
Diffstat (limited to 'src/bots.cpp')
-rw-r--r--src/bots.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index 390fc6a69..928dcb2c1 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -64,6 +64,29 @@ BotInfo::~BotInfo()
BotListByUID.erase(this->uid);
}
+SerializableBase::serialized_data BotInfo::serialize()
+{
+ SerializableBase::serialized_data data;
+
+ data["nick"] << this->nick;
+ data["user"] << this->ident;
+ data["host"] << this->host;
+ data["realname"] << this->realname;
+ data["created"] << this->created;
+ data["chancount"] << this->chancount;
+
+ return data;
+}
+
+void BotInfo::unserialize(SerializableBase::serialized_data &data)
+{
+ BotInfo *bi = findbot(data["nick"].astr());
+ if (bi == NULL)
+ bi = new BotInfo(data["nick"].astr(), data["user"].astr(), data["host"].astr(), data["realname"].astr());
+ data["created"] >> bi->created;
+ data["chancount"] >> bi->chancount;
+}
+
void BotInfo::GenerateUID()
{
if (!this->uid.empty())