summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-07-21 16:17:48 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-07-21 16:17:48 +0300
commit5fd260b7c4c98bfa2d17a301d832a859c2af1f92 (patch)
tree648dfe9336191c8fafdf7772f376f8e60337388a /protocols/JabberG/src
parent17b6a94812b2dbf4af29fb5d84064ceb1c7d393e (diff)
fixes #4555 (Задваиваются контакты протоколов, где есть кэш)
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber_events.cpp24
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp17
-rw-r--r--protocols/JabberG/src/jabber_proto.h1
3 files changed, 25 insertions, 17 deletions
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index cf3c2f92a7..161cc4f427 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -29,6 +29,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_disco.h"
/////////////////////////////////////////////////////////////////////////////////////////
+// OnCacheInit - cache initialization
+
+void CJabberProto::OnCacheInit()
+{
+ for (auto &hContact : AccContacts()) {
+ m_bCacheInited = true;
+
+ SetContactOfflineStatus(hContact);
+
+ if (getByte(hContact, "IsTransport", 0)) {
+ ptrA jid(getUStringA(hContact, "jid"));
+ if (jid == nullptr)
+ continue;
+
+ char *resourcepos = strchr(jid, '/');
+ if (resourcepos != nullptr)
+ *resourcepos = '\0';
+
+ m_lstTransports.insert(mir_strdup(jid));
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// OnContactDeleted - processes a contact deletion
bool CJabberProto::OnContactDeleted(MCONTACT hContact, uint32_t)
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 0f038b9344..a6127ac83c 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -311,23 +311,6 @@ void CJabberProto::OnModulesLoaded()
HookProtoEvent(ME_IDLE_CHANGED, &CJabberProto::OnIdleChanged);
CheckAllContactsAreTransported();
-
- // Set all contacts to offline
- for (auto &hContact : AccContacts()) {
- SetContactOfflineStatus(hContact);
-
- if (getByte(hContact, "IsTransport", 0)) {
- ptrA jid(getUStringA(hContact, "jid"));
- if (jid == nullptr)
- continue;
-
- char *resourcepos = strchr(jid, '/');
- if (resourcepos != nullptr)
- *resourcepos = '\0';
-
- m_lstTransports.insert(mir_strdup(jid));
- }
- }
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 17fc45c80e..f3f591f4b9 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -149,6 +149,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu(void) override;
+ void OnCacheInit() override;
bool OnContactDeleted(MCONTACT, uint32_t flags) override;
MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;