From 4b2a6430d6aa6435665aadf2f1fae164d3a4af40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 21 Apr 2014 14:50:50 +0000 Subject: Facebook: Check if channel request got any data git-svn-id: http://svn.miranda-ng.org/main/trunk@9015 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/communication.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'protocols/FacebookRM/src') 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 -- cgit v1.2.3