diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-28 20:01:30 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-28 20:01:30 +0300 |
commit | e7b69721b0d390cec3f81f97134a51bfef228cf8 (patch) | |
tree | a56ef2bd15fa3c995a031bec35ce0113dec22b28 /protocols/Dummy/src | |
parent | 81ce57622c3166830b23eae534dacc6b008c659d (diff) |
PFLAG_UNIQUEIDSETTING removed, its functionality transferred to Proto_SetUniqueId / Proto_GetUniqueId
Diffstat (limited to 'protocols/Dummy/src')
-rw-r--r-- | protocols/Dummy/src/dummy_proto.cpp | 18 | ||||
-rw-r--r-- | protocols/Dummy/src/main.cpp | 8 |
2 files changed, 15 insertions, 11 deletions
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 3dd8c0ee4a..f95c8ccfb4 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -61,7 +61,14 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) msgid = 0; - uniqueIdText[0] = '\0'; + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); + if (setting != NULL) { + strncpy_s(uniqueIdText, setting, _TRUNCATE); + Proto_SetUniqueId(m_szModuleName, uniqueIdText); + } + else uniqueIdText[0] = '\0'; + uniqueIdSetting[0] = '\0'; dummy_Instances.insert(this); @@ -113,15 +120,6 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) strncpy_s(uniqueIdSetting, setting, _TRUNCATE); } return (DWORD_PTR)uniqueIdSetting; - - case PFLAG_UNIQUEIDSETTING: - if (uniqueIdText[0] == '\0') { - int id = getTemplateId(); - ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); - if (setting != NULL) - strncpy_s(uniqueIdText, setting, _TRUNCATE); - } - return (DWORD_PTR)uniqueIdText; } return 0; } diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index 906ee1182a..6a57644bf3 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -85,6 +85,12 @@ struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto> {
CMPlugin() :
ACCPROTOPLUGIN<CDummyProto>("Dummy")
- {}
+ {
+ int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
+ if (id < 0 || id >= _countof(templates))
+ SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
+ else
+ SetUniqueId(templates[id].setting);
+ }
}
g_plugin;
|