summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-04-21 14:50:50 +0000
committerRobert Pösel <robyer@seznam.cz>2014-04-21 14:50:50 +0000
commit4b2a6430d6aa6435665aadf2f1fae164d3a4af40 (patch)
treed9da7273014ab324c6de14b6a965f22625f5645a /protocols/FacebookRM
parent3fd876c2f5fb89007eee0a05c604954e606a589c (diff)
Facebook: Check if channel request got any data
git-svn-id: http://svn.miranda-ng.org/main/trunk@9015 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/communication.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 901d731074..4f538f62a5 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -463,6 +463,8 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
case REQUEST_NOTIFICATIONS:
{
std::string action = "/ajax/notifications/get.php?__a=1&user=%s&time=0&version=2&__user=%s";
+ // TODO: use better format notifications request
+ // std::string action = "/ajax/notifications/client/get.php?__a=1&user=%s&time=0&version=2&__user=%s";
utils::text::replace_all(&action, "%s", self_.user_id);
return action;
}
@@ -1123,6 +1125,11 @@ bool facebook_client::channel()
// Get update
http::response resp = flap(REQUEST_MESSAGES_RECEIVE);
+ if (resp.data.empty()) {
+ // Something went wrong
+ return handle_error("channel");
+ }
+
std::string type = utils::text::source_get_value(&resp.data, 2, "\"t\":\"", "\"");
if (type == "continue" || type == "heartbeat") {
// Everything is OK, no new message received