diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-15 20:48:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-15 20:48:14 +0000 |
commit | 29acecc784da7a8740481d4b6eb84f749ce35c58 (patch) | |
tree | 0ff406750ed53528e52a003fd222f09d14ccc045 /plugins/Variables/src | |
parent | f4ea297307322013b3702231a5366b59f7257daa (diff) |
the best way to check the service availabililty is to call CallProtoService
git-svn-id: http://svn.miranda-ng.org/main/trunk@14184 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r-- | plugins/Variables/src/parse_miranda.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 5a682f1fa2..0457611215 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -178,7 +178,7 @@ static TCHAR* getDBSetting(MCONTACT hContact, char* module, char* setting, TCHAR if (db_get_s(hContact, module, setting, &dbv, 0))
return defaultValue;
- TCHAR* var = NULL;
+ TCHAR *var = NULL;
switch (dbv.type) {
case DBVT_BYTE:
var = itot(dbv.bVal);
@@ -423,16 +423,14 @@ static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai) if (!mir_tstrcmp(ai->targv[2], _T(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
else if (!mir_tstrcmp(ai->targv[2], _T(STR_PIUIDTEXT))) {
- if (!ProtoServiceExists(szProto, PS_GETCAPS))
- return NULL;
-
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
+ if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
+ return NULL;
}
else if (!mir_tstrcmp(ai->targv[2], _T(STR_PIUIDSETTING))) {
- if (!ProtoServiceExists(szProto, PS_GETCAPS))
- return NULL;
-
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
+ if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
+ return NULL;
}
else if (!mir_tstrcmp(ai->targv[2], _T(STR_PINICK))) {
CONTACTINFO ci;
@@ -475,13 +473,7 @@ static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL)
return NULL;
- size_t size = mir_strlen(szProto) + mir_tstrlen(szUniqueID) + 4;
- TCHAR *res = (TCHAR*)mir_alloc(size * sizeof(TCHAR));
- if (res == NULL)
- return NULL;
-
- mir_sntprintf(res, size, _T("<%S:%s>"), szProto, szUniqueID);
- return res;
+ return CMString(FORMAT, _T("<%S:%s>"), szProto, szUniqueID).Detach();
}
static BOOL isValidDbEvent(DBEVENTINFO *dbe, int flags)
|