summaryrefslogtreecommitdiff
path: root/protocols/Dummy/src/dummy_proto.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-10-25 11:41:08 +0000
committerRobert Pösel <robyer@seznam.cz>2015-10-25 11:41:08 +0000
commitbf40980c0484f7c0639a040b5abc80f181084283 (patch)
tree3b9b4b6604874262388e65945f7039f2a30d8ce8 /protocols/Dummy/src/dummy_proto.cpp
parent0ace710d01dc20a6befcc9eefaa26ebf7ccc2a75 (diff)
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
Diffstat (limited to 'protocols/Dummy/src/dummy_proto.cpp')
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp15
1 files changed, 13 insertions, 2 deletions
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);
}