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/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 + 5 files changed, 8 insertions(+), 1 deletion(-) (limited to 'protocols/FacebookRM/src') 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