From bf40980c0484f7c0639a040b5abc80f181084283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 25 Oct 2015 11:41:08 +0000 Subject: Dummy: Simplify settings by provide list of existing protocols to choose from; Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15612 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Dummy/src/dummy_proto.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'protocols/Dummy/src/dummy_proto.cpp') diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 2503e15ea0..531cf9d627 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -50,6 +50,15 @@ CDummyProto::~CDummyProto() ////////////////////////////////////////////////////////////////////////////// +int CDummyProto::getTemplateId() +{ + int id = this->getByte(DUMMY_ID_TEMPLATE, 0); + if (id < 0 || id >= _countof(templates)) { + return 0; + } + return id; +} + DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) { switch(type) { @@ -73,7 +82,8 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDTEXT: if (uniqueIdSetting[0] == '\0') { - ptrA setting(getStringA(DUMMY_ID_TEXT)); + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(Translate(templates[id].text)) : getStringA(DUMMY_ID_TEXT)); if (setting != NULL) strncpy_s(uniqueIdSetting, setting, _TRUNCATE); } @@ -81,7 +91,8 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDSETTING: if (uniqueIdText[0] == '\0') { - ptrA setting(getStringA(DUMMY_ID_SETTING)); + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); if (setting != NULL) strncpy_s(uniqueIdText, setting, _TRUNCATE); } -- cgit v1.2.3