From e596945743e029945b7fd8657de5d3f6c279d44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 1 Sep 2015 21:17:14 +0000 Subject: Facebook: Add new option "Prefer real names instead of nicknames" By disabling it you will see nicknames (if available) instead of real name of contacts. git-svn-id: http://svn.miranda-ng.org/main/trunk@15142 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/res/facebook.rc | 9 +++++---- protocols/FacebookRM/src/constants.h | 1 + protocols/FacebookRM/src/db.h | 2 +- protocols/FacebookRM/src/dialogs.cpp | 2 ++ protocols/FacebookRM/src/json.cpp | 3 +++ protocols/FacebookRM/src/resource.h | 1 + 6 files changed, 13 insertions(+), 5 deletions(-) (limited to 'protocols/FacebookRM') diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index 5a7875fe32..6459534a63 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -113,12 +113,14 @@ BEGIN EDITTEXT IDC_PW,84,34,123,13,ES_PASSWORD | ES_AUTOHSCROLL CONTROL "Create a new Facebook account",IDC_NEWACCOUNTLINK, "Hyperlink",WS_TABSTOP,84,53,189,10 - GROUPBOX "Contacts",IDC_STATIC,7,77,291,60 + GROUPBOX "Contacts",IDC_STATIC,7,77,291,74 LTEXT "Default group:",IDC_STATIC,17,91,61,8,0,WS_EX_RIGHT EDITTEXT IDC_GROUP,84,89,123,13,ES_AUTOHSCROLL CONTROL "Automatically set 'Ignore status change' flag",IDC_SET_IGNORE_STATUS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,107,271,10 CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,120,271,10 + CONTROL "Prefer real names instead of nicknames",IDC_NAME_AS_NICK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,134,271,10 END IDD_OPTIONS_EVENTS DIALOGEX 0, 0, 305, 227 @@ -138,7 +140,7 @@ BEGIN CONTROL "Friendship notifications",IDC_FRIENDSHIP_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,99,272,8 CONTROL "Ticker feeds",IDC_TICKER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,113,272,8 CONTROL "Show ""On this day"" posts at login",IDC_ON_THIS_DAY_ENABLE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,128,272,8 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,128,272,8 RTEXT "Use this server for opening links:",IDC_STATIC,13,154,139,8 COMBOBOX IDC_URL_SERVER,156,151,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Use balloon notifications in system tray instead of popups",IDC_SYSTRAY_NOTIFY, @@ -306,8 +308,7 @@ 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 b353049c24..1c9e0f5453 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -89,6 +89,7 @@ along with this program. If not, see . #define DEFAULT_HIDE_CHATS 0 #define DEFAULT_ENABLE_CHATS 1 #define DEFAULT_NOTIFICATIONS_CHATROOM 0 +#define DEFAULT_NAME_AS_NICK 1 #define DEFAULT_EVENT_NOTIFICATIONS_ENABLE 1 #define DEFAULT_EVENT_FEEDS_ENABLE 0 diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 4b9e119a48..0838548bb1 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -67,6 +67,7 @@ along with this program. If not, see . #define FACEBOOK_KEY_HIDE_CHATS "HideChats" #define FACEBOOK_KEY_ENABLE_CHATS "EnableChat" #define FACEBOOK_KEY_NOTIFICATIONS_CHATROOM "NotificationsChatroom" +#define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // Account DB keys - notifications #define FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE "EventNotificationsEnable" @@ -83,6 +84,5 @@ along with this program. If not, see . #define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN] - (byte) #define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - (string) en_US, cs_CZ, etc. (requires restart to apply) #define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 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] - (byte) 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_SEND_MESSAGE_TRIES "SendMessageTries" // [HIDDEN] - (byte) = number of tries to send message, default=1, min=1, max=5 diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 80a825acc9..1f2ea3bffc 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -370,6 +370,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp LoadDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, DEFAULT_DISABLE_STATUS_NOTIFY); LoadDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS); + LoadDBCheckState(proto, hwnd, IDC_NAME_AS_NICK, FACEBOOK_KEY_NAME_AS_NICK, DEFAULT_NAME_AS_NICK); } return TRUE; @@ -415,6 +416,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY); StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS); + StoreDBCheckState(proto, hwnd, IDC_NAME_AS_NICK, FACEBOOK_KEY_NAME_AS_NICK); return TRUE; } diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 99cebe36a0..4b4eebb131 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -146,6 +146,7 @@ void parseUser(const JSONNode &it, facebook_user *fbu) return; } + std::string alternateName = it["alternateName"].as_string(); // nickname std::string name = it["name"].as_string(); std::string thumbSrc = it["thumbSrc"].as_string(); std::string vanity = it["vanity"].as_string(); // username @@ -161,6 +162,8 @@ void parseUser(const JSONNode &it, facebook_user *fbu) fbu->image_url = utils::text::slashu_to_utf8(thumbSrc); if (!vanity.empty()) fbu->username = utils::text::slashu_to_utf8(vanity); + if (!alternateName.empty()) + fbu->nick = alternateName; if (gender) { switch (gender) { diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index 82083e2954..0c89884724 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -27,6 +27,7 @@ #define IDC_SET_IGNORE_STATUS 1025 #define IDC_DISCONNECT_CHAT 1028 #define IDC_BIGGER_AVATARS 1030 +#define IDC_NAME_AS_NICK 1031 #define IDC_MAP_STATUSES 1032 #define IDC_CUSTOM_SMILEYS 1034 #define IDC_LOAD_PAGES 1036 -- cgit v1.2.3