summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-09 16:00:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-09 16:00:40 +0300
commitbcac155fc8bda519214531584cef79f850c02d38 (patch)
tree9b1f30350fe8b7c190dbf7d51d5596408f3b42ba /src/mir_app
parentb5fdc3576be1c5fa17db089eac33f57912817fcf (diff)
one shall not mix protocol registrations & accounts
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/CMPluginBase.cpp9
-rw-r--r--src/mir_app/src/protocols.cpp12
2 files changed, 10 insertions, 11 deletions
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)