From 4a58d85d8dd5f120eb0d0c429e0b46cdeb25c629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 1 Dec 2014 09:06:01 +0000 Subject: Facebook: Respect chosen website option for newsfeed links (fixes #843) git-svn-id: http://svn.miranda-ng.org/main/trunk@11190 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/chat.cpp | 2 +- protocols/FacebookRM/src/proto.cpp | 9 +++++++-- protocols/FacebookRM/src/proto.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'protocols/FacebookRM/src') diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 618b86f85e..b1c32e0ce2 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -428,7 +428,7 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat return; std::stringstream text; - text << notification->text << "\n\n" << notification->link; + text << notification->text << "\n\n" << PrepareUrl(notification->link); std::string smessage = text.str(); utils::text::replace_all(&smessage, "%", "%%"); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 9cd807d96c..463b7c1e89 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -817,8 +817,7 @@ void FacebookProto::OpenUrlThread(void *p) { delete data; } -void FacebookProto::OpenUrl(std::string url) -{ +std::string FacebookProto::PrepareUrl(std::string url) { std::string::size_type pos = url.find(FACEBOOK_SERVER_DOMAIN); bool isFacebookUrl = (pos != std::string::npos); bool isRelativeUrl = (url.substr(0, 4) != "http"); @@ -840,6 +839,12 @@ void FacebookProto::OpenUrl(std::string url) url = (useHttps ? HTTP_PROTO_SECURE : HTTP_PROTO_REGULAR) + facy.get_server_type() + url; } + return url; +} + +void FacebookProto::OpenUrl(std::string url) +{ + url = PrepareUrl(url); ptrT data( mir_utf8decodeT(url.c_str())); // Check if there is user defined browser for opening links diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index fc869b581c..8f85582ca6 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -237,6 +237,7 @@ public: void ToggleStatusMenuItems(BOOL bEnable); void StickerAsSmiley(std::string stickerId, const std::string &url, MCONTACT hContact); void SaveName(MCONTACT hContact, const facebook_user *fbu); + std::string PrepareUrl(std::string url); void OpenUrl(std::string url); void __cdecl OpenUrlThread(void*); void MessageRead(MCONTACT hContact); -- cgit v1.2.3