summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/client.h2
-rw-r--r--protocols/FacebookRM/src/events.cpp10
-rw-r--r--protocols/FacebookRM/src/process.cpp29
-rw-r--r--protocols/FacebookRM/src/proto.h2
-rw-r--r--protocols/FacebookRM/src/requests/feeds.h4
-rw-r--r--protocols/FacebookRM/src/version.h2
6 files changed, 36 insertions, 13 deletions
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index 744d7cd578..6689fe8a4e 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -161,7 +161,7 @@ public:
}
__inline const char *__rev() {
- return "2509236"; // FIXME: Some version of communication protocol? This version is from 17.8.2016
+ return "2828561"; // FIXME: Some version of communication protocol? This version is from 12.2.2017
}
////////////////////////////////////////////////////////////
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index 4dce07fe7b..f46ad30d58 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -22,9 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, EventType type, std::string *url, std::string *notification_id, const char *icon)
+HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* text, MCONTACT contact, EventType type, std::string *url, std::string *notification_id, const char *icon)
{
- if (title == NULL || info == NULL)
+ if (title == NULL || text == NULL)
return NULL;
char name[256];
@@ -77,7 +77,7 @@ HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact,
POPUPDATACLASS pd = { sizeof(pd) };
pd.pwszTitle = title;
- pd.pwszText = info;
+ pd.pwszText = text;
pd.pszClassName = name;
pd.hContact = contact;
if (icon != NULL) {
@@ -97,12 +97,12 @@ HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact,
}
}
else {
- if (!Clist_TrayNotifyW(m_szModuleName, title, info, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000))
+ if (!Clist_TrayNotifyW(m_szModuleName, title, text, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000))
return NULL;
}
if (type == EVENT_CLIENT)
- MessageBox(NULL, info, title, MB_OK | MB_ICONERROR);
+ MessageBox(NULL, text, title, MB_OK | MB_ICONERROR);
return NULL;
}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 8780dd262e..f03a8906eb 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -543,7 +543,7 @@ void parseFeeds(const std::string &text, std::vector<facebook_newsfeed *> &news,
DWORD new_time = last_post_time;
- while ((pos = text.find("<div class=\"userContentWrapper", pos)) != std::string::npos && limit <= 25)
+ while ((pos = text.find("<div class=\"fbUserContent", pos)) != std::string::npos && limit <= 25)
{
std::string post = text.substr(pos, text.find("</form>", pos) - pos);
pos += 5;
@@ -551,6 +551,9 @@ void parseFeeds(const std::string &text, std::vector<facebook_newsfeed *> &news,
std::string post_header = utils::text::source_get_value(&post, 3, "<h5", ">", "</h5>");
std::string post_message = utils::text::source_get_value(&post, 3, " userContent\"", ">", "<form");
std::string post_link = utils::text::source_get_value(&post, 4, "</h5>", "<a", "href=\"", "\"");
+ if (post_link == "#") {
+ post_link = utils::text::source_get_value(&post, 5, "</h5>", "<a", "<a", "href=\"", "\"");
+ }
std::string post_time = utils::text::source_get_value(&post, 3, "</h5>", "<abbr", "</a>");
std::string time = utils::text::source_get_value(&post_time, 2, "data-utime=\"", "\"");
@@ -597,10 +600,26 @@ void parseFeeds(const std::string &text, std::vector<facebook_newsfeed *> &news,
utils::text::remove_html(
post_header.substr(pos2, post_header.length() - pos2))));
- // Strip "Translate" link
- pos2 = post_message.find("role=\"button\">");
+ // Strip "Translate" and other buttons
+ do {
+ pos2 = post_message.find("role=\"button\"");
+ if (pos2 != std::string::npos) {
+ pos2 = post_message.find(">", pos2);
+ if (pos2 != std::string::npos) {
+ std::string::size_type pos3 = post_message.find("</a>", pos2);
+ std::string tmp = post_message.substr(0, pos2);
+ if (pos3 != std::string::npos) {
+ tmp += post_message.substr(pos3, post_message.length() - pos3);
+ }
+ post_message = tmp;
+ }
+ }
+ } while (pos2 != std::string::npos);
+
+ // Strip "See more" link
+ pos2 = post_message.find("<span class=\"see_more_link_inner\">");
if (pos2 != std::string::npos) {
- post_message = post_message.substr(0, pos2 + 14);
+ post_message = post_message.substr(0, pos2);
}
// Process attachment (if present)
@@ -693,7 +712,7 @@ void FacebookProto::ProcessMemories(void *p)
HttpRequest *request = new MemoriesRequest(&facy);
http::response resp = facy.sendRequest(request);
- if (resp.code != HTTP_CODE_OK) {
+ if (resp.code != HTTP_CODE_OK || resp.data.empty()) {
facy.handle_error(__FUNCTION__);
return;
}
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 699de756cb..bcceed5864 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -261,6 +261,6 @@ public:
static void CALLBACK APC_callback(ULONG_PTR p);
// Information providing
- HWND NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, EventType type, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL);
+ HWND NotifyEvent(wchar_t* title, wchar_t* text, MCONTACT contact, EventType type, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL);
void ShowNotifications();
};
diff --git a/protocols/FacebookRM/src/requests/feeds.h b/protocols/FacebookRM/src/requests/feeds.h
index 729548b133..24d9836812 100644
--- a/protocols/FacebookRM/src/requests/feeds.h
+++ b/protocols/FacebookRM/src/requests/feeds.h
@@ -49,6 +49,10 @@ public:
<< "start_index=0"
<< "num_stories=20"
<< "last_section_header=0"
+ << "last_section_key=regular_story"
+ << "__af="
+ << "__be=-1"
+ << "__pc=PHASED:DEFAULT"
<< LONG_VALUE("timestamp", ::time(NULL))
<< CHAR_VALUE("__dyn", fc->__dyn())
<< CHAR_VALUE("__req", fc->__req())
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index 53755c373e..2465a65905 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 3
#define __RELEASE_NUM 1
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>