Announcement protocol extension

This commit is contained in:
Matthew Incognito 2018-05-10 12:59:13 +01:00
parent b383a382eb
commit 22f642bb98
No known key found for this signature in database
GPG key ID: A09E643F541C0FC5
2 changed files with 21 additions and 0 deletions

View file

@ -222,6 +222,23 @@ bool Client::close()
return true;
}
bool Client::handleAnnouncement(const rapidjson::Value &params)
{
if (!params.IsObject())
{
return false;
}
if (params.HasMember("message"))
{
LOG_INFO("[%s] announcement: \"%s\"", m_pool.url(),
params["message"].GetString());
return true;
}
return false;
}
bool Client::isCriticalError(const char *message)
{
@ -588,6 +605,9 @@ void Client::parseNotification(const char *method, const rapidjson::Value &param
m_listener->onJobReceived(this, m_job);
}
return;
} else if (strcmp(method, "announcement") == 0) {
handleAnnouncement(params);
return;
}

View file

@ -84,6 +84,7 @@ private:
};
bool close();
bool handleAnnouncement(const rapidjson::Value &params);
bool isCriticalError(const char *message);
bool parseJob(const rapidjson::Value &params, int *code);
bool parseLogin(const rapidjson::Value &result, int *code);