diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-22 19:26:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-22 19:26:17 +0300 |
commit | f16237c82e336d857d73609015157732c97a2529 (patch) | |
tree | e884a90c0e73c51d59275e39accc3219b52268fc | |
parent | a79f25d3146f1c706c2908310bb348f8e9c127de (diff) |
fixes #1839 (ICQ-WIM: SecureIM cannot autodetect if the contact uses this plugin too)
-rw-r--r-- | protocols/ICQ-WIM/src/main.cpp | 3 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 20 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/stdafx.h | 2 |
4 files changed, 21 insertions, 6 deletions
diff --git a/protocols/ICQ-WIM/src/main.cpp b/protocols/ICQ-WIM/src/main.cpp index cd1ee70f46..aaaacf0ea3 100644 --- a/protocols/ICQ-WIM/src/main.cpp +++ b/protocols/ICQ-WIM/src/main.cpp @@ -20,7 +20,7 @@ #include "stdafx.h" -bool g_bPopupService, g_bMessageState; +bool g_bPopupService, g_bSecureIM, g_bMessageState; HWND g_hwndHeartbeat; @@ -95,6 +95,7 @@ static INT_PTR ICQPermitDeny(WPARAM hContact, LPARAM, LPARAM bAllow) static int ModuleLoad(WPARAM, LPARAM) { + g_bSecureIM = ServiceExists("SecureIM/IsContactSecured"); g_bPopupService = ServiceExists(MS_POPUP_ADDPOPUPT); g_bMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE); return 0; diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 253bc15927..9426cc8e08 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -48,6 +48,8 @@ #define WIM_CAP_MAIL_NOTIFICATIONS "094613594c7f11d18222444553540000" #define WIM_CAP_INTRO_DLG_STATE "0946135a4c7f11d18222444553540000" +#define NG_CAP_SECUREIM "4D69724E47536563757265494D000000" + typedef CProtoDlgBase<CIcqProto> CIcqDlgBase; enum ChatMenuItems diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 692eb1f511..b086a9bd53 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -226,7 +226,9 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) FindContactByUIN(wszId)->m_bInList = true; } + CMStringA szVer; bool bVersionDetected = false; + for (auto &it : buddy["capabilities"]) { CMStringW wszCap(it.as_mstring()); if (wszCap.GetLength() != 32) @@ -237,21 +239,27 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) if (!memcmp(cap, "MiNG", 4)) { // Miranda int v[4]; swscanf(wszCap.c_str() + 16, L"%04x%04x%04x%04x", &v[0], &v[1], &v[2], &v[3]); - CMStringA szVer(FORMAT, "Miranda NG %d.%d.%d.%d (ICQ %d.%d.%d.%d)", v[0], v[1], v[2], v[3], cap[4], cap[5], cap[6], cap[7]); + szVer.Format("Miranda NG %d.%d.%d.%d (ICQ %d.%d.%d.%d)", v[0], v[1], v[2], v[3], cap[4], cap[5], cap[6], cap[7]); setString(hContact, "MirVer", szVer); bVersionDetected = true; } + else if (!memcmp(cap, NG_CAP_SECUREIM, 16)) { + szVer.Append(" + SecureIM"); + bVersionDetected = true; + } else if (!memcmp(cap, "Mod by Mikanoshi", 16)) { - setString(hContact, "MirVer", "R&Q build by Mikanoshi"); + szVer = "R&Q build by Mikanoshi"; bVersionDetected = true; } else if (!memcmp(cap, "Mandarin IM", 11)) { - setString(hContact, "MirVer", "Mandarin IM"); + szVer = "Mandarin IM"; bVersionDetected = true; } } - if (!bVersionDetected) + if (bVersionDetected) + setString(hContact, "MirVer", szVer); + else delSetting(hContact, "MirVer"); CMStringW str(buddy["state"].as_mstring()); @@ -543,6 +551,10 @@ void CIcqProto::StartSession() int ts = time(0); CMStringA nonce(FORMAT, "%d-2", ts); CMStringA caps(WIM_CAP_UNIQ_REQ_ID "," WIM_CAP_EMOJI "," WIM_CAP_MAIL_NOTIFICATIONS "," WIM_CAP_INTRO_DLG_STATE); + if (g_bSecureIM) { + caps.AppendChar(','); + caps.Append(NG_CAP_SECUREIM); + } MFileVersion v; Miranda_GetFileVersion(&v); diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index 7f1ea98575..e229041482 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -103,5 +103,5 @@ int StatusFromString(const CMStringW&); char* time2text(time_t time); extern HWND g_hwndHeartbeat; -extern bool g_bPopupService, g_bMessageState; +extern bool g_bPopupService, g_bSecureIM, g_bMessageState; extern IconItem iconList[]; |