summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/IEView/src/IEView.cpp42
-rw-r--r--plugins/IEView/src/Options.cpp296
-rw-r--r--plugins/IEView/src/ieview_main.cpp10
-rw-r--r--plugins/IEView/src/stdafx.h10
-rw-r--r--plugins/IgnoreState/src/main.cpp11
-rw-r--r--plugins/IgnoreState/src/options.cpp34
-rw-r--r--plugins/IgnoreState/src/stdafx.h11
-rw-r--r--plugins/Import/src/import.cpp14
-rw-r--r--plugins/Import/src/main.cpp16
-rw-r--r--plugins/Import/src/stdafx.h10
-rw-r--r--plugins/Import/src/utils.cpp8
-rw-r--r--plugins/Import/src/wizard.cpp4
12 files changed, 230 insertions, 236 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index 4fa21b9e8a..480d6eb554 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -39,11 +39,11 @@ static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPA
if (LOWORD(wParam) == VK_ESCAPE && !(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
SendMessage(GetParent(GetParent(GetParent(hwnd))), WM_COMMAND, IDCANCEL, 0);
break;
-
+
case WM_KEYDOWN:
view->translateAccelerator(message, wParam, lParam);
break;
-
+
case WM_SETFOCUS:
RECT rcWindow;
POINT cursor;
@@ -55,7 +55,7 @@ static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPA
if (view->setFocus((HWND)wParam))
return TRUE;
break;
-
+
case WM_LBUTTONDOWN:
POINT pt;
pt.x = LOWORD(lParam);
@@ -201,7 +201,7 @@ void IEViewSink::FileDownload(VARIANT_BOOL*) {}
static void __cdecl StartThread(void *vptr)
{
- IEView *iev = (IEView *) vptr;
+ IEView *iev = (IEView *)vptr;
iev->waitWhileBusy();
return;
}
@@ -417,12 +417,12 @@ STDMETHODIMP IEView::GetTypeInfoCount(UINT *pctinfo)
*pctinfo = 4;
return S_OK;
}
-STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO*)
-{
- return S_OK;
+STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO*)
+{
+ return S_OK;
}
STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cNames, LCID /*lcid*/, DISPID *rgDispId)
-{
+{
HRESULT retval = S_OK;
for (size_t i = 0; i < cNames; i++)
{
@@ -450,17 +450,17 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cN
retval = DISP_E_UNKNOWNNAME;
}
}
- return retval;
+ return retval;
}
STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
- REFIID /*riid*/,
- LCID /*lcid*/,
- WORD /*wFlags*/,
- DISPPARAMS *pDispParams,
- VARIANT *pVarResult,
- EXCEPINFO * /*pExcepInfo*/,
- UINT * /*puArgErr*/)
+ REFIID /*riid*/,
+ LCID /*lcid*/,
+ WORD /*wFlags*/,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO * /*pExcepInfo*/,
+ UINT * /*puArgErr*/)
{
switch (dispIdMember)
@@ -628,7 +628,7 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge
HWND hSPWnd;
pOleWindow->GetWindow(&hSPWnd);
- HMENU hMenu = GetSubMenu(LoadMenu(hInstance, MAKEINTRESOURCE(IDR_CONTEXTMENU)), 0);
+ HMENU hMenu = GetSubMenu(LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXTMENU)), 0);
TranslateMenu(hMenu);
if (dwID == 5) // anchor
EnableMenuItem(hMenu, ID_MENU_COPYLINK, MF_BYCOMMAND | MF_ENABLED);
@@ -849,7 +849,7 @@ void IEView::scrollToBottom()
}
}
}
-
+
CComPtr<IHTMLWindow2> pWindow;
if (SUCCEEDED(document->get_parentWindow(&pWindow)) && pWindow != nullptr)
pWindow->scrollBy(-0x0000FFFF, 0x0000FFFF);
@@ -934,7 +934,7 @@ void IEView::appendEvent(IEVIEWEVENT *event)
clear(event);
if (event->eventData == nullptr)
- return;
+ return;
if (builder != nullptr)
builder->appendEventNew(this, event);
@@ -959,7 +959,7 @@ void IEView::clear(IEVIEWEVENT *event)
else {
document->close();
VARIANT open_name, open_features, open_replace;
-
+
VariantInit(&open_name);
open_name.vt = VT_BSTR;
open_name.bstrVal = SysAllocString(L"_self");
@@ -1043,7 +1043,7 @@ WCHAR* IEView::getSelection()
BSTR text = nullptr;
if (FAILED(pRange->get_text(&text)))
return nullptr;
-
+
WCHAR *res = mir_wstrdup(text);
::SysFreeString(text);
return res;
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp
index 67584dad16..242222a2f9 100644
--- a/plugins/IEView/src/Options.cpp
+++ b/plugins/IEView/src/Options.cpp
@@ -338,7 +338,7 @@ static void RefreshProtoIcons()
HICON hIcon = nullptr;
if (i > 0) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if (hIcon == nullptr) {
+ if (hIcon == nullptr) {
hIcon = (HICON)CallProtoService(proto->getProtocolName(), PS_LOADICON, PLI_PROTOCOL, 0);
}
ImageList_AddIcon(hProtocolImageList, hIcon);
@@ -436,7 +436,7 @@ static bool BrowseFile(HWND hwndDlg, char *filter, char *defExt, char *path, int
int IEViewOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Message sessions");
odp.szTitle.w = LPGENW("IEView");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -519,22 +519,22 @@ static INT_PTR CALLBACK IEViewGeneralOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
return TRUE;
case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_ENABLE_BBCODES:
- case IDC_ENABLE_FLASH:
- case IDC_SMILEYS_IN_NAMES:
- case IDC_NO_BORDER:
- case IDC_EMBED_SIZE:
- MarkChanges(1, hwndDlg);
- break;
- case IDC_ENABLE_EMBED:
- MarkChanges(1, hwndDlg);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EMBED_SIZE), IsDlgButtonChecked(hwndDlg, IDC_ENABLE_EMBED));
- break;
- }
+ {
+ switch (LOWORD(wParam)) {
+ case IDC_ENABLE_BBCODES:
+ case IDC_ENABLE_FLASH:
+ case IDC_SMILEYS_IN_NAMES:
+ case IDC_NO_BORDER:
+ case IDC_EMBED_SIZE:
+ MarkChanges(1, hwndDlg);
+ break;
+ case IDC_ENABLE_EMBED:
+ MarkChanges(1, hwndDlg);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EMBED_SIZE), IsDlgButtonChecked(hwndDlg, IDC_ENABLE_EMBED));
+ break;
}
- break;
+ }
+ break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
@@ -570,112 +570,112 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
char path[MAX_PATH], filter[MAX_PATH];
switch (msg) {
case WM_INITDIALOG:
- {
- MarkInitialized(2);
- TranslateDialogDefault(hwndDlg);
- srmmCurrentProtoItem = nullptr;
- RefreshProtoList(hwndDlg, 0, true);
- return TRUE;
- }
+ {
+ MarkInitialized(2);
+ TranslateDialogDefault(hwndDlg);
+ srmmCurrentProtoItem = nullptr;
+ RefreshProtoList(hwndDlg, 0, true);
+ return TRUE;
+ }
case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_BACKGROUND_IMAGE_FILENAME:
- case IDC_EXTERNALCSS_FILENAME:
- case IDC_EXTERNALCSS_FILENAME_RTL:
- case IDC_TEMPLATES_FILENAME:
- if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
- MarkChanges(2, hwndDlg);
- break;
- case IDC_SCROLL_BACKGROUND_IMAGE:
- case IDC_LOG_SHOW_NICKNAMES:
- case IDC_LOG_SHOW_TIME:
- case IDC_LOG_SHOW_DATE:
- case IDC_LOG_SHOW_SECONDS:
- case IDC_LOG_LONG_DATE:
- case IDC_LOG_RELATIVE_DATE:
- case IDC_LOG_GROUP_MESSAGES:
+ {
+ switch (LOWORD(wParam)) {
+ case IDC_BACKGROUND_IMAGE_FILENAME:
+ case IDC_EXTERNALCSS_FILENAME:
+ case IDC_EXTERNALCSS_FILENAME_RTL:
+ case IDC_TEMPLATES_FILENAME:
+ if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
MarkChanges(2, hwndDlg);
- break;
- case IDC_BACKGROUND_IMAGE:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_MODE_COMPATIBLE) && IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_BACKGROUND_IMAGE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE), bChecked);
+ break;
+ case IDC_SCROLL_BACKGROUND_IMAGE:
+ case IDC_LOG_SHOW_NICKNAMES:
+ case IDC_LOG_SHOW_TIME:
+ case IDC_LOG_SHOW_DATE:
+ case IDC_LOG_SHOW_SECONDS:
+ case IDC_LOG_LONG_DATE:
+ case IDC_LOG_RELATIVE_DATE:
+ case IDC_LOG_GROUP_MESSAGES:
+ MarkChanges(2, hwndDlg);
+ break;
+ case IDC_BACKGROUND_IMAGE:
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_MODE_COMPATIBLE) && IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_BACKGROUND_IMAGE), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE), bChecked);
+ MarkChanges(2, hwndDlg);
+ break;
+ case IDC_BROWSE_TEMPLATES:
+ mir_snprintf(filter, "%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
+ SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
+ UpdateTemplateIcons(hwndDlg, path);
MarkChanges(2, hwndDlg);
- break;
- case IDC_BROWSE_TEMPLATES:
- mir_snprintf(filter, "%s (*.ivt)%c*.ivt%c%s (*.*)%c*.*%c%c", Translate("Template"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "ivt", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path);
- UpdateTemplateIcons(hwndDlg, path);
- MarkChanges(2, hwndDlg);
- }
- break;
- case IDC_BROWSE_BACKGROUND_IMAGE:
- mir_snprintf(filter, "%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
- MarkChanges(2, hwndDlg);
- }
- break;
- case IDC_BROWSE_EXTERNALCSS:
- mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
- MarkChanges(2, hwndDlg);
- }
- break;
- case IDC_BROWSE_EXTERNALCSS_RTL:
- mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
- if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
- SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
- MarkChanges(2, hwndDlg);
- }
- break;
- case IDC_MODE_COMPATIBLE:
- case IDC_MODE_CSS:
- case IDC_MODE_TEMPLATE:
- UpdateControlsState(hwndDlg);
+ }
+ break;
+ case IDC_BROWSE_BACKGROUND_IMAGE:
+ mir_snprintf(filter, "%s (*.jpg,*.jpeg,*.gif,*.png,*.bmp)%c*.jpg;*.jpeg;*.gif;*.png;*.bmp%c%s (*.*)%c*.*%c%c", Translate("All Images"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "jpg", path, _countof(path))) {
+ SetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path);
+ MarkChanges(2, hwndDlg);
+ }
+ break;
+ case IDC_BROWSE_EXTERNALCSS:
+ mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
+ SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path);
MarkChanges(2, hwndDlg);
- break;
- case IDC_GETTEMPLATES:
- Utils_OpenUrl("https://miranda-ng.org/addons/category/16");
- break;
}
+ break;
+ case IDC_BROWSE_EXTERNALCSS_RTL:
+ mir_snprintf(filter, "%s (*.css)%c*.css%c%s (*.*)%c*.*%c%c", Translate("Style Sheet"), 0, 0, Translate("All Files"), 0, 0, 0);
+ if (BrowseFile(hwndDlg, filter, "css", path, _countof(path))) {
+ SetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path);
+ MarkChanges(2, hwndDlg);
+ }
+ break;
+ case IDC_MODE_COMPATIBLE:
+ case IDC_MODE_CSS:
+ case IDC_MODE_TEMPLATE:
+ UpdateControlsState(hwndDlg);
+ MarkChanges(2, hwndDlg);
+ break;
+ case IDC_GETTEMPLATES:
+ Utils_OpenUrl("https://miranda-ng.org/addons/category/16");
+ break;
}
- break;
+ }
+ break;
case UM_CHECKSTATECHANGE:
- {
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != nullptr)
- if (strcmpi(proto->getProtocolName(), "_default_"))
- proto->setSRMMEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
-
- if ((HTREEITEM)lParam != TreeView_GetSelection((HWND)wParam))
- TreeView_SelectItem((HWND)wParam, (HTREEITEM)lParam);
- else
- UpdateSRMMProtoInfo(hwndDlg, proto);
+ {
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
+ if (proto != nullptr)
+ if (strcmpi(proto->getProtocolName(), "_default_"))
+ proto->setSRMMEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
- MarkChanges(2, hwndDlg);
- }
- break;
+ if ((HTREEITEM)lParam != TreeView_GetSelection((HWND)wParam))
+ TreeView_SelectItem((HWND)wParam, (HTREEITEM)lParam);
+ else
+ UpdateSRMMProtoInfo(hwndDlg, proto);
+
+ MarkChanges(2, hwndDlg);
+ }
+ break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == IDC_PROTOLIST) {
switch (((LPNMHDR)lParam)->code) {
case NM_CLICK:
- {
- TVHITTESTINFO ht = { 0 };
- DWORD dwpos = GetMessagePos();
- POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
- MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
- TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
- if (TVHT_ONITEMSTATEICON & ht.flags) {
- PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
- return FALSE;
- }
+ {
+ TVHITTESTINFO ht = { 0 };
+ DWORD dwpos = GetMessagePos();
+ POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
+ MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
+ TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
+ if (TVHT_ONITEMSTATEICON & ht.flags) {
+ PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
+ return FALSE;
}
- break;
+ }
+ break;
case TVN_KEYDOWN:
if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
@@ -683,7 +683,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar
break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
+ ProtocolSettings * proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveSRMMProtoSettings(hwndDlg, srmmCurrentProtoItem);
UpdateSRMMProtoInfo(hwndDlg, proto);
break;
@@ -797,18 +797,18 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
if (((LPNMHDR)lParam)->idFrom == IDC_PROTOLIST) {
switch (((LPNMHDR)lParam)->code) {
case NM_CLICK:
- {
- TVHITTESTINFO ht = { 0 };
- DWORD dwpos = GetMessagePos();
- POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
- MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
- TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
- if (TVHT_ONITEMSTATEICON & ht.flags) {
- PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
- return FALSE;
- }
+ {
+ TVHITTESTINFO ht = { 0 };
+ DWORD dwpos = GetMessagePos();
+ POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
+ MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
+ TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
+ if (TVHT_ONITEMSTATEICON & ht.flags) {
+ PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
+ return FALSE;
}
- break;
+ }
+ break;
case TVN_KEYDOWN:
if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
@@ -816,7 +816,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
+ ProtocolSettings * proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveHistoryProtoSettings(hwndDlg, historyCurrentProtoItem);
UpdateHistoryProtoInfo(hwndDlg, proto);
break;
@@ -911,38 +911,38 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA
break;
case UM_CHECKSTATECHANGE:
- {
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
- if (proto != nullptr)
- if (strcmpi(proto->getProtocolName(), "_default_"))
- proto->setChatEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
+ {
+ ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM)lParam);
+ if (proto != nullptr)
+ if (strcmpi(proto->getProtocolName(), "_default_"))
+ proto->setChatEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM)lParam));
- if ((HTREEITEM)lParam != TreeView_GetSelection((HWND)wParam)) {
- TreeView_SelectItem((HWND)wParam, (HTREEITEM)lParam);
- }
- else {
- UpdateChatProtoInfo(hwndDlg, proto);
- }
- MarkChanges(8, hwndDlg);
+ if ((HTREEITEM)lParam != TreeView_GetSelection((HWND)wParam)) {
+ TreeView_SelectItem((HWND)wParam, (HTREEITEM)lParam);
}
- break;
+ else {
+ UpdateChatProtoInfo(hwndDlg, proto);
+ }
+ MarkChanges(8, hwndDlg);
+ }
+ break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == IDC_PROTOLIST) {
switch (((LPNMHDR)lParam)->code) {
case NM_CLICK:
- {
- TVHITTESTINFO ht = { 0 };
- DWORD dwpos = GetMessagePos();
- POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
- MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
- TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
- if (TVHT_ONITEMSTATEICON & ht.flags) {
- PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
- return FALSE;
- }
+ {
+ TVHITTESTINFO ht = { 0 };
+ DWORD dwpos = GetMessagePos();
+ POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
+ MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);
+ TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
+ if (TVHT_ONITEMSTATEICON & ht.flags) {
+ PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)ht.hItem);
+ return FALSE;
}
- break;
+ }
+ break;
case TVN_KEYDOWN:
if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
PostMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
@@ -950,7 +950,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA
break;
case TVN_SELCHANGED:
- ProtocolSettings *proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
+ ProtocolSettings * proto = (ProtocolSettings *)GetItemParam(GetDlgItem(hwndDlg, IDC_PROTOLIST), (HTREEITEM)nullptr);
SaveChatProtoSettings(hwndDlg, chatCurrentProtoItem);
UpdateChatProtoInfo(hwndDlg, proto);
break;
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp
index 2653da6948..544f3a1382 100644
--- a/plugins/IEView/src/ieview_main.cpp
+++ b/plugins/IEView/src/ieview_main.cpp
@@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
-HINSTANCE hInstance;
CLIST_INTERFACE *pcli;
char *workingDirUtf8;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfoEx = {
{ 0x0495171b, 0x7137, 0x4ded, { 0x97, 0xf8, 0xce, 0x6f, 0xed, 0x67, 0xd6, 0x91 } }
};
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID)
-{
- hInstance = hModule;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -84,7 +78,7 @@ extern "C" int __declspec(dllexport) Load(void)
CreateServiceFunction(MS_IEVIEW_NAVIGATE, HandleIENavigate);
CreateServiceFunction("IEView/ReloadOptions", ReloadOptions);
hHookOptionsChanged = CreateHookableEvent(ME_IEVIEW_OPTIONSCHANGED);
- Icon_Register(hInstance, ieviewModuleName, iconList, _countof(iconList), ieviewModuleName);
+ Icon_Register(g_plugin.getInst(), ieviewModuleName, iconList, _countof(iconList), ieviewModuleName);
return 0;
}
diff --git a/plugins/IEView/src/stdafx.h b/plugins/IEView/src/stdafx.h
index 6faffa62fd..e80200df80 100644
--- a/plugins/IEView/src/stdafx.h
+++ b/plugins/IEView/src/stdafx.h
@@ -36,8 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <io.h>
#include <fcntl.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clistint.h>
#include <m_langpack.h>
@@ -76,7 +74,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ieviewModuleName "IEVIEW"
-extern HINSTANCE hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ieviewModuleName)
+ {}
+};
+
extern IEView *debugView;
extern char *workingDirUtf8;
extern HANDLE hHookOptionsChanged;
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp
index ef00426533..bdf90c3e97 100644
--- a/plugins/IgnoreState/src/main.cpp
+++ b/plugins/IgnoreState/src/main.cpp
@@ -20,12 +20,11 @@
#include "stdafx.h"
-HINSTANCE g_hInst;
-
HANDLE hIcoLibIconsChanged = nullptr;
HANDLE hHookExtraIconsRebuild = nullptr, hHookExtraIconsApply = nullptr, hContactSettingChanged = nullptr;
HANDLE hPrebuildContactMenu = nullptr;
HANDLE hExtraIcon = nullptr;
+CMPlugin g_plugin;
int hLangpack;
INT currentFilter = 0;
@@ -60,12 +59,6 @@ PLUGININFOEX pluginInfo = {
{ 0xa6872bcd, 0xf2a1, 0x41b8, { 0xb2, 0xf1, 0xdd, 0x7c, 0xec, 0x05, 0x57, 0x34 } }
};
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -166,7 +159,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
//IcoLib support
- Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Ignore State"), iconList, _countof(iconList));
hExtraIcon = ExtraIcon_RegisterIcolib("ignore", LPGEN("Ignore State"), "ignore_full");
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp
index db24cf3045..8db1304186 100644
--- a/plugins/IgnoreState/src/options.cpp
+++ b/plugins/IgnoreState/src/options.cpp
@@ -74,23 +74,23 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- DWORD flags = 0;
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
- tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
- while (tvi.hItem) {
- TreeView_GetItem(hTree, &tvi);
- if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
- tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
- }
- db_set_dw(NULL, MODULENAME, "Filter", flags);
-
- bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
- db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
-
- fill_filter();
+ {
+ DWORD flags = 0;
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TBIF_LPARAM;
+ tvi.hItem = TreeView_GetRoot(hTree); //check ignore all
+ while (tvi.hItem) {
+ TreeView_GetItem(hTree, &tvi);
+ if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
}
+ db_set_dw(NULL, MODULENAME, "Filter", flags);
+
+ bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
+ db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+
+ fill_filter();
+ }
}
case IDC_FILTER:
if (((LPNMHDR)lParam)->code == NM_CLICK)
@@ -104,7 +104,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.szGroup.a = LPGEN("Icons");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_IGNORE_OPT);
diff --git a/plugins/IgnoreState/src/stdafx.h b/plugins/IgnoreState/src/stdafx.h
index 765038ff49..24925c1310 100644
--- a/plugins/IgnoreState/src/stdafx.h
+++ b/plugins/IgnoreState/src/stdafx.h
@@ -25,8 +25,6 @@
#include <windows.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -41,6 +39,13 @@
#define MODULENAME "IgnoreState"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
struct IGNOREITEMS
{
wchar_t* name;
@@ -54,8 +59,6 @@ extern int nII;
static byte bUseMirandaSettings;
-extern HINSTANCE g_hInst;
-
void applyExtraImage(MCONTACT hContact);
int onOptInitialise(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 1e54739a08..bbc55b940c 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -43,11 +43,13 @@ struct AccountMap
};
static int CompareAccs(const AccountMap *p1, const AccountMap *p2)
-{ return mir_strcmpi(p1->szSrcAcc, p2->szSrcAcc);
+{
+ return mir_strcmpi(p1->szSrcAcc, p2->szSrcAcc);
}
static int CompareAccByIds(const AccountMap *p1, const AccountMap *p2)
-{ return p1->iOrder - p2->iOrder;
+{
+ return p1->iOrder - p2->iOrder;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -251,7 +253,7 @@ static LRESULT CALLBACK ListWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
SendMessage(hwndCombo, WM_KILLFOCUS, 0, (LPARAM)hwndCombo);
hwndCombo = CreateWindowEx(WS_EX_CLIENTEDGE, WC_COMBOBOX, L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
- r.left + 3, r.top, r.right - r.left - 3, r.bottom - r.top, hwnd, nullptr, hInst, nullptr);
+ r.left + 3, r.top, r.right - r.left - 3, r.bottom - r.top, hwnd, nullptr, g_plugin.getInst(), nullptr);
// copy a font from listview
HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
@@ -461,7 +463,7 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules)
// all accounts to be converted automatically, no need to raise a dialog
if (bNeedManualMerge)
- if (DialogBox(hInst, MAKEINTRESOURCE(IDD_ACCMERGE), nullptr, AccountsMatcherProc) != IDOK)
+ if (DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ACCMERGE), nullptr, AccountsMatcherProc) != IDOK)
return false;
bool bImportSysAll = (nImportOptions & IOPT_SYS_SETTINGS) != 0;
@@ -552,7 +554,7 @@ int ModulesEnumProc(const char *szModuleName, void *pParam)
CopySettings(icd->from, szModuleName, icd->to, icd->szDstProto);
}
else CopySettings(icd->from, szModuleName, icd->to, szModuleName);
-
+
return 0;
}
@@ -976,7 +978,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
nDupes++;
continue;
}
-
+
// no need to display all these dialogs again
if (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_ADDED)
dbei.flags |= DBEF_READ;
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp
index 3e6a15fdfb..c3025c70bb 100644
--- a/plugins/Import/src/main.cpp
+++ b/plugins/Import/src/main.cpp
@@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int nImportOptions;
-HINSTANCE hInst;
INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
bool g_bServiceMode = false, g_bSendQuit = false;
HWND hwndWizard, hwndAccMerge;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo =
@@ -45,12 +45,6 @@ PLUGININFOEX pluginInfo =
{0x2d77a746, 0xa6, 0x4343, {0xbf, 0xc5, 0xf8, 0x8, 0xcd, 0xd7, 0x72, 0xea}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
static INT_PTR ImportCommand(WPARAM, LPARAM)
{
if (IsWindow(hwndWizard)) {
@@ -59,7 +53,7 @@ static INT_PTR ImportCommand(WPARAM, LPARAM)
}
else {
WizardDlgParam param = { IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc };
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)&param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)&param);
}
return 0;
@@ -121,14 +115,14 @@ static INT_PTR ServiceMode(WPARAM, LPARAM)
wcsncpy_s(importFile, MAX_PATH, wszFullName, _TRUNCATE);
WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc };
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(&param));
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(&param));
return SERVICE_CONTINUE;
}
g_bSendQuit = true;
WizardDlgParam param = { IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc };
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)&param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, (LPARAM)&param);
return SERVICE_ONLYDB;
}
@@ -139,7 +133,7 @@ static INT_PTR CustomImport(WPARAM wParam, LPARAM)
nImportOptions = opts->dwFlags;
WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc };
- return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(&param));
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(&param));
}
extern "C" __declspec(dllexport) int Load(void)
diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h
index 73d12fe83d..822cf6721e 100644
--- a/plugins/Import/src/stdafx.h
+++ b/plugins/Import/src/stdafx.h
@@ -30,8 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <malloc.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <win2k.h>
#include <newpluginapi.h>
#include <m_langpack.h>
@@ -56,6 +54,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define IMPORT_MODULE "MIMImport" // Module name
#define IMPORT_SERVICE "MIMImport/Import" // Service for menu item
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(IMPORT_MODULE)
+ {}
+};
+
// Keys
#define IMP_KEY_FR "FirstRun" // First run
@@ -86,7 +91,6 @@ bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei);
int CreateGroup(const wchar_t *name, MCONTACT hContact);
-extern HINSTANCE hInst;
extern HWND hwndWizard, hwndAccMerge;
extern int nImportOptions;
extern wchar_t importFile[];
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index ee85e71287..a96fafebd5 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -51,9 +51,9 @@ int CreateGroup(const wchar_t *group, MCONTACT hContact)
static bool IsEqualEvent(const DBEVENTINFO &ev1, const DBEVENTINFO &ev2)
{
return (ev1.timestamp == ev2.timestamp &&
- ev1.eventType == ev2.eventType &&
- ev1.cbBlob == ev2.cbBlob &&
- (ev1.flags & DBEF_SENT) == (ev2.flags & DBEF_SENT));
+ ev1.eventType == ev2.eventType &&
+ ev1.cbBlob == ev2.cbBlob &&
+ (ev1.flags & DBEF_SENT) == (ev2.flags & DBEF_SENT));
}
// Returns TRUE if the event already exist in the database
@@ -206,5 +206,5 @@ HANDLE GetIconHandle(int iIconId)
void RegisterIcons()
{
- Icon_Register(hInst, "Import", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "Import", iconList, _countof(iconList));
}
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp
index b264818be6..7849b9292d 100644
--- a/plugins/Import/src/wizard.cpp
+++ b/plugins/Import/src/wizard.cpp
@@ -64,7 +64,7 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case IDCANCEL:
if (IsDlgButtonChecked(hdlg, IDC_DONTLOADPLUGIN)) {
char sModuleFileName[MAX_PATH];
- GetModuleFileNameA(hInst, sModuleFileName, sizeof(sModuleFileName));
+ GetModuleFileNameA(g_plugin.getInst(), sModuleFileName, sizeof(sModuleFileName));
char *pszFileName = strrchr(sModuleFileName, '\\');
if (pszFileName == nullptr)
pszFileName = sModuleFileName;
@@ -112,7 +112,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
EnableWindow(GetDlgItem(hdlg, IDOK), TRUE);
EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE);
SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel"));
- hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
+ hwndPage = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
SetWindowPos(hwndPage, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hwndPage, SW_SHOW);
if (bFirstLaunch)