summaryrefslogtreecommitdiff
path: root/protocols/Icq10/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-29 23:21:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-29 23:21:44 +0300
commit34ecd2b64d14de32d92d338fb76c746d2663e489 (patch)
tree02f5b2153d3fe2a4816ed0388197e984cd610d49 /protocols/Icq10/src
parent22499af34db1cd91cc8b0b118890863334a86cb2 (diff)
more intelligent way of nick name extraction
Diffstat (limited to 'protocols/Icq10/src')
-rw-r--r--protocols/Icq10/src/proto.h1
-rw-r--r--protocols/Icq10/src/server.cpp21
2 files changed, 14 insertions, 8 deletions
diff --git a/protocols/Icq10/src/proto.h b/protocols/Icq10/src/proto.h
index b8bf2304b6..8b2861b5a5 100644
--- a/protocols/Icq10/src/proto.h
+++ b/protocols/Icq10/src/proto.h
@@ -66,6 +66,7 @@ class CIcqProto : public PROTO<CIcqProto>
{
bool m_bOnline = false, m_bTerminated = false;
void CheckAvatarChange(MCONTACT hContact, const JSONNode&);
+ void CheckNickChange(MCONTACT hContact, const JSONNode&);
void CheckPassword(void);
void ConnectionFailed(int iReason);
void OnLoggedIn(void);
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);
}