summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_metacontacts.cpp
diff options
context:
space:
mode:
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)