summaryrefslogtreecommitdiff
path: root/plugins/PackUpdater/Src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/PackUpdater/Src')
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp11
-rw-r--r--plugins/PackUpdater/Src/Options.cpp114
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp10
3 files changed, 62 insertions, 73 deletions
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index 9896404b00..ac9ccdce3d 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -211,10 +211,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
static void __stdcall CreateDownloadDialog(void*)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
- else if (DBGetContactSettingByte(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED))
- {
+ else if (DBGetContactSettingByte(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
lstrcpyn(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
@@ -232,7 +231,7 @@ void DlgDownloadProc()
{
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occured while downloading the update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
{
Number = 1;
show_popup(0, Title, Text, Number, 0);
@@ -534,7 +533,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1))
rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop);
else
rc = MessageBox(NULL, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -620,7 +619,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
mir_sntprintf(tszBuff, SIZEOF(tszBuff), TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index e3634f32c5..3460ef1dcb 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -21,8 +21,7 @@ Boston, MA 02111-1307, USA.
LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
+ switch (message) {
case WM_KEYDOWN:
SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0);
break;
@@ -32,64 +31,56 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WORD i = 0;
- char str[20] = {0};
- switch (msg)
- {
+ char str[20];
+
+ switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, (int)UpdateOnStartup);
- CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, (int)OnlyOnceADay);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), UpdateOnStartup);
- CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, (int)UpdateOnPeriod);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), UpdateOnPeriod);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), UpdateOnPeriod);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), UpdateOnPeriod);
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, (int)UpdateOnStartup);
+ CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, (int)OnlyOnceADay);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), UpdateOnStartup);
+ CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, (int)UpdateOnPeriod);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), UpdateOnPeriod);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), UpdateOnPeriod);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), UpdateOnPeriod);
- SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
- SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)Period);
+ SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
+ SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)Period);
- Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PERIOD), MyEditProc);
+ Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PERIOD), MyEditProc);
- ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
- ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure);
+ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
+ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure);
- CheckDlgButton(hwndDlg, IDC_REMINDER, (int)Reminder);
- if (ServiceExists(MS_POPUP_ADDPOPUP))
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_INFO_MESSAGES2), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PROGR_DLG2), SW_HIDE);
- }
- else
- {
- for (i = 1; i < POPUPS; i++)
- {
- mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- }
+ CheckDlgButton(hwndDlg, IDC_REMINDER, (int)Reminder);
+ if ( ServiceExists(MS_POPUP_ADDPOPUP)) {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_INFO_MESSAGES2), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PROGR_DLG2), SW_HIDE);
+ }
+ else {
+ for (int i = 1; i < POPUPS; i++) {
+ mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
+ CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
}
- return TRUE;
}
+ return TRUE;
case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_UPDATEONSTARTUP:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
- }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
break;
+
case IDC_ONLYONCEADAY:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_UPDATEONPERIOD:
{
BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
@@ -99,22 +90,25 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
+
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_REMINDER:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+
case IDC_LINK_HOTKEY:
{
- OPENOPTIONSDIALOG ood = {0};
- ood.cbSize = sizeof(ood);
+ OPENOPTIONSDIALOG ood = { sizeof(ood) };
ood.pszGroup = "Customize";
ood.pszPage = "Hotkeys";
Options_Open(&ood);
- return (true);
}
+ return true;
+
case IDC_MSG_BOXES2:
case IDC_ERRORS2:
case IDC_INFO_MESSAGES2:
@@ -124,27 +118,25 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
}
break;
- }
+
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lParam;
if(hdr && hdr->code == UDN_DELTAPOS)
- {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- if (hdr && hdr->code == PSN_APPLY)
- {
+
+ if (hdr && hdr->code == PSN_APPLY) {
UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);
UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
-
+
char buffer[3] = {0};
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
Period = atoi(buffer);
PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));
-
+
InitTimer();
DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
@@ -154,10 +146,8 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
DBWriteContactSettingByte(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
DBWriteContactSettingByte(NULL, MODNAME, "Reminder", Reminder);
- if (!ServiceExists(MS_POPUP_ADDPOPUP))
- {
- for (i = 1; i < POPUPS; i++)
- {
+ if ( !ServiceExists(MS_POPUP_ADDPOPUP)) {
+ for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
}
@@ -165,7 +155,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
break;
}
- }//end* switch (msg)
+ }
return FALSE;
}
@@ -441,7 +431,7 @@ int OptInit(WPARAM wParam, LPARAM lParam)
odp.pfnDlgProc = UpdateNotifyOptsProc;
Options_AddPage(wParam, &odp);
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ if ( ServiceExists(MS_POPUP_ADDPOPUP)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.ptszGroup = LPGENT("PopUps");
odp.ptszTitle = LPGENT("Pack Updater");
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index f68f2ba46b..3b322ab4be 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -202,7 +202,7 @@ static void CheckUpdates(void *)
{
Title=TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
{
Number = 1;
show_popup(0, Title, Text, Number, 0);
@@ -268,7 +268,7 @@ static void CheckUpdates(void *)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED))
{
Number = 1;
show_popup(0, Title, Text, Number, 0);
@@ -372,7 +372,7 @@ static void CheckUpdates(void *)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
@@ -384,7 +384,7 @@ static void CheckUpdates(void *)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);
@@ -401,7 +401,7 @@ void DoCheck(int iFlag)
{
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if (ServiceExists(MS_POPUP_ADDPOPUPEX) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
+ if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED))
{
Number = 2;
show_popup(0, Title, Text, Number, 0);