From 26f56c43370a09117821f818ac37bf9f550085ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 13 Nov 2012 20:17:01 +0000 Subject: MobileState: Rewrited detection and added more clients. git-svn-id: http://svn.miranda-ng.org/main/trunk@2307 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MobileState/src/main.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'plugins/MobileState/src/main.cpp') diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index 0ea50726ad..f0c3bc77e9 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -18,6 +18,7 @@ */ #include "commonheaders.h" +#include "clients.h" HINSTANCE g_hInst; static HANDLE hHookModulesLoaded = NULL; @@ -53,18 +54,19 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda bool hasMobileClient(HANDLE hContact, LPARAM lParam) { char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - bool ret = false; DBVARIANT dbv; - if (!DBGetContactSettingTString(hContact, proto, "MirVer", &dbv)) - { - if (_tcsstr(dbv.ptszVal, _T("Android")) || _tcsstr(dbv.ptszVal, _T("android")) || _tcsstr(dbv.ptszVal, _T("Mobile")) || _tcsstr(dbv.ptszVal, _T("mobile"))) - ret = true; - + if (!DBGetContactSettingTString(hContact, proto, "MirVer", &dbv)) { + TCHAR *client = _tcslwr(NEWTSTR_ALLOCA(dbv.ptszVal)); DBFreeVariant(&dbv); + + for (size_t i=0; i<(sizeof(clients) / sizeof(TCHAR*)); i++) { + if (_tcsstr(client, clients[i])) { + return true; + } + } } - - return ret; + return false; } int ExtraIconsApply(WPARAM wParam, LPARAM lParam) -- cgit v1.2.3