summaryrefslogtreecommitdiff
path: root/src/bots.cpp
diff options
context:
space:
mode:
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())