summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_metacontacts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-08 10:49:29 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-08 10:49:29 +0000
commit017b7066ab8c82880a62f9208e25c36c43c76a03 (patch)
treeec1c940848a51bfd77b0ac1c87a53d8e99f9ae7a /plugins/Variables/src/parse_metacontacts.cpp
parent6cb46f5857189fc42e05981ca2c01bb00e65e59f (diff)
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
Diffstat (limited to 'plugins/Variables/src/parse_metacontacts.cpp')
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp47
1 files changed, 6 insertions, 41 deletions
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)