diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-28 17:51:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-28 17:51:56 +0300 |
commit | 8e51f5222c33160dc339e71d621d6ec92f23ad7e (patch) | |
tree | 0156b4223724e0f318812ce9eecdef39f20a5d5e /protocols/Icq10 | |
parent | 30ed9ea8b76aedb3c3c1ad253a3d45be9b4b638f (diff) |
fixes #1682 (newly added contact might have no user info)
Diffstat (limited to 'protocols/Icq10')
-rw-r--r-- | protocols/Icq10/src/server.cpp | 23 | ||||
-rw-r--r-- | protocols/Icq10/src/utils.cpp | 1 |
2 files changed, 18 insertions, 6 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index f283f5bd9a..d2d84e39b9 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -75,21 +75,32 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy) MCONTACT hContact = CreateContact(dwUin, false); FindContactByUIN(dwUin)->m_bInList = true; - CMStringW wszNick(buddy["friendly"].as_mstring()); - if (!wszNick.IsEmpty()) - setWString(hContact, "Nick", wszNick); + CMStringW str(buddy["friendly"].as_mstring()); + if (!str.IsEmpty()) + setWString(hContact, "Nick", str); setDword(hContact, "Status", StatusFromString(buddy["state"].as_mstring())); + const JSONNode &profile = buddy["profile"]; + if (profile) { + str = profile["firstName"].as_mstring(); + if (!str.IsEmpty()) + setWString(hContact, "FirstName", str); + + str = profile["lastName"].as_mstring(); + if (!str.IsEmpty()) + setWString(hContact, "LastName", str); + } + int lastLogin = buddy["lastseen"].as_int(); if (lastLogin) setDword(hContact, "LoginTS", lastLogin); - CMStringW wszStatus(buddy["statusMsg"].as_mstring()); - if (wszStatus.IsEmpty()) + str = buddy["statusMsg"].as_mstring(); + if (str.IsEmpty()) db_unset(hContact, "CList", "StatusMsg"); else - db_set_ws(hContact, "CList", "StatusMsg", wszStatus); + db_set_ws(hContact, "CList", "StatusMsg", str); CMStringW wszIconId(buddy["iconId"].as_mstring()); CMStringW oldIconID(getMStringW(hContact, "IconId")); diff --git a/protocols/Icq10/src/utils.cpp b/protocols/Icq10/src/utils.cpp index d80537a4bc..d3364dd58c 100644 --- a/protocols/Icq10/src/utils.cpp +++ b/protocols/Icq10/src/utils.cpp @@ -47,6 +47,7 @@ MCONTACT CIcqProto::CreateContact(DWORD dwUin, bool bTemporary) mir_cslock l(m_csCache); m_arCache.insert(pCache); } + RetrieveUserInfo(hContact); if (bTemporary) db_set_b(hContact, "CList", "NotOnList", 1); |