diff options
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;
|