summaryrefslogtreecommitdiff
path: root/protocols/Facebook/src/server.cpp
diff options
context:
space:
mode:
authorikeblaster <ike@thez.info>2020-02-27 23:57:57 +0100
committerikeblaster <ike@thez.info>2020-02-27 23:58:04 +0100
commit7869990f380805939298ef3d59e6ccf9b62bc834 (patch)
treed60cb357aa4700a74edaa2754b6f15770c266342 /protocols/Facebook/src/server.cpp
parentafc8206f4fc571d4923a922abd493882cebfe963 (diff)
Facebook: group chat initialization improvement
Chat_GetUserInfo is not usable since we have no "info" saved for users (=always returns nullptr).
Diffstat (limited to 'protocols/Facebook/src/server.cpp')
-rw-r--r--protocols/Facebook/src/server.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp
index faa8032d7b..506e59969c 100644
--- a/protocols/Facebook/src/server.cpp
+++ b/protocols/Facebook/src/server.cpp
@@ -238,11 +238,13 @@ FacebookUser* FacebookProto::RefreshThread(JSONNode& n) {
auto* user = FindUser(userId);
if (user == nullptr) {
- user = new FacebookUser(userId, si->hContact, true);
+ user = new FacebookUser(userId, si->hContact, true, true);
m_users.insert(user);
}
- else
+ else {
user->hContact = si->hContact;
+ user->bIsChatInitialized = true;
+ }
return user;
}
@@ -621,15 +623,16 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root)
CMStringW wszUserId;
bool bIsChat;
auto *pUser = UserFromJson(metadata, wszUserId, bIsChat);
+
+ if (!bIsChat && pUser == nullptr)
+ pUser = AddContact(wszUserId, true);
+ else if (bIsChat && (pUser == nullptr || !pUser->bIsChatInitialized)) // chat room does not exists or is not initialized
+ pUser = RefreshThread(wszUserId);
+
if (pUser == nullptr) {
- if (bIsChat)
- pUser = RefreshThread(wszUserId);
- else
- pUser = AddContact(wszUserId, true);
+ debugLogA("User not found and adding failed, event skipped");
+ return;
}
- else if (bIsChat && Chat_GetUserInfo(m_szModuleName, wszUserId) == nullptr) // user already exists, but room is not initialized
- RefreshThread(wszUserId);
-
for (auto &it : metadata["tags"]) {
auto *szTagName = it.name();