summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2017-01-23 01:07:41 +0100
committerRobert Pösel <robyer@seznam.cz>2017-01-23 01:07:41 +0100
commit26890d819c469ffc7a01352d828eeaf659f82be8 (patch)
treea628deafb53be6887ebe6888f118d9c4bf2a00c4 /protocols/FacebookRM/src
parent0151cac1704717e5eee6859e4d3b8eeb043d901f (diff)
Facebook: Add option to make Pages always invisible (enabled by default)
FB Pages are not online or offline, they just are. And this options helps users to find them in their contact list easily.
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r--protocols/FacebookRM/src/constants.h1
-rw-r--r--protocols/FacebookRM/src/db.h1
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp2
-rw-r--r--protocols/FacebookRM/src/process.cpp6
-rw-r--r--protocols/FacebookRM/src/proto.cpp5
-rw-r--r--protocols/FacebookRM/src/resource.h1
6 files changed, 16 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h
index 76b883ffe3..6b8bf70949 100644
--- a/protocols/FacebookRM/src/constants.h
+++ b/protocols/FacebookRM/src/constants.h
@@ -99,6 +99,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEFAULT_NOTIFICATIONS_CHATROOM 0
#define DEFAULT_NAME_AS_NICK 1
#define DEFAULT_LOAD_ALL_CONTACTS 0
+#define DEFAULT_PAGES_ALWAYS_ONLINE 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 8679d1234b..85c3678d62 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_NOTIFICATIONS_CHATROOM "NotificationsChatroom"
#define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick"
#define FACEBOOK_KEY_LOAD_ALL_CONTACTS "LoadAllContacts"
+#define FACEBOOK_KEY_PAGES_ALWAYS_ONLINE "PagesAlwaysOnline"
// Account DB keys - notifications
#define FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE "EventNotificationsEnable"
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 8bbdcd7cbb..14c99e50cc 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -372,6 +372,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
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);
LoadDBCheckState(proto, hwnd, IDC_LOAD_ALL_CONTACTS, FACEBOOK_KEY_LOAD_ALL_CONTACTS, DEFAULT_LOAD_ALL_CONTACTS);
+ LoadDBCheckState(proto, hwnd, IDC_PAGES_ALWAYS_ONLINE, FACEBOOK_KEY_PAGES_ALWAYS_ONLINE, DEFAULT_PAGES_ALWAYS_ONLINE);
} return TRUE;
@@ -419,6 +420,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
StoreDBCheckState(proto, hwnd, IDC_NAME_AS_NICK, FACEBOOK_KEY_NAME_AS_NICK);
StoreDBCheckState(proto, hwnd, IDC_LOAD_ALL_CONTACTS, FACEBOOK_KEY_LOAD_ALL_CONTACTS);
+ StoreDBCheckState(proto, hwnd, IDC_PAGES_ALWAYS_ONLINE, FACEBOOK_KEY_PAGES_ALWAYS_ONLINE);
return TRUE;
}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 33a451204e..0f4a4e736e 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -60,6 +60,7 @@ void FacebookProto::ProcessFriendList(void*)
std::map<std::string, facebook_user*> friends;
bool loadAllContacts = getBool(FACEBOOK_KEY_LOAD_ALL_CONTACTS, DEFAULT_LOAD_ALL_CONTACTS);
+ bool pagesAlwaysOnline = getBool(FACEBOOK_KEY_PAGES_ALWAYS_ONLINE, DEFAULT_PAGES_ALWAYS_ONLINE);
facebook_json_parser* p = new facebook_json_parser(this);
p->parse_friends(&resp.data, &friends, loadAllContacts);
@@ -77,6 +78,11 @@ void FacebookProto::ProcessFriendList(void*)
setDword(hContact, FACEBOOK_KEY_DELETED, deletedTS);
}
+ // If this contact is page, set it as invisible (if enabled in options)
+ if (pagesAlwaysOnline && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE) == CONTACT_PAGE) {
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
+ }
+
facebook_user *fbu;
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
if (id != NULL) {
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 0cb9fc7a37..8c63120cb4 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -375,6 +375,11 @@ int FacebookProto::GetInfo(MCONTACT hContact, int)
}
}
+ // If this contact is page, set it as invisible (if enabled in options)
+ if (getBool(FACEBOOK_KEY_PAGES_ALWAYS_ONLINE, DEFAULT_PAGES_ALWAYS_ONLINE) && fbu.type == CONTACT_PAGE) {
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
+ }
+
CheckAvatarChange(hContact, fbu.image_url);
return 1;
diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h
index ec3d76d425..e5f5cccf9c 100644
--- a/protocols/FacebookRM/src/resource.h
+++ b/protocols/FacebookRM/src/resource.h
@@ -39,6 +39,7 @@
#define IDC_MAP_STATUSES 1032
#define IDC_LOAD_ALL_CONTACTS 1033
#define IDC_CUSTOM_SMILEYS 1034
+#define IDC_PAGES_ALWAYS_ONLINE 1035
#define IDC_LOAD_PAGES 1036
#define IDC_KEEP_UNREAD 1037
#define IDC_MESSAGES_ON_OPEN 1039