summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_miranda.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-09 13:03:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-09 13:03:28 +0300
commit4b99b5b4abad1cf12ac5c7bbb8788899ba6a48ab (patch)
treee0948136799223ad497814ff1acb9928d5267514 /plugins/Variables/src/parse_miranda.cpp
parentaa859cd9b0034a3e54e422868018e1714b743156 (diff)
massive Variables-related code cleaning (removed TCHAR, manually created unions replaced with MAllString etc)
Diffstat (limited to 'plugins/Variables/src/parse_miranda.cpp')
-rw-r--r--plugins/Variables/src/parse_miranda.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index d60c02cebf..3488fd8d28 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -24,7 +24,7 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return nullptr;
- unsigned int status = ttoi(ai->targv[1]);
+ unsigned int status = ttoi(ai->argv.w[1]);
wchar_t *szStatus = Clist_GetStatusModeDescription(status, 0);
if (szStatus != nullptr)
return mir_wstrdup(szStatus);
@@ -81,13 +81,13 @@ static wchar_t* parseContact(ARGUMENTSINFO *ai)
int n = 0;
if (ai->argc == 4) {
- if (*ai->targv[3] != 'r') // random contact
+ if (*ai->argv.w[3] != 'r') // random contact
n = -1;
else
- n = ttoi(ai->targv[3]) - 1;
+ n = ttoi(ai->argv.w[3]) - 1;
}
- MCONTACT hContact = getContactFromString(ai->targv[1], getContactInfoFlags(ai->targv[2]), n);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], getContactInfoFlags(ai->argv.w[2]), n);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
@@ -100,7 +100,7 @@ static wchar_t* parseContactCount(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- int count = getContactFromString(ai->targv[1], CI_NEEDCOUNT | getContactInfoFlags(ai->targv[2]));
+ int count = getContactFromString(ai->argv.w[1], CI_NEEDCOUNT | getContactInfoFlags(ai->argv.w[2]));
return itot(count);
}
@@ -109,11 +109,11 @@ static wchar_t* parseContactInfo(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
- BYTE type = getContactInfoType(ai->targv[2]);
+ BYTE type = getContactInfoType(ai->argv.w[2]);
if (type == 0)
return nullptr;
@@ -180,23 +180,23 @@ static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
return nullptr;
MCONTACT hContact = NULL;
- if (mir_wstrlen(ai->targv[1]) > 0) {
- hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ if (mir_wstrlen(ai->argv.w[1]) > 0) {
+ hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
}
- char *szModule = mir_u2a(ai->targv[2]);
+ char *szModule = mir_u2a(ai->argv.w[2]);
if (szModule == nullptr)
return nullptr;
- char *szSetting = mir_u2a(ai->targv[3]);
+ char *szSetting = mir_u2a(ai->argv.w[3]);
if (szSetting == nullptr) {
mir_free(szModule);
return nullptr;
}
- wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : nullptr);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->argv.w[4]) > 0) ? mir_wstrdup(ai->argv.w[4]) : nullptr);
wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -209,15 +209,15 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
if (ai->argc <= 1)
return nullptr;
- MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->argv.w[2]) == 0))
szFormat = nullptr;
else
- szFormat = ai->targv[2];
+ szFormat = ai->argv.w[2];
SYSTEMTIME lsTime = { 0 };
char *szModule = SEEN_MODULE;
@@ -251,15 +251,15 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
if (ai->argc <= 1)
return nullptr;
- MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->argv.w[2]) == 0))
szFormat = nullptr;
else
- szFormat = ai->targv[2];
+ szFormat = ai->argv.w[2];
SYSTEMTIME lsTime = { 0 };
char *szModule = SEEN_MODULE;
@@ -294,7 +294,7 @@ static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return nullptr;
- MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
@@ -329,10 +329,10 @@ static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
return nullptr;
int status;
- if (ai->argc == 1 || mir_wstrlen(ai->targv[1]) == 0)
+ if (ai->argc == 1 || mir_wstrlen(ai->argv.w[1]) == 0)
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else
- status = Proto_GetStatus(_T2A(ai->targv[1]));
+ status = Proto_GetStatus(_T2A(ai->argv.w[1]));
wchar_t *szStatus = Clist_GetStatusModeDescription(status, 0);
return (szStatus != nullptr) ? mir_wstrdup(szStatus) : nullptr;
@@ -345,21 +345,21 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
const char *szRes = nullptr;
wchar_t *tszRes = nullptr;
- ptrA szProto(mir_u2a(ai->targv[1]));
+ ptrA szProto(mir_u2a(ai->argv.w[1]));
- if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
+ if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
- else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
+ else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PIUIDTEXT))) {
szRes = (const char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND || szRes == nullptr)
return nullptr;
}
- else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
+ else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PIUIDSETTING))) {
szRes = Proto_GetUniqueId(szProto);
if (szRes == nullptr)
return nullptr;
}
- else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
+ else if (!mir_wstrcmp(ai->argv.w[2], _A2W(STR_PINICK)))
tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
if (szRes == nullptr && tszRes == nullptr)
@@ -527,7 +527,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
return nullptr;
int flags = DBE_MESSAGE;
- switch (*ai->targv[2]) {
+ switch (*ai->argv.w[2]) {
case 'f':
flags |= DBE_FIRST;
break;
@@ -535,7 +535,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
flags |= DBE_LAST;
break;
}
- switch (*ai->targv[3]) {
+ switch (*ai->argv.w[3]) {
case 's':
flags |= DBE_SENT;
break;
@@ -546,7 +546,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
flags |= DBE_RCVD | DBE_SENT;
break;
}
- switch (*ai->targv[4]) {
+ switch (*ai->argv.w[4]) {
case 'r':
flags |= DBE_READ;
break;
@@ -558,7 +558,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
break;
}
- MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
+ MCONTACT hContact = getContactFromString(ai->argv.w[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return nullptr;
@@ -584,7 +584,7 @@ static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return nullptr;
- wchar_t *res = TranslateW(ai->targv[1]);
+ wchar_t *res = TranslateW(ai->argv.w[1]);
return (res == nullptr) ? nullptr : mir_wstrdup(res);
}
@@ -628,7 +628,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
wchar_t corevar[MAX_PATH];
- mir_snwprintf(corevar, L"%%%s%%", ai->targv[0]);
+ mir_snwprintf(corevar, L"%%%s%%", ai->argv.w[0]);
return Utils_ReplaceVarsW(corevar);
}
@@ -637,7 +637,7 @@ static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return nullptr;
- if (!ServiceExists(_T2A(ai->targv[1])))
+ if (!ServiceExists(_T2A(ai->argv.w[1])))
ai->flags |= AIF_FALSE;
return mir_wstrdup(L"");