summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP/src/copymodule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/DbEditorPP/src/copymodule.cpp')
-rw-r--r--plugins/DbEditorPP/src/copymodule.cpp53
1 files changed, 25 insertions, 28 deletions
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp
index 8e13789c0a..424b43837f 100644
--- a/plugins/DbEditorPP/src/copymodule.cpp
+++ b/plugins/DbEditorPP/src/copymodule.cpp
@@ -8,7 +8,7 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo)
return;
DBVARIANT dbv;
- for(ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) {
+ for (ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) {
if (!db_get_s(hContactFrom, module, setting->name, &dbv, 0)) {
db_set(hContactTo, module, setting->name, &dbv);
db_free(&dbv);
@@ -17,47 +17,45 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo)
FreeModuleSettingLL(&msll);
}
-INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (msg) {
+ ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ switch (uMsg) {
case WM_INITDIALOG:
- {
TranslateDialogDefault(hwnd);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- ModuleAndContact *mac = (ModuleAndContact *)lParam;
- TCHAR name[NAME_SIZE], msg[MSG_SIZE];
+ {
+ mac = (ModuleAndContact *)lParam;
+ TCHAR name[NAME_SIZE], msg[MSG_SIZE];
- mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module));
- SetWindowText(hwnd, msg);
+ mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module));
+ SetWindowText(hwnd, msg);
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- {
- if (ApplyProtoFilter(hContact))
- continue;
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ if (ApplyProtoFilter(hContact))
+ continue;
- GetContactName(hContact, NULL, name, _countof(name));
-
- int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name);
- SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact);
- }
+ GetContactName(hContact, NULL, name, _countof(name));
+
+ int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name);
+ SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact);
+ }
- GetContactName(NULL, NULL, name, _countof(name));
- int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name);
- SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0);
- SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0);
+ GetContactName(NULL, NULL, name, _countof(name));
+ int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name);
+ SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0);
+ SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0);
+ }
break;
- }
- case WM_COMMAND:
- {
- ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ case WM_COMMAND:
switch (LOWORD(wParam)) {
case CHK_COPY2ALL:
EnableWindow(GetDlgItem(hwnd, IDC_CONTACTS), BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL));
break;
case IDOK:
-
if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL)) {
MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0);
copyModule(mac->module, mac->hContact, hContact);
@@ -70,7 +68,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
refreshTree(1);
- // fall through
+ // fall through
case IDCANCEL:
mir_free(mac);
DestroyWindow(hwnd);
@@ -78,7 +76,6 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
}
break;
}
- } //switch
return 0;
}