diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-30 19:02:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-30 19:02:22 +0300 |
commit | 03c1382719f1322f54d23547d98f7b554f31f718 (patch) | |
tree | c7cea6d7afd60d9471ba841b2a03e430f12abccb | |
parent | 484310a70f4152b15dcbae24ed9e23009ae77c26 (diff) |
fixes #1692 (conflict between buddyList & presence parsing)
-rw-r--r-- | protocols/Icq10/src/server.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index e164de867e..ef7da1fe7a 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -38,9 +38,11 @@ void CIcqProto::CheckAvatarChange(MCONTACT hContact, const JSONNode &ev) void CIcqProto::CheckNickChange(MCONTACT hContact, const JSONNode &ev) { - CMStringW wszNick(ev["profile"]["friendlyName"].as_mstring()); - if (wszNick.IsEmpty()) - wszNick = ev["friendly"].as_mstring(); + CMStringW wszNick(getMStringW(hContact, "Nick")); + if (!wszNick.IsEmpty()) + return; + + wszNick = ev["friendly"].as_mstring(); if (!wszNick.IsEmpty()) setWString(hContact, "Nick", wszNick); } @@ -98,8 +100,6 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy) MCONTACT hContact = CreateContact(dwUin, false); FindContactByUIN(dwUin)->m_bInList = true; - CheckNickChange(hContact, buddy); - CMStringW str(buddy["state"].as_mstring()); setDword(hContact, "Status", StatusFromString(str)); @@ -112,8 +112,14 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy) str = profile["lastName"].as_mstring(); if (!str.IsEmpty()) setWString(hContact, "LastName", str); + + str = profile["friendlyName"].as_mstring(); + if (!str.IsEmpty()) + setWString(hContact, "Nick", str); } + CheckNickChange(hContact, buddy); + int lastLogin = buddy["lastseen"].as_int(); if (lastLogin) setDword(hContact, "LastSeen", lastLogin); @@ -543,6 +549,7 @@ void CIcqProto::ProcessPresence(const JSONNode &ev) if (pCache) { setDword(pCache->m_hContact, "Status", StatusFromString(ev["state"].as_mstring())); + CheckNickChange(pCache->m_hContact, ev); CheckAvatarChange(pCache->m_hContact, ev); } } |