summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-01 09:06:01 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-01 09:06:01 +0000
commit4a58d85d8dd5f120eb0d0c429e0b46cdeb25c629 (patch)
tree62f758761cd0b8b328e4ae36025b8a798f8ce604
parent14779e590564b1e1057121c1c68979b0df1cad15 (diff)
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
-rw-r--r--protocols/FacebookRM/src/chat.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.cpp9
-rw-r--r--protocols/FacebookRM/src/proto.h1
3 files changed, 9 insertions, 3 deletions
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);