summaryrefslogtreecommitdiff
path: root/src/core/stduserinfo
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/stduserinfo')
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp22
-rw-r--r--src/core/stduserinfo/src/main.cpp8
-rw-r--r--src/core/stduserinfo/src/stdafx.h11
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp8
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp6
5 files changed, 27 insertions, 28 deletions
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index 41a5c6331e..bd99b262d7 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -301,7 +301,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
for (i = 0;; i++) {
lvi.lParam = i;
mir_snprintf(idstr, "Mye-mail%d", i);
- if (db_get_ws(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ws(hContact, MODULENAME, idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
@@ -362,7 +362,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
for (i = 0;; i++) {
lvi.lParam = i;
mir_snprintf(idstr, "MyPhone%d", i);
- if (db_get_ws(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ws(hContact, MODULENAME, idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
@@ -472,14 +472,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// add
char szNewData[256] = "", idstr[33];
DBVARIANT dbv;
- if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szNewData))
+ if (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szNewData))
break;
for (i = 0;; i++) {
mir_snprintf(idstr, szIdTemplate, i);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
db_free(&dbv);
}
- db_set_s(hContact, "UserInfo", idstr, szNewData);
+ db_set_s(hContact, MODULENAME, idstr, szNewData);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
@@ -489,13 +489,13 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DBVARIANT dbv;
for (i = lvi.lParam;; i++) {
mir_snprintf(idstr, szIdTemplate, i + 1);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
mir_snprintf(idstr, szIdTemplate, i);
- db_set_s(hContact, "UserInfo", idstr, dbv.pszVal);
+ db_set_s(hContact, MODULENAME, idstr, dbv.pszVal);
db_free(&dbv);
}
mir_snprintf(idstr, szIdTemplate, i);
- db_unset(hContact, "UserInfo", idstr);
+ db_unset(hContact, MODULENAME, idstr);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
else if (hti.iSubItem - 2 == (nm->hdr.idFrom == IDC_PHONES)) {
@@ -503,12 +503,12 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
char szText[256], idstr[33];
DBVARIANT dbv;
mir_snprintf(idstr, szIdTemplate, lvi.lParam);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
mir_strncpy(szText, dbv.pszVal, _countof(szText));
db_free(&dbv);
- if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szText))
+ if (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szText))
break;
- db_set_s(hContact, "UserInfo", idstr, szText);
+ db_set_s(hContact, MODULENAME, idstr, szText);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
diff --git a/src/core/stduserinfo/src/main.cpp b/src/core/stduserinfo/src/main.cpp
index 7e7551ee97..ac767568d5 100644
--- a/src/core/stduserinfo/src/main.cpp
+++ b/src/core/stduserinfo/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadUserInfoModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{ 0x8198dc94, 0xbc4, 0x448a, { 0x84, 0x95, 0x8f, 0xe8, 0x32, 0xc1, 0xd3, 0x33 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h
index f91ec2e15f..814e260abb 100644
--- a/src/core/stduserinfo/src/stdafx.h
+++ b/src/core/stduserinfo/src/stdafx.h
@@ -41,9 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <m_core.h>
#include <newpluginapi.h>
@@ -68,4 +66,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define MODULENAME "UserInfo"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index f5eacac7a9..5892e57f6c 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
HFONT hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- ptrW szNotes(db_get_wsa(lParam, "UserInfo", "MyNotes"));
+ ptrW szNotes(db_get_wsa(lParam, MODULENAME, "MyNotes"));
if (szNotes != nullptr)
SetDlgItemText(hwndDlg, IDC_MYNOTES, szNotes);
}
@@ -576,9 +576,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) {
char text[2048];
GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, _countof(text));
- db_set_s(hContact, "UserInfo", "MyNotes", text);
+ db_set_s(hContact, MODULENAME, "MyNotes", text);
}
- else db_unset(hContact, "UserInfo", "MyNotes");
+ else db_unset(hContact, MODULENAME, "MyNotes");
break;
}
break;
@@ -608,7 +608,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam)
return 0;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = SummaryDlgProc;
odp.position = -2100000000;
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 83f50d9ef1..ab80204d29 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -118,7 +118,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)
psh.pszCaption = (wchar_t*)wParam; //more abuses of structure: this is hContact
psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
for (int i = 0; i < opi.pageCount; i++) {
//cleanup moved to WM_DESTROY
if (opi.odp[i].szGroup.w != nullptr)
@@ -265,7 +265,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
LPTSTR ptszLastTab;
DBVARIANT dbv;
- if (!db_get_ws(NULL, "UserInfo", "LastTab", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "LastTab", &dbv)) {
ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
@@ -584,7 +584,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
tvi.pszText = name;
tvi.cchTextMax = _countof(name);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi);
- db_set_ws(NULL, "UserInfo", "LastTab", name);
+ db_set_ws(NULL, MODULENAME, "LastTab", name);
Window_FreeIcon_IcoLib(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_WHITERECT, WM_GETFONT, 0, 0), 0);