summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/events.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-05-20 13:26:29 +0000
committerRobert Pösel <robyer@seznam.cz>2013-05-20 13:26:29 +0000
commitb330de2b0bcf4d09a417c0ef154c3419b6930316 (patch)
tree962eb53ad945a1a26204f4f2d738bb94354d3d2b /protocols/FacebookRM/src/events.cpp
parent7e065653a2ffe78094357f6838a5c15ac0fda885 (diff)
Facebook: Marking notifications as read with right click on popup.
git-svn-id: http://svn.miranda-ng.org/main/trunk@4760 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/events.cpp')
-rw-r--r--protocols/FacebookRM/src/events.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index 73024741ee..229bdd2716 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -47,19 +47,21 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
switch(message)
{
case WM_COMMAND:
+ case WM_CONTEXTMENU:
{
- //Get the plugin data (we need the Popup service to do it)
+ // Get the plugin data (we need the Popup service to do it)
popup_data *data = (popup_data *)PUGetPluginData(hwnd);
- if (data != NULL)
- data->proto->OpenUrl(data->url);
+ if (data != NULL) {
+ if (!data->notification_id.empty())
+ ForkThread(&FacebookProto::ReadNotificationWorker, data->proto, new std::string(data->notification_id));
- // After a click, destroy popup
- PUDeletePopup(hwnd);
- } break;
+ if (message == WM_COMMAND && !data->url.empty())
+ data->proto->OpenUrl(data->url);
+ }
- case WM_CONTEXTMENU:
+ // After a click, destroy popup
PUDeletePopup(hwnd);
- break;
+ } break;
case UM_FREEPLUGINDATA:
{
@@ -76,7 +78,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return DefWindowProc(hwnd, message, wParam, lParam);
};
-void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url)
+void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url, std::string *notification_id)
{
int ret, timeout;
COLORREF colorBack = 0, colorText = 0;
@@ -148,8 +150,14 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD
pd.iSeconds = timeout;
pd.lchContact = contact;
pd.lchIcon = icon;
- if (url != NULL)
- pd.PluginData = new popup_data(this, *url);
+ if (url != NULL || notification_id != NULL) {
+ popup_data *data = new popup_data(this);
+ if (url != NULL)
+ data->url = *url;
+ if (notification_id != NULL)
+ data->notification_id = *notification_id;
+ pd.PluginData = data;
+ }
pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
lstrcpy(pd.lptzContactName, title);
lstrcpy(pd.lptzText, info);