summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/MobileState/src/clients.h38
-rw-r--r--plugins/MobileState/src/commonheaders.h6
-rw-r--r--plugins/MobileState/src/main.cpp18
3 files changed, 50 insertions, 12 deletions
diff --git a/plugins/MobileState/src/clients.h b/plugins/MobileState/src/clients.h
new file mode 100644
index 0000000000..5ff4ea71df
--- /dev/null
+++ b/plugins/MobileState/src/clients.h
@@ -0,0 +1,38 @@
+/*
+ Mobile State plugin for Miranda NG (www.miranda-ng.org)
+ (c) 2012 by Robert Pösel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#pragma once
+
+static const TCHAR *clients[] = {
+ _T("android"),
+ _T("mobile"),
+ _T("pda"),
+ _T("gtalk"),
+ _T("jtalk"),
+ _T("jasmine"),
+ _T("ebuddy"),
+ _T("emessenger"),
+ _T("jimm"),
+ _T("mobicq"),
+ _T("bombus"),
+ _T("colibry"),
+ _T("berry"),
+ _T("iphone"),
+ _T("ipad")
+};
diff --git a/plugins/MobileState/src/commonheaders.h b/plugins/MobileState/src/commonheaders.h
index 811c50f07f..2574df0c71 100644
--- a/plugins/MobileState/src/commonheaders.h
+++ b/plugins/MobileState/src/commonheaders.h
@@ -17,12 +17,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef COMMHEADERS_H
-#define COMMHEADERS_H
+#pragma once
#define MIRANDA_VER 0x0A00
#include <windows.h>
+#include <malloc.h>
// Miranda API headers
#include <newpluginapi.h>
@@ -38,5 +38,3 @@
#define MODULENAME "MobileState"
extern HINSTANCE g_hInst;
-
-#endif //COMMHEADERS_H
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)