From 017b7066ab8c82880a62f9208e25c36c43c76a03 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Apr 2016 10:49:29 +0000 Subject: Variables: - massive code simplification; - old shit removed and replaced with lists; - version bump. git-svn-id: http://svn.miranda-ng.org/main/trunk@16613 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_metacontacts.cpp | 47 ++++------------------------ 1 file changed, 6 insertions(+), 41 deletions(-) (limited to 'plugins/Variables/src/parse_metacontacts.cpp') diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index bbe87a9506..abbfff5df8 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -24,20 +24,9 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - MCONTACT hContact = NULL; - - CONTACTSINFO ci = { sizeof(ci) }; - ci.tszContact = ai->targv[1]; - ci.flags = 0xFFFFFFFF ^ (CI_TCHAR == 0 ? CI_UNICODE : 0); - int count = getContactFromString(&ci); - if (count == 1 && ci.hContacts != NULL) { - hContact = ci.hContacts[0]; - mir_free(ci.hContacts); - } - else { - mir_free(ci.hContacts); + MCONTACT hContact = getContactFromString(ai->targv[1], 0xFFFFFFFF); + if (hContact == INVALID_CONTACT_ID) return NULL; - } hContact = db_mc_getMeta(hContact); if (hContact == NULL) @@ -63,21 +52,9 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - MCONTACT hContact = NULL; - - CONTACTSINFO ci = { 0 }; - ci.cbSize = sizeof(ci); - ci.tszContact = ai->targv[1]; - ci.flags = 0xFFFFFFFF ^ (CI_TCHAR == 0 ? CI_UNICODE : 0); - int count = getContactFromString(&ci); - if (count == 1 && ci.hContacts != NULL) { - hContact = ci.hContacts[0]; - mir_free(ci.hContacts); - } - else { - mir_free(ci.hContacts); + MCONTACT hContact = getContactFromString(ai->targv[1], 0xFFFFFFFF); + if (hContact == INVALID_CONTACT_ID) return NULL; - } hContact = db_mc_getDefault(hContact); if (hContact == NULL) @@ -103,21 +80,9 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - MCONTACT hContact = NULL; - - CONTACTSINFO ci = { 0 }; - ci.cbSize = sizeof(ci); - ci.tszContact = ai->targv[1]; - ci.flags = 0xFFFFFFFF ^ (CI_TCHAR == 0 ? CI_UNICODE : 0); - int count = getContactFromString(&ci); - if (count == 1 && ci.hContacts != NULL) { - hContact = ci.hContacts[0]; - mir_free(ci.hContacts); - } - else { - mir_free(ci.hContacts); + MCONTACT hContact = getContactFromString(ai->targv[1], 0xFFFFFFFF); + if (hContact == INVALID_CONTACT_ID) return NULL; - } hContact = db_mc_getMostOnline(hContact); if (hContact == NULL) -- cgit v1.2.3