diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-29 23:21:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-29 23:21:44 +0300 |
commit | 34ecd2b64d14de32d92d338fb76c746d2663e489 (patch) | |
tree | 02f5b2153d3fe2a4816ed0388197e984cd610d49 /protocols/Icq10/src/server.cpp | |
parent | 22499af34db1cd91cc8b0b118890863334a86cb2 (diff) |
more intelligent way of nick name extraction
Diffstat (limited to 'protocols/Icq10/src/server.cpp')
-rw-r--r-- | protocols/Icq10/src/server.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index 97e5703268..f8736ee245 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -36,6 +36,15 @@ void CIcqProto::CheckAvatarChange(MCONTACT hContact, const JSONNode &ev) } } +void CIcqProto::CheckNickChange(MCONTACT hContact, const JSONNode &ev) +{ + CMStringW wszNick(ev["friendlyName"].as_mstring()); + if (wszNick.IsEmpty()) + wszNick = ev["friendly"].as_mstring(); + if (!wszNick.IsEmpty()) + setWString(hContact, "Nick", wszNick); +} + void CIcqProto::CheckPassword() { char mirVer[100]; @@ -89,11 +98,10 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy) MCONTACT hContact = CreateContact(dwUin, false); FindContactByUIN(dwUin)->m_bInList = true; - CMStringW str(buddy["friendly"].as_mstring()); - if (!str.IsEmpty()) - setWString(hContact, "Nick", str); + CheckNickChange(hContact, buddy); - setDword(hContact, "Status", StatusFromString(buddy["state"].as_mstring())); + CMStringW str(buddy["state"].as_mstring()); + setDword(hContact, "Status", StatusFromString(str)); const JSONNode &profile = buddy["profile"]; if (profile) { @@ -523,10 +531,7 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) void CIcqProto::ProcessMyInfo(const JSONNode &ev) { - CMStringW wszNick(ev["friendly"].as_mstring()); - if (!wszNick.IsEmpty()) - setWString("Nick", wszNick); - + CheckNickChange(0, ev); CheckAvatarChange(0, ev); } |