summaryrefslogtreecommitdiff
path: root/protocols/Facebook
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-15 19:53:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-15 19:53:39 +0300
commitd2dab81d17eafa10fb55b675090f6110ff7f7930 (patch)
tree9622499649ccb0ddc98e88260342e41e7289343d /protocols/Facebook
parentefbd3e90b66f16d3aac1d99f15ce7f2f83477b4e (diff)
fixes #1012 (Facebook: option needed to load friends only)
Diffstat (limited to 'protocols/Facebook')
-rw-r--r--protocols/Facebook/res/facebook.rc14
-rw-r--r--protocols/Facebook/src/options.cpp4
-rw-r--r--protocols/Facebook/src/proto.cpp1
-rw-r--r--protocols/Facebook/src/proto.h13
-rw-r--r--protocols/Facebook/src/resource.h3
-rw-r--r--protocols/Facebook/src/server.cpp3
6 files changed, 23 insertions, 15 deletions
diff --git a/protocols/Facebook/res/facebook.rc b/protocols/Facebook/res/facebook.rc
index f0600b6382..9b138e9e42 100644
--- a/protocols/Facebook/res/facebook.rc
+++ b/protocols/Facebook/res/facebook.rc
@@ -72,7 +72,7 @@ BEGIN
"Hyperlink",WS_TABSTOP,6,40,172,12
END
-IDD_OPTIONS DIALOGEX 0, 0, 305, 184
+IDD_OPTIONS DIALOGEX 0, 0, 305, 188
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -84,16 +84,18 @@ 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,70,291,56
+ GROUPBOX "Contacts",IDC_STATIC,7,70,291,70
LTEXT "Default group:",IDC_STATIC,17,84,61,8,0,WS_EX_RIGHT
EDITTEXT IDC_GROUP,84,82,123,13,ES_AUTOHSCROLL
CONTROL "Keep messages as unread on server",IDC_KEEP_UNREAD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,99,277,10
CONTROL "Use invisible mode after login",IDC_INVIS_LOGIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,112,277,10
- GROUPBOX "Group chats",IDC_STATIC,7,136,291,44
- CONTROL "Enable group chats",IDC_ENABLECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,150,277,10
+ GROUPBOX "Group chats",IDC_STATIC,7,142,291,42
+ CONTROL "Enable group chats",IDC_ENABLECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,155,277,10
CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,163,277,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,168,277,10
+ CONTROL "Load also Messenger contacts at login (not only Facebook friends)",IDC_LOADALL,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,277,10
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 263
@@ -121,7 +123,7 @@ BEGIN
IDD_OPTIONS, DIALOG
BEGIN
- BOTTOMMARGIN, 166
+ BOTTOMMARGIN, 180
END
END
#endif // APSTUDIO_INVOKED
diff --git a/protocols/Facebook/src/options.cpp b/protocols/Facebook/src/options.cpp
index 114db861d1..ddfd177552 100644
--- a/protocols/Facebook/src/options.cpp
+++ b/protocols/Facebook/src/options.cpp
@@ -23,18 +23,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class CFacebookAccOptsDlg : public CFBDlgBase
{
CCtrlEdit edtGroup;
- CCtrlCheck chkEnableChats, chkHideChats, chkKeepUnread, chkLoginInvis;
+ CCtrlCheck chkEnableChats, chkHideChats, chkKeepUnread, chkLoginInvis, chkLoadAll;
public:
CFacebookAccOptsDlg(FacebookProto *pThis) :
CFBDlgBase(pThis, IDD_OPTIONS),
edtGroup(this, IDC_GROUP),
+ chkLoadAll(this, IDC_LOADALL),
chkHideChats(this, IDC_HIDECHATS),
chkKeepUnread(this, IDC_KEEP_UNREAD),
chkLoginInvis(this, IDC_INVIS_LOGIN),
chkEnableChats(this, IDC_ENABLECHATS)
{
CreateLink(edtGroup, pThis->m_wszDefaultGroup);
+ CreateLink(chkLoadAll, pThis->m_bLoadAll);
CreateLink(chkHideChats, pThis->m_bHideGroupchats);
CreateLink(chkKeepUnread, pThis->m_bKeepUnread);
CreateLink(chkLoginInvis, pThis->m_bLoginInvisible);
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp
index 51d9f82ecd..6b97d82ae3 100644
--- a/protocols/Facebook/src/proto.cpp
+++ b/protocols/Facebook/src/proto.cpp
@@ -41,6 +41,7 @@ FacebookProto::FacebookProto(const char *proto_name, const wchar_t *username) :
m_impl(*this),
m_users(50, CompareUsers),
arOwnMessages(1, CompareMessages),
+ m_bLoadAll(this, "LoadAllContacts", false),
m_bKeepUnread(this, "KeepUnread", false),
m_bUseBigAvatars(this, "UseBigAvatars", true),
m_bUseGroupchats(this, "UseGroupChats", true),
diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h
index 1df80c6e4d..6ae38f2ca1 100644
--- a/protocols/Facebook/src/proto.h
+++ b/protocols/Facebook/src/proto.h
@@ -498,12 +498,13 @@ public:
//////////////////////////////////////////////////////////////////////////////////////
// options
- CMOption<wchar_t *> m_wszDefaultGroup; // clist group to store contacts
- CMOption<bool> m_bUseBigAvatars; // use big or small avatars by default
- CMOption<bool> m_bUseGroupchats; // do we need group chats at all?
- CMOption<bool> m_bHideGroupchats; // do not open chat windows on creation
- CMOption<bool> m_bLoginInvisible; // login in the invisible mode
- CMOption<bool> m_bKeepUnread; // do not mark incoming messages as read
+ CMOption<wchar_t *> m_wszDefaultGroup; // clist group to store contacts
+ CMOption<bool> m_bUseBigAvatars; // use big or small avatars by default
+ CMOption<bool> m_bUseGroupchats; // do we need group chats at all?
+ CMOption<bool> m_bHideGroupchats; // do not open chat windows on creation
+ CMOption<bool> m_bLoginInvisible; // login in the invisible mode
+ CMOption<bool> m_bKeepUnread; // do not mark incoming messages as read
+ CMOption<bool> m_bLoadAll; // load all contacts, not only those who have ARE_FRIENDS status
////////////////////////////////////////////////////////////////////////////////////////
// PROTO_INTERFACE
diff --git a/protocols/Facebook/src/resource.h b/protocols/Facebook/src/resource.h
index 3cf940682e..806f550e5e 100644
--- a/protocols/Facebook/src/resource.h
+++ b/protocols/Facebook/src/resource.h
@@ -16,6 +16,7 @@
#define IDC_CLIST 1007
#define IDC_KEEP_UNREAD 1008
#define IDC_INVIS_LOGIN 1009
+#define IDC_LOADALL 1010
// Next default values for new objects
//
@@ -23,7 +24,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1009
+#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp
index deca30a243..96f159f5de 100644
--- a/protocols/Facebook/src/server.cpp
+++ b/protocols/Facebook/src/server.cpp
@@ -137,6 +137,7 @@ int FacebookProto::RefreshContacts()
return iErrorCode; // unknown error
bool bNeedUpdate = false;
+ bool bLoadAll = m_bLoadAll;
for (auto &it : reply.data()["viewer"]["messenger_contacts"]["nodes"]) {
auto &n = it["represented_profile"];
@@ -145,7 +146,7 @@ int FacebookProto::RefreshContacts()
MCONTACT hContact;
if (id != m_uid) {
- bool bIsFriend = n["friendship_status"].as_mstring() == L"ARE_FRIENDS";
+ bool bIsFriend = bLoadAll || n["friendship_status"].as_mstring() == L"ARE_FRIENDS";
auto *pUser = FindUser(id);
if (pUser == nullptr) {