summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src/proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/ICQ-WIM/src/proto.cpp')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index cba66077db..d224b7d265 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -134,7 +134,6 @@ CIcqProto::~CIcqProto()
void CIcqProto::OnModulesLoaded()
{
- InitContactCache();
InitMenus();
HookProtoEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
@@ -148,6 +147,42 @@ void CIcqProto::OnShutdown()
m_bTerminated = true;
}
+void CIcqProto::OnCacheInit()
+{
+ mir_cslock l(m_csCache);
+ for (auto &it : AccContacts()) {
+ m_bCacheInited = true;
+
+ if (isChatRoom(it))
+ continue;
+
+ // that was previously an ICQ contact
+ ptrW wszUin(GetUIN(it));
+ if (wszUin != nullptr) {
+ delSetting(it, "UIN");
+ setWString(it, DB_KEY_ID, wszUin);
+ }
+ // that was previously a MRA contact
+ else {
+ CMStringW wszEmail(getMStringW(it, "e-mail"));
+ if (!wszEmail.IsEmpty()) {
+ delSetting(it, "e-mail");
+ setWString(it, DB_KEY_ID, wszEmail);
+ }
+ }
+
+ CMStringW wszId = GetUserId(it);
+ auto *pUser = FindUser(wszId);
+ if (pUser == nullptr) {
+ pUser = new IcqUser(wszId, it);
+
+ mir_cslock lck(m_csCache);
+ m_arCache.insert(pUser);
+ }
+ pUser->m_iProcessedMsgId = getId(it, DB_KEY_LASTMSGID);
+ }
+}
+
void CIcqProto::OnContactAdded(MCONTACT hContact)
{
CMStringW wszId(getMStringW(hContact, DB_KEY_ID));