summaryrefslogtreecommitdiff
path: root/plugins/QuickContacts
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 21:51:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 21:51:46 +0000
commit1fb0cd07fba1e8d6f9ac2ebe3b4f2e1c60acb81b (patch)
tree904c95b33e03e806aea734552281257768273a14 /plugins/QuickContacts
parenta8e8aebfd4f53977873c72c2d828c2c1f505f10d (diff)
- metacontacts are always present;
- added META_PROTO constant for mc module name; - MS_MC_GETPROTOCOLNAME removed, because it always returns META_PROTO git-svn-id: http://svn.miranda-ng.org/main/trunk@8319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/QuickContacts')
-rw-r--r--plugins/QuickContacts/src/commons.h2
-rw-r--r--plugins/QuickContacts/src/options.cpp63
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp37
3 files changed, 31 insertions, 71 deletions
diff --git a/plugins/QuickContacts/src/commons.h b/plugins/QuickContacts/src/commons.h
index a0577d8d72..b9c41b88e9 100644
--- a/plugins/QuickContacts/src/commons.h
+++ b/plugins/QuickContacts/src/commons.h
@@ -58,8 +58,6 @@ Boston, MA 02111-1307, USA.
// Global Variables
extern HINSTANCE hInst;
-extern char *metacontacts_proto;
-
// Copied from "../modernb/clc.h" ///////////////////////////////////////////////////////////////////
diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp
index 975c4e282a..1e69ce13df 100644
--- a/plugins/QuickContacts/src/options.cpp
+++ b/plugins/QuickContacts/src/options.cpp
@@ -92,9 +92,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
int ret = SaveOptsDlgProc(controls, SIZEOF(controls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO);
EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled);
@@ -102,52 +101,32 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS);
EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled);
-
- if (metacontacts_proto == NULL)
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_SUBCONTACTS), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), SW_HIDE);
- }
-
return TRUE;
}
- case WM_COMMAND:
- {
- if(LOWORD(wParam) == IDC_LASTSENTTO)
- {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO);
- EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOCAL), enabled);
- }
-
- if(LOWORD(wParam) == IDC_SUBCONTACTS)
- {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled);
- }
+ case WM_COMMAND:
+ if(LOWORD(wParam) == IDC_LASTSENTTO) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOCAL), enabled);
+ }
- break;
+ if(LOWORD(wParam) == IDC_SUBCONTACTS) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled);
}
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- LoadOptions();
-
- return TRUE;
- }
- }
- break;
- }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ LoadOptions();
+ return TRUE;
}
break;
}
+ break;
}
return ret;
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index 0708700494..ab849acbc0 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -21,8 +21,7 @@ Boston, MA 02111-1307, USA.
#include "commons.h"
// Prototypes ///////////////////////////////////////////////////////////////////////////
-
-
+
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -37,7 +36,6 @@ PLUGININFOEX pluginInfo={
{0xf93ba59c, 0x4f48, 0x4f2e, {0x8a, 0x91, 0x77, 0xa2, 0x80, 0x15, 0x27, 0xa3}}
};
-
HINSTANCE hInst;
HIMAGELIST hIml;
int hLangpack = 0;
@@ -61,14 +59,10 @@ int hksAction = 0;
BOOL hasNewHotkeyModule = FALSE;
-char *metacontacts_proto = NULL;
-
#define IDC_ICO 12344
-
// Functions ////////////////////////////////////////////////////////////////////////////
-
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;
@@ -202,8 +196,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
mi.ptszName = LPGENT("Quick Contacts...");
mi.pszService = MS_QC_SHOW_DIALOG;
Menu_AddMainMenuItem(&mi);
-
- metacontacts_proto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
return 0;
}
@@ -343,8 +335,7 @@ void FreeContacts()
void LoadContacts(HWND hwndDlg, BOOL show_all)
{
- BOOL metacontactsEnabled = (metacontacts_proto != NULL
- && db_get_b(0, metacontacts_proto, "Enabled", 1));
+ BOOL metacontactsEnabled = db_get_b(0, META_PROTO, "Enabled", 1);
// Read last-sent-to contact from db and set handle as window-userdata
HANDLE hlastsent = (HANDLE)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1);
@@ -366,12 +357,8 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
if ((!show_all && opts.hide_subcontacts) || opts.group_append)
hMeta = db_mc_getMeta(hContact);
}
- else
- {
- if (metacontacts_proto != NULL && strcmp(metacontacts_proto, pszProto) == 0)
- continue;
- }
-
+ else if (!strcmp(META_PROTO, pszProto))
+ continue;
if (!show_all)
{
@@ -398,17 +385,13 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
if (!opts.keep_subcontacts_from_offline)
continue;
- if (GetStatus(hMeta, metacontacts_proto) > ID_STATUS_OFFLINE)
- {
+ if (GetStatus(hMeta, META_PROTO) > ID_STATUS_OFFLINE)
+ continue;
+
+ char setting[128];
+ mir_snprintf(setting, sizeof(setting), "ShowOffline%s", META_PROTO);
+ if (db_get_b(NULL, MODULE_NAME, setting, FALSE))
continue;
- }
- else
- {
- char setting[128];
- mir_snprintf(setting, sizeof(setting), "ShowOffline%s", metacontacts_proto);
- if (db_get_b(NULL, MODULE_NAME, setting, FALSE))
- continue;
- }
}
}