summaryrefslogtreecommitdiff
path: root/plugins/MirandaG15/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-11-03 14:36:41 +0000
committerRobert Pösel <robyer@seznam.cz>2013-11-03 14:36:41 +0000
commit8e334c51bafae73d9cf3de9a0412c7a440913eb4 (patch)
treeb80ece27abeb65aa012aadcce37bdd4c29fe4d92 /plugins/MirandaG15/src
parentc1cb2e8f9b15913b0dd55af2995852da7593cb44 (diff)
MirandaG15 now works correctly (thanks to Intri for patch) and cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6753 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15/src')
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp24
-rw-r--r--plugins/MirandaG15/src/CConfig.cpp25
-rw-r--r--plugins/MirandaG15/src/CContactList.cpp2
-rw-r--r--plugins/MirandaG15/src/Miranda.cpp38
-rw-r--r--plugins/MirandaG15/src/Miranda.h1
5 files changed, 30 insertions, 60 deletions
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 8eb965f0a3..5307d78765 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -663,22 +663,20 @@ bool CAppletManager::IsUtfSendAvailable(HANDLE hContact) {
//************************************************************************
char *CAppletManager::GetMessageServiceName(HANDLE hContact,bool bIsUnicode)
{
- if(g_bUnicode) {
- char szServiceName[100];
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char szServiceName[100];
+ char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if(szProto == NULL)
- return NULL;
-
- if (!bIsUnicode)
- return PSS_MESSAGE;
+ if(szProto == NULL)
+ return NULL;
- _snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
- if (ServiceExists(szServiceName))
- return PSS_MESSAGE "W";
- } else {
+ if (!bIsUnicode)
return PSS_MESSAGE;
- }
+
+ _snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
+ if (ServiceExists(szServiceName))
+ return PSS_MESSAGE "W";
+
+ return NULL;
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp
index 76cfc68444..c41e3d8029 100644
--- a/plugins/MirandaG15/src/CConfig.cpp
+++ b/plugins/MirandaG15/src/CConfig.cpp
@@ -380,8 +380,6 @@ int CConfig::GetSampleField(int iFont)
INT_PTR CALLBACK CConfig::AppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- char buf[128];
-
switch (uMsg)
{
case WM_INITDIALOG:
@@ -759,8 +757,6 @@ INT_PTR CALLBACK CConfig::NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM w
INT_PTR CALLBACK CConfig::ContactlistDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- char buf[128];
-
switch (uMsg)
{
case WM_INITDIALOG:
@@ -919,23 +915,26 @@ void CConfig::ClearTree(HWND hTree)
void CConfig::FillDeviceBox(HWND hBox) {
CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection();
- CLCDDevice *device = NULL;
- int i = 0;
SendMessage(hBox,CB_RESETCONTENT,0,0);
- while((device = connection->GetAttachedDevice(i++)) != NULL) {
- SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
+ int count = 0;
+ for (int i = 0; i < 10; i++) {
+ CLCDDevice *device = connection->GetAttachedDevice(i);
+ if (device != NULL) {
+ SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
+ count++;
+ }
}
-
- if(i == 1) {
- SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)_T("No device attached"));
+
+ if (!count) {
+ SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)TranslateT("No device attached"));
}
int iDevice = CConfig::GetIntSetting(DEVICE);
- if( iDevice >= i)
+ if (iDevice >= count)
iDevice = 0;
- SendMessage(hBox,CB_SETCURSEL ,iDevice,0);
+ SendMessage(hBox, CB_SETCURSEL, iDevice, 0);
}
void CConfig::FillTree(HWND hTree,bool bCList)
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp
index c2ba33e529..280c9e66bc 100644
--- a/plugins/MirandaG15/src/CContactList.cpp
+++ b/plugins/MirandaG15/src/CContactList.cpp
@@ -535,6 +535,8 @@ bool CContactList::CompareEntries(CListEntry<CContactListEntry*,CContactListGrou
else
return _tcsicmp(pGroup1->strName.c_str(),pGroup2->strName.c_str())<0;
}
+
+ return false;
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/Miranda.cpp b/plugins/MirandaG15/src/Miranda.cpp
index 6776c397ef..c6dca99adb 100644
--- a/plugins/MirandaG15/src/Miranda.cpp
+++ b/plugins/MirandaG15/src/Miranda.cpp
@@ -62,7 +62,6 @@
// Variables
//************************************************************************
bool g_bInitialized;
-bool g_bUnicode;
// AppletManager object
CAppletManager* g_AppletManager;
@@ -71,13 +70,10 @@ bool g_bUnicode;
HINSTANCE hInstance;
int hLangpack;
-// Initialization Hook
-static HANDLE hMIHookModulesLoaded;
-
// {58D63981-14C1-4099-A3F7-F4FAA4C8FC59}
#define MIID_G15APPLET { 0x58d63981, 0x14c1, 0x4099, { 0xa3, 0xf7, 0xf4, 0xfa, 0xa4, 0xc8, 0xfc, 0x59 } }
-static const MUUID interfaces[] = {MIID_G15APPLET, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_G15APPLET, MIID_LAST};
static PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -88,7 +84,7 @@ static PLUGININFOEX pluginInfo = {
"mail@mkleinhans.de",
"© 2009 Martin Kleinhans",
"http://www.mkleinhans.de",
- 0, // not transient
+ UNICODE_AWARE, // not transient
// {798221E1-E47A-4dc8-9077-1E576F9C4307}
{ 0x798221e1, 0xe47a, 0x4dc8, { 0x90, 0x77, 0x1e, 0x57, 0x6f, 0x9c, 0x43, 0x7 } }
};
@@ -97,28 +93,15 @@ static PLUGININFOEX pluginInfo = {
int Init(WPARAM,LPARAM);
void UnInit();
-
-
//************************************************************************
// Exported Functions
//************************************************************************
extern "C" {
- __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void)
- {
- return interfaces;
- }
-
__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- // Are we running under Unicode Windows version ?
- g_bUnicode = (GetVersion() & 0x80000000) == 0;
- if (g_bUnicode) {
- pluginInfo.flags = 1; // UNICODE_AWARE
- }
return &pluginInfo;
}
-
// Called by Miranda to load the plugin.
// We defer initialization until Miranda's module loading process completed and return 0 to
// mark success, everything else will cause the plugin to be freed right away.
@@ -128,15 +111,7 @@ extern "C" {
InitDebug();
TRACE(_T("Plugin loaded\n"));
// Schedule actual initialization for later
- // (We don't really need the handle but want to be able to release it properly later ...)
- hMIHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, Init);
- if(hMIHookModulesLoaded == 0)
- {
- tstring text = _T("Failed to initialize the Applet.\nThe plugin will not be loaded. ");
- tstring title = _T(APP_SHORTNAME);
- MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
- return 1;
- }
+ HookEvent(ME_SYSTEM_MODULESLOADED, Init);
return 0;
}
@@ -151,7 +126,6 @@ extern "C" {
UnInit();
TRACE(_T("Unloading successful\n"));
TRACE(_T("Cleaning up: "));
- UnhookEvent(hMIHookModulesLoaded); // just to be really correct ...
UnInitDebug();
TRACE(_T("OK!\n"));
return 0;
@@ -165,7 +139,6 @@ extern "C" {
//************************************************************************
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
-
hInstance = hinstDLL;
return TRUE;
}
@@ -190,14 +163,14 @@ int Init(WPARAM wParam,LPARAM lParam)
CConfig::Initialize();
// Initialize the output object
- if(!g_AppletManager->Initialize(toTstring(APP_SHORTNAME)))
+ if(!g_AppletManager->Initialize(toTstring(APP_SHORTNAME)))
{
if(CConfig::GetBoolSetting(SKIP_DRIVER_ERROR)) {
tstring text = _T("Failed to initialize the LCD connection\n Make sure you have the newest Logitech drivers installed (>=1.03).\n");
tstring title = _T(APP_SHORTNAME);
MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
}
-
+
TRACE(_T("Initialization failed!.\n"));
return 0;
}
@@ -215,7 +188,6 @@ void UnInit(void)
{
g_AppletManager->Shutdown();
delete g_AppletManager;
- UnhookEvent(hMIHookModulesLoaded);
//#ifdef _DEBUG
// _CrtDumpMemoryLeaks();
diff --git a/plugins/MirandaG15/src/Miranda.h b/plugins/MirandaG15/src/Miranda.h
index 851da133cb..5b35db47cd 100644
--- a/plugins/MirandaG15/src/Miranda.h
+++ b/plugins/MirandaG15/src/Miranda.h
@@ -1,4 +1,3 @@
extern HINSTANCE hInstance;
extern char *MsgServiceName(HANDLE hContact,bool bIsUnicode);
-extern bool g_bUnicode;