summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-07 19:10:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-07 19:10:44 +0300
commitb396750fae7f9f41043ddeb849e5cff29cbcca9c (patch)
tree64fc971e06729c748c7d1ecd9896841adf50104f /protocols/ICQ-WIM/src/utils.cpp
parentc13e5563e2e248992a201466a9ce1c73b3c58808 (diff)
ICQ-WIM:
- DWORD UIN dumped and replaced everywhere with CMStringW aimId; - additional Email field removed from options, now UIN acts like email - MRA is fully supported - version bump
Diffstat (limited to 'protocols/ICQ-WIM/src/utils.cpp')
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index afebaba7f4..cd5265674f 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -23,27 +23,41 @@
void CIcqProto::InitContactCache()
{
mir_cslock l(m_csCache);
- for (auto &it : AccContacts())
- if (!isChatRoom(it))
- m_arCache.insert(new IcqCacheItem(getDword(it, DB_KEY_UIN), it));
+ for (auto &it : AccContacts()) {
+ if (isChatRoom(it))
+ continue;
+
+ DWORD dwUin = getDword(it, "UIN", -1);
+ if (dwUin != -1) {
+ delSetting(it, "UIN");
+
+ wchar_t buf[100];
+ _itow(dwUin, buf, 10);
+ setWString(it, DB_KEY_ID, buf);
+ }
+
+ m_arCache.insert(new IcqCacheItem(GetUserId(it), it));
+ }
}
-IcqCacheItem* CIcqProto::FindContactByUIN(DWORD dwUin)
+IcqCacheItem* CIcqProto::FindContactByUIN(const CMStringW &wszId)
{
+ IcqCacheItem tmp(wszId, -1);
+
mir_cslock l(m_csCache);
- return m_arCache.find((IcqCacheItem*)&dwUin);
+ return m_arCache.find(&tmp);
}
-MCONTACT CIcqProto::CreateContact(DWORD dwUin, bool bTemporary)
+MCONTACT CIcqProto::CreateContact(const CMStringW &wszId, bool bTemporary)
{
- auto *pCache = FindContactByUIN(dwUin);
+ auto *pCache = FindContactByUIN(wszId);
if (pCache != nullptr)
return pCache->m_hContact;
MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
- setDword(hContact, DB_KEY_UIN, dwUin);
- pCache = new IcqCacheItem(dwUin, hContact);
+ setWString(hContact, DB_KEY_ID, wszId);
+ pCache = new IcqCacheItem(wszId, hContact);
{
mir_cslock l(m_csCache);
m_arCache.insert(pCache);
@@ -211,12 +225,12 @@ INT_PTR __cdecl CIcqProto::SetAvatar(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-CMStringA CIcqProto::GetUserId(MCONTACT hContact)
+CMStringW CIcqProto::GetUserId(MCONTACT hContact)
{
if (isChatRoom(hContact))
- return getMStringA(hContact, "ChatRoomID");
+ return getMStringW(hContact, "ChatRoomID");
- return CMStringA(FORMAT, "%d", getDword(hContact, DB_KEY_UIN));
+ return getMStringW(hContact, DB_KEY_ID);
}
bool IsChat(const CMStringW &aimid)