From bcac155fc8bda519214531584cef79f850c02d38 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 9 Jul 2018 16:00:40 +0300 Subject: one shall not mix protocol registrations & accounts --- src/mir_app/src/CMPluginBase.cpp | 9 ++++++++- src/mir_app/src/protocols.cpp | 12 ++---------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index b6fb78d6f4..b14ce7be28 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -293,5 +293,12 @@ void CMPluginBase::RegisterProtocol(int type, pfnInitProto fnInit, pfnUninitProt void CMPluginBase::SetUniqueId(const char *pszUniqueId) { - ::Proto_SetUniqueId(m_szModuleName, pszUniqueId); + if (pszUniqueId == nullptr) + return; + + MBaseProto tmp; + tmp.szName = (char*)m_szModuleName; + MBaseProto *pd = g_arProtos.find(&tmp); + if (pd != nullptr) + pd->szUniqueId = mir_strdup(pszUniqueId); } diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 6a28c9bfeb..f4aea76896 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -145,20 +145,12 @@ MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_RegisterModule(int type, const char *szNa MIR_APP_DLL(void) Proto_SetUniqueId(const char *szModuleName, const char *pszUniqueId) { - if (szModuleName == nullptr || pszUniqueId == nullptr) + if (pszUniqueId == nullptr) return; PROTOACCOUNT *pa = Proto_GetAccount(szModuleName); - if (pa != nullptr) { + if (pa != nullptr) pa->szUniqueId = mir_strdup(pszUniqueId); - return; - } - - MBaseProto tmp; - tmp.szName = (char*)szModuleName; - MBaseProto *pd = g_arProtos.find(&tmp); - if (pd != nullptr) - pd->szUniqueId = mir_strdup(pszUniqueId); } MIR_APP_DLL(const char*) Proto_GetUniqueId(const char *szModuleName) -- cgit v1.2.3