summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp9
-rw-r--r--protocols/ICQ-WIM/src/proto.h1
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp7
3 files changed, 11 insertions, 6 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 87a33e0502..d7bf399154 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -142,6 +142,15 @@ void CIcqProto::OnShutdown()
m_bTerminated = true;
}
+void CIcqProto::OnContactAdded(MCONTACT hContact)
+{
+ CMStringW wszId(getMStringW(hContact, DB_KEY_ID));
+ if (!wszId.IsEmpty() && !FindContactByUIN(wszId)) {
+ mir_cslock l(m_csCache);
+ m_arCache.insert(new IcqCacheItem(wszId, hContact));
+ }
+}
+
void CIcqProto::OnContactDeleted(MCONTACT hContact)
{
CMStringW szId(GetUserId(hContact));
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index ef83185830..163fc56b3a 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -441,6 +441,7 @@ class CIcqProto : public PROTO<CIcqProto>
int UserIsTyping(MCONTACT hContact, int type) override;
void OnBuildProtoMenu(void) override;
+ void OnContactAdded(MCONTACT) override;
void OnContactDeleted(MCONTACT) override;
void OnEventEdited(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index e01b94c9b4..30e1dcc575 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -91,13 +91,8 @@ MCONTACT CIcqProto::CreateContact(const CMStringW &wszId, bool bTemporary)
return pCache->m_hContact;
MCONTACT hContact = db_add_contact();
- Proto_AddToContact(hContact, m_szModuleName);
setWString(hContact, DB_KEY_ID, wszId);
- pCache = new IcqCacheItem(wszId, hContact);
- {
- mir_cslock l(m_csCache);
- m_arCache.insert(pCache);
- }
+ Proto_AddToContact(hContact, m_szModuleName);
RetrieveUserInfo(hContact);
if (bTemporary)