From cf5d89144da7ceed41fe9a45ed61c872452639a4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Feb 2019 13:44:38 +0300 Subject: fixes #1839 (SecureIM detection in ICQ-WIM) --- protocols/ICQ-WIM/src/proto.h | 2 +- protocols/ICQ-WIM/src/server.cpp | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'protocols/ICQ-WIM/src') diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index ea5f310dbb..8125aae649 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -48,7 +48,7 @@ #define WIM_CAP_MAIL_NOTIFICATIONS "094613594c7f11d18222444553540000" #define WIM_CAP_INTRO_DLG_STATE "0946135a4c7f11d18222444553540000" -#define NG_CAP_SECUREIM "4D69724E47536563757265494D000000" +#define NG_CAP_SECUREIM "4d69724e47536563757265494d000000" typedef CProtoDlgBase CIcqDlgBase; diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index f33d22eb1d..a960bb1d95 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -227,7 +227,7 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) } CMStringA szVer; - bool bVersionDetected = false; + bool bVersionDetected = false, bSecureIM = false; for (auto &it : buddy["capabilities"]) { CMStringW wszCap(it.as_mstring()); @@ -243,9 +243,8 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) setString(hContact, "MirVer", szVer); bVersionDetected = true; } - else if (!memcmp(cap, NG_CAP_SECUREIM, 16)) { - szVer.Append(" + SecureIM"); - bVersionDetected = true; + else if (wszCap == _A2W(NG_CAP_SECUREIM)) { + bSecureIM = bVersionDetected = true; } else if (!memcmp(cap, "Mod by Mikanoshi", 16)) { szVer = "R&Q build by Mikanoshi"; @@ -257,10 +256,12 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) } } - if (bVersionDetected) + if (bVersionDetected) { + if (bSecureIM) + szVer.Append(" + SecureIM"); setString(hContact, "MirVer", szVer); - else - delSetting(hContact, "MirVer"); + } + else delSetting(hContact, "MirVer"); CMStringW str(buddy["state"].as_mstring()); setDword(hContact, "Status", StatusFromString(str)); -- cgit v1.2.3