summaryrefslogtreecommitdiff
path: root/plugins/ContactsPlus/src
diff options
context:
space:
mode:
authorMataes <mataes2007@gmail.com>2018-05-16 20:30:21 +0300
committerMataes <mataes2007@gmail.com>2018-05-16 20:30:21 +0300
commit20cead9e5014a830b52d74ebdfb1833eda015777 (patch)
tree6500fda8ff39d18f5b8df44dc203dcf62b028387 /plugins/ContactsPlus/src
parentb12321b9897b511e94301b73c1c48c533412d739 (diff)
Console, ContactPlus: cmplugin adaptation
ContextHelp moved to deprecated
Diffstat (limited to 'plugins/ContactsPlus/src')
-rw-r--r--plugins/ContactsPlus/src/main.cpp17
-rw-r--r--plugins/ContactsPlus/src/receive.cpp6
-rw-r--r--plugins/ContactsPlus/src/send.cpp4
-rw-r--r--plugins/ContactsPlus/src/stdafx.h9
-rw-r--r--plugins/ContactsPlus/src/utils.h2
5 files changed, 17 insertions, 21 deletions
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp
index 16bfe8a35f..157cfb460d 100644
--- a/plugins/ContactsPlus/src/main.cpp
+++ b/plugins/ContactsPlus/src/main.cpp
@@ -25,8 +25,7 @@
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
-
+CMPlugin g_plugin;
int hLangpack;
int g_Utf8EventsSupported = TRUE;
@@ -50,12 +49,6 @@ PLUGININFOEX pluginInfo = {
{ 0x0324785E, 0x74CE, 0x4600, { 0xB7, 0x81, 0x85, 0x17, 0x73, 0xB3, 0xEF, 0xC5 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
//process the event
@@ -78,7 +71,7 @@ static int HookDBEventAdded(WPARAM hContact, LPARAM hDbEvent)
CLISTEVENT cle = {};
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
- cle.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
+ cle.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_CONTACTS));
cle.pszService = MS_CONTACTS_RECEIVE;
cle.szTooltip.w = caToolTip;
cle.flags |= CLEF_UNICODE;
@@ -139,7 +132,7 @@ static int HookModulesLoaded(WPARAM, LPARAM)
mi.name.a = LPGEN("Contacts");
mi.position = -2000009990; //position in menu
mi.pszService = MS_CONTACTS_SEND;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_CONTACTS));
hContactMenuItem = Menu_AddContactMenuItem(&mi);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu);
@@ -178,7 +171,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM)
//find window for hContact
HWND hWnd = WindowList_Find(g_hSendWindowList, wParam);
if (!hWnd)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), nullptr, SendDlgProc, wParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEND), nullptr, SendDlgProc, wParam);
else {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
@@ -188,7 +181,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM)
static INT_PTR ServiceReceiveCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), nullptr, RecvDlgProc, lParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_RECEIVE), nullptr, RecvDlgProc, lParam);
return 0;
}
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp
index 5b919d71fe..144f91ce41 100644
--- a/plugins/ContactsPlus/src/receive.cpp
+++ b/plugins/ContactsPlus/src/receive.cpp
@@ -170,14 +170,14 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
{
CLISTEVENT *pcle = (CLISTEVENT*)lParam;
WindowList_Add(g_hRecvWindowList, hwndDlg, pcle->hContact);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_CONTACTS)));
EnableDlgItem(hwndDlg, IDOK, FALSE);
EnableDlgItem(hwndDlg, IDDETAILS, FALSE);
wndData = new TRecvContactsData(pcle->hContact);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)wndData);
wndData->mhDbEvent = pcle->hDbEvent; /// initialized, pcle not needed anymore
wndData->mhListIcon = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLORDDB|ILC_MASK, 0, 1);
- wndData->mhPopup = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTACTMENU));
+ wndData->mhPopup = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTACTMENU));
TranslateMenu(wndData->mhPopup);
wndData->hHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_EVENTSENT);
@@ -463,7 +463,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
case WM_SIZE:
if (!IsIconic(hwndDlg)) // make the dlg resizeable
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_RECEIVE), RecvDlg_Resize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_RECEIVE), RecvDlg_Resize);
break;
case WM_GETMINMAXINFO:
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp
index d13f37a2f3..a7955cb70b 100644
--- a/plugins/ContactsPlus/src/send.cpp
+++ b/plugins/ContactsPlus/src/send.cpp
@@ -93,7 +93,7 @@ void TSendContactsData::ShowErrorDlg(HWND hwndDlg, char* szMsg, bool bAllowRetry
ShowWindow(hwndDlg, SW_SHOWNORMAL);
EnableWindow(hwndDlg, FALSE);
if (!hError) {
- hError = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwndDlg, ErrorDlgProc, _A2T(szMsg));
+ hError = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGSENDERROR), hwndDlg, ErrorDlgProc, _A2T(szMsg));
if (!bAllowRetry)
EnableDlgItem(hError, IDOK, FALSE); // do not allow again - fatal, could not be better
}
@@ -228,7 +228,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_CONTACTS)));
SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), lParam);
WindowList_Add(g_hSendWindowList, hwndDlg, lParam);
wndData = new TSendContactsData(lParam);
diff --git a/plugins/ContactsPlus/src/stdafx.h b/plugins/ContactsPlus/src/stdafx.h
index 1a8207f470..5fce404385 100644
--- a/plugins/ContactsPlus/src/stdafx.h
+++ b/plugins/ContactsPlus/src/stdafx.h
@@ -29,8 +29,6 @@
#include <malloc.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include "newpluginapi.h"
#include "m_protosvc.h"
#include "m_database.h"
@@ -54,5 +52,12 @@
#define MODULENAME "SendReceiveContacts"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define MS_CONTACTS_SEND "ContactsTransfer/SendContacts"
#define MS_CONTACTS_RECEIVE "ContactsTransfer/ReceiveContacts"
diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h
index 6a15ed06c9..1c683db873 100644
--- a/plugins/ContactsPlus/src/utils.h
+++ b/plugins/ContactsPlus/src/utils.h
@@ -24,8 +24,6 @@
#ifndef __UTILS_H
#define __UTILS_H
-extern HINSTANCE hInst;
-
// utils.cpp
size_t __fastcall strlennull(const char *string);
int __fastcall strcmpnull(const char *str1, const char *str2);