summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-30 10:54:41 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-30 10:54:41 +0000
commit7423c0fa346a9aee044f6fa8dc88f666f9092dc1 (patch)
tree3db777ef1a0caac2a2c330018a17e967017b001f /protocols
parenta1327f90bbf4278beb8874ba9e39dde455dade8b (diff)
Facebook: Added hidden option to open url's in different browser
It's unicode string with name "OpenUrlBrowser", value is path to browser, in account's branch. git-svn-id: http://svn.miranda-ng.org/main/trunk@9366 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/db.h15
-rw-r--r--protocols/FacebookRM/src/entities.h7
-rw-r--r--protocols/FacebookRM/src/proto.cpp21
-rw-r--r--protocols/FacebookRM/src/proto.h5
4 files changed, 38 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index bac57004c9..9f28ee4211 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -58,13 +58,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_KEY_MESSAGES_ON_OPEN "MessagesOnOpen"
#define FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT "MessagesOnOpenCount"
-#define FACEBOOK_KEY_POLL_RATE "PollRate" // [HIDDEN]
-#define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
-#define FACEBOOK_KEY_DISABLE_LOGOUT "DisableLogout" // [HIDDEN]
-#define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - en_US, cs_CZ, etc.
-#define FACEBOOK_KEY_LOCAL_TIMESTAMP_UNREAD "UseLocalTimestampUnread" // [HIDDEN] - 1 = use local timestamp for offline messages
-#define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode"
-#define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // [HIDDEN] - 0 = don't use real name as nickname, use nickname if possible
+#define FACEBOOK_KEY_POLL_RATE "PollRate" // [HIDDEN]
+#define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
+#define FACEBOOK_KEY_DISABLE_LOGOUT "DisableLogout" // [HIDDEN]
+#define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - en_US, cs_CZ, etc.
+#define FACEBOOK_KEY_LOCAL_TIMESTAMP_UNREAD "UseLocalTimestampUnread" // [HIDDEN] - 1 = use local timestamp for offline messages
+#define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode"
+#define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // [HIDDEN] - 0 = don't use real name as nickname, use nickname if possible
+#define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with
#define FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE "EventNotificationsEnable"
#define FACEBOOK_KEY_EVENT_FEEDS_ENABLE "EventFeedsEnable"
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h
index ba3573a106..a99479bdab 100644
--- a/protocols/FacebookRM/src/entities.h
+++ b/protocols/FacebookRM/src/entities.h
@@ -230,3 +230,10 @@ struct post_status_data {
FacebookProto *proto;
std::vector<wall_data*> walls;
};
+
+struct open_url
+{
+ open_url(TCHAR *browser, TCHAR *url) : browser(browser), url(url) {}
+ TCHAR *browser;
+ TCHAR *url;
+};
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index d97aa419e1..9a5fd73d02 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -751,6 +751,17 @@ MCONTACT FacebookProto::HContactFromAuthEvent(HANDLE hEvent)
return DbGetAuthEventContact(&dbei);
}
+void FacebookProto::OpenUrlThread(void *p) {
+ if (p == NULL)
+ return;
+
+ open_url *data = static_cast<open_url*>(p);
+
+ ShellExecute(NULL, _T("open"), data->browser, data->url, NULL, SW_SHOWDEFAULT);
+
+ delete data;
+}
+
void FacebookProto::OpenUrl(std::string url)
{
std::string::size_type pos = url.find(FACEBOOK_SERVER_DOMAIN);
@@ -775,7 +786,15 @@ void FacebookProto::OpenUrl(std::string url)
}
ptrT data( mir_utf8decodeT(url.c_str()));
- CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)data);
+
+ // Check if there is user defined browser for opening links
+ ptrT browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER));
+ if (browser != NULL)
+ // If so, use it to open this link
+ ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data));
+ else
+ // Or use Miranda's service
+ CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)data);
}
void FacebookProto::ReadNotificationWorker(void *p)
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index ea6c9d37eb..d669007f89 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -218,9 +218,10 @@ public:
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url);
void CheckAvatarChange(MCONTACT hContact, std::string image_url);
void ToggleStatusMenuItems(BOOL bEnable);
- void ParseSmileys(std::string message, MCONTACT hContact);
+ void ParseSmileys(std::string message, MCONTACT hContact);
+ void SaveName(MCONTACT hContact, const facebook_user *fbu);
void OpenUrl(std::string url);
- void SaveName(MCONTACT hContact, const facebook_user *fbu);
+ void __cdecl OpenUrlThread(void*);
// Handles, Locks
HGENMENU m_hMenuRoot, m_hMenuServicesRoot, m_hStatusMind;