diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-02-07 08:43:46 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-02-07 08:43:46 +0000 |
commit | 510e81b5dcee4b7655f350bc8fdcb7539d65b7a4 (patch) | |
tree | 36ee8fc5a1302225ce0d66e1f2bc772070c891ca /protocols/FacebookRM | |
parent | 18dd9c187ce62463f30e4009450dd643c65e2514 (diff) |
Facebook: Separate (add new type) "Friendship changes" notifications from "Other notifications"
git-svn-id: http://svn.miranda-ng.org/main/trunk@12034 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/res/facebook.rc | 24 | ||||
-rw-r--r-- | protocols/FacebookRM/src/constants.h | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/contacts.cpp | 10 | ||||
-rw-r--r-- | protocols/FacebookRM/src/db.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/dialogs.cpp | 3 | ||||
-rw-r--r-- | protocols/FacebookRM/src/events.cpp | 11 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 14 | ||||
-rw-r--r-- | protocols/FacebookRM/src/resource.h | 1 |
10 files changed, 53 insertions, 23 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index 6a55a18f9e..f7f589d583 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -130,19 +130,20 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "Event notifications",IDC_STATIC,6,7,292,106
+ GROUPBOX "Event notifications",IDC_STATIC,6,7,292,113
CONTROL "Notifications",IDC_NOTIFICATIONS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,23,272,8
CONTROL "News feeds (WARNING: Causes excessive network traffic!)",IDC_FEEDS_ENABLE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,39,272,8
- RTEXT "News feed types to notify:",IDC_STATIC,26,51,117,8
- COMBOBOX IDC_FEED_TYPE,150,49,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Don't show advertising posts",IDC_FILTER_ADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,67,138,8
- CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,79,272,8
- CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,272,8
- RTEXT "Use this server for opening links:",IDC_STATIC,13,123,139,8
- COMBOBOX IDC_URL_SERVER,156,120,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,37,272,8
+ RTEXT "News feed types to notify:",IDC_STATIC,26,49,117,8
+ COMBOBOX IDC_FEED_TYPE,150,47,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Don't show advertising posts",IDC_FILTER_ADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,65,138,8
+ CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,75,272,8
+ CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,89,272,8
+ CONTROL "Friendship notifications",IDC_FRIENDSHIP_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,104,272,8
+ RTEXT "Use this server for opening links:",IDC_STATIC,13,131,139,8
+ COMBOBOX IDC_URL_SERVER,156,128,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Use balloon notifications in system tray instead of popups",IDC_SYSTRAY_NOTIFY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,147,272,8
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,150,272,8
CONTROL "Use logging notifications into special chatroom",IDC_NOTIFICATIONS_CHATROOM,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,164,272,8
PUSHBUTTON "Preview",IDC_PREVIEW,116,182,68,14
@@ -306,7 +307,8 @@ END //
// Generated from the TEXTINCLUDE 3 resource.
//
-
+
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index b8493352a3..f046b785a6 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -93,12 +93,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DEFAULT_EVENT_FEEDS_ENABLE 0
#define DEFAULT_EVENT_OTHER_ENABLE 1
#define DEFAULT_EVENT_CLIENT_ENABLE 1
+#define DEFAULT_EVENT_FRIENDSHIP_ENABLE 1
// Event flags
#define FACEBOOK_EVENT_CLIENT 0x10000000 // Facebook error or info message
#define FACEBOOK_EVENT_NEWSFEED 0x20000000 // Facebook newsfeed (wall) message
#define FACEBOOK_EVENT_NOTIFICATION 0x40000000 // Facebook new notification
-#define FACEBOOK_EVENT_OTHER 0x80000000 // Facebook other event - friend requests/new messages
+#define FACEBOOK_EVENT_OTHER 0x80000000 // Facebook other event (poke sent, status update, ...)
+#define FACEBOOK_EVENT_FRIENDSHIP 0x01000000 // Facebook friendship event
// Send message return values
#define SEND_MESSAGE_OK 0
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 337d479d3a..7a8e0849a7 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -452,7 +452,7 @@ void FacebookProto::DeleteContactFromServer(void *data) setDword(hContact, FACEBOOK_KEY_DELETED, ::time(NULL)); } - NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_OTHER); + NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_FRIENDSHIP); } else { facy.client_notify(TranslateT("Error occurred when removing contact from server.")); @@ -490,7 +490,7 @@ void FacebookProto::AddContactToServer(void *data) if (hContact != NULL) setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_REQUEST); - NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_OTHER); + NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_FRIENDSHIP); } else facy.client_notify(TranslateT("Error occurred when requesting friendship.")); @@ -526,7 +526,7 @@ void FacebookProto::ApproveContactToServer(void *data) if (resp.data.find("\"success\":true") != std::string::npos) { setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_FRIEND); - NotifyEvent(m_tszUserName, TranslateT("Request for friendship was accepted."), NULL, FACEBOOK_EVENT_OTHER); + NotifyEvent(m_tszUserName, TranslateT("Request for friendship was accepted."), NULL, FACEBOOK_EVENT_FRIENDSHIP); } else facy.client_notify(TranslateT("Error occurred when accepting friendship request.")); @@ -562,7 +562,7 @@ void FacebookProto::CancelFriendsRequest(void *data) if (resp.data.find("\"payload\":null", 0) != std::string::npos) { setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE); - NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_OTHER); + NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_FRIENDSHIP); } else facy.client_notify(TranslateT("Error occurred when canceling friendship request.")); @@ -598,7 +598,7 @@ void FacebookProto::IgnoreFriendshipRequest(void *data) if (resp.data.find("\"success\":true") != std::string::npos) { setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE); - NotifyEvent(m_tszUserName, TranslateT("Request for friendship was ignored."), NULL, FACEBOOK_EVENT_OTHER); + NotifyEvent(m_tszUserName, TranslateT("Request for friendship was ignored."), NULL, FACEBOOK_EVENT_FRIENDSHIP); // Delete this contact, if he's temporary if (db_get_b(hContact, "CList", "NotOnList", 0)) diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index a68102e15f..544483d4da 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -74,6 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FACEBOOK_KEY_EVENT_FEEDS_ENABLE "EventFeedsEnable"
#define FACEBOOK_KEY_EVENT_OTHER_ENABLE "EventOtherEnable"
#define FACEBOOK_KEY_EVENT_CLIENT_ENABLE "EventClientEnable"
+#define FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE "EventFriendshipEnable"
#define FACEBOOK_KEY_FEED_TYPE "EventFeedsType"
// Hidden account DB keys (can't be changed through GUI)
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index d1daeb62a7..77749ec265 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -528,6 +528,7 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA LoadDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE); LoadDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE); LoadDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE); + LoadDBCheckState(proto, hwnd, IDC_FRIENDSHIP_ENABLE, FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE); LoadDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS, DEFAULT_FILTER_ADS); } return TRUE; @@ -540,6 +541,7 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA proto->NotifyEvent(proto->m_tszUserName, TranslateT("Sample request"), NULL, FACEBOOK_EVENT_OTHER); proto->NotifyEvent(proto->m_tszUserName, TranslateT("Sample newsfeed"), NULL, FACEBOOK_EVENT_NEWSFEED); proto->NotifyEvent(proto->m_tszUserName, TranslateT("Sample notification"), NULL, FACEBOOK_EVENT_NOTIFICATION); + proto->NotifyEvent(proto->m_tszUserName, TranslateT("Sample friendship"), NULL, FACEBOOK_EVENT_FRIENDSHIP); break; case IDC_FEED_TYPE: case IDC_URL_SERVER: @@ -564,6 +566,7 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA StoreDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_ENABLE, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE); StoreDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE); StoreDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE); + StoreDBCheckState(proto, hwnd, IDC_FRIENDSHIP_ENABLE, FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE); StoreDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE); StoreDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS); } diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index ab8c0a8b71..db5f0fef22 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -61,6 +61,14 @@ HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWO SkinPlaySound("OtherEvent"); flags |= NIIF_INFO; break; + + case FACEBOOK_EVENT_FRIENDSHIP: + if (!getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) + return NULL; + mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Friendship"); + SkinPlaySound("Friendship"); + flags |= NIIF_INFO; + break; } if (!getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY)) @@ -100,7 +108,8 @@ HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWO REMOVE_FLAG(niif_flags, FACEBOOK_EVENT_CLIENT | FACEBOOK_EVENT_NEWSFEED | FACEBOOK_EVENT_NOTIFICATION | - FACEBOOK_EVENT_OTHER); + FACEBOOK_EVENT_OTHER | + FACEBOOK_EVENT_FRIENDSHIP); err.szProto = m_szModuleName; err.cbSize = sizeof(err); err.dwInfoFlags = NIIF_INTERN_TCHAR | niif_flags; diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 71acc4b9eb..832e4d80d2 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -3,7 +3,7 @@ Facebook plugin for Miranda Instant Messenger _____________________________________________ -Copyright © 2009-11 Michal Zelinka, 2011-15 Robert Pösel +Copyright � 2009-11 Michal Zelinka, 2011-15 Robert P�sel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 07bc0d9782..e6c2e6a1ac 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -149,7 +149,7 @@ void FacebookProto::ProcessBuddyList(void*) std::string contactname = getContactName(this, fbu->handle, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); ptrT szTitle(mir_utf8decodeT(contactname.c_str())); - NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), fbu->handle, FACEBOOK_EVENT_OTHER, &url); + NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), fbu->handle, FACEBOOK_EVENT_FRIENDSHIP, &url); } // Check avatar change @@ -256,7 +256,7 @@ void FacebookProto::ProcessFriendList(void*) std::string contactname = getContactName(this, hContact, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str()); ptrT szTitle(mir_utf8decodeT(contactname.c_str())); - NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), hContact, FACEBOOK_EVENT_OTHER, &url); + NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } // Check avatar change @@ -277,7 +277,7 @@ void FacebookProto::ProcessFriendList(void*) std::string contactname = getContactName(this, hContact, id); ptrT szTitle(mir_utf8decodeT(contactname.c_str())); - NotifyEvent(szTitle, TranslateT("Contact is no longer on server-list."), hContact, FACEBOOK_EVENT_OTHER, &url); + NotifyEvent(szTitle, TranslateT("Contact is no longer on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url); } } } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 285408015c..eea0c9d45f 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -3,7 +3,7 @@ Facebook plugin for Miranda Instant Messenger _____________________________________________ -Copyright © 2009-11 Michal Zelinka, 2011-15 Robert Pösel +Copyright � 2009-11 Michal Zelinka, 2011-15 Robert P�sel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1002,6 +1002,17 @@ void FacebookProto::InitPopups() ppc.colorText = RGB(0, 0, 0); // black ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); + + // Friendship changes + mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Friendship events")); + mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Friendship"); + ppc.ptszDescription = desc; + ppc.pszName = name; + ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("friendship")); + ppc.colorBack = RGB(47, 71, 122); // Facebook's darker blue + ppc.colorText = RGB(255, 255, 255); // white + ppc.iSeconds = 0; + popupClasses.push_back(Popup_RegisterClass(&ppc)); } /** @@ -1041,6 +1052,7 @@ void FacebookProto::InitSounds() SkinAddNewSoundExT("Notification", m_tszUserName, LPGENT("Notification")); SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENT("News Feed")); SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENT("Other Event")); + SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENT("Friendship Event")); } /** diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index fb273bd5e5..48423b6a5b 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -44,6 +44,7 @@ #define IDC_FILTER_ADS 1045
#define IDC_LOGIN_SYNC 1046
#define IDC_ENABLE_CHATS 1047
+#define IDC_FRIENDSHIP_ENABLE 1048
#define IDC_SYSTRAY_NOTIFY 1098
#define IDC_PREVIEW 1099
#define IDC_NOTIFICATIONS_CHATROOM 1100
|