From 29acecc784da7a8740481d4b6eb84f749ce35c58 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 15 Jun 2015 20:48:14 +0000 Subject: 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 --- plugins/Variables/src/parse_miranda.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'plugins') 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) -- cgit v1.2.3