summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp65
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp41
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.h14
3 files changed, 58 insertions, 62 deletions
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 5db6f1418c..10c1bb257d 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -594,32 +594,30 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- {
- ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), myGlobals.UseDbxTree ? SW_HIDE : SW_SHOW);
-
- SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_DLG_ANNIVERSARY, TRUE));
-
- // set colours
- SendDlgItemMessage(hDlg, EDIT_REMIND, EM_LIMITTEXT, 2, 0);
- SendDlgItemMessage(hDlg, SPIN_REMIND, UDM_SETRANGE32, 0, 50);
- SendDlgItemMessage(hDlg, EDIT_REMIND2, EM_LIMITTEXT, 4, 0);
- SendDlgItemMessage(hDlg, SPIN_REMIND2, UDM_SETRANGE32, 1, 8760);
- SendDlgItemMessage(hDlg, EDIT_REMIND_SOUNDOFFSET, EM_LIMITTEXT, 2, 0);
- SendDlgItemMessage(hDlg, SPIN_REMIND_SOUNDOFFSET, UDM_SETRANGE32, 0, 50);
-
- HWND hCtrl;
- if (hCtrl = GetDlgItem(hDlg, EDIT_REMIND_ENABLED)) {
- ComboBox_AddString(hCtrl, TranslateT("Reminder disabled"));
- ComboBox_AddString(hCtrl, TranslateT("Anniversaries only"));
- ComboBox_AddString(hCtrl, TranslateT("Birthdays only"));
- ComboBox_AddString(hCtrl, TranslateT("Everything"));
- }
- if (hCtrl = GetDlgItem(hDlg, EDIT_BIRTHMODULE)) {
- ComboBox_AddString(hCtrl, TranslateT("mBirthday"));
- ComboBox_AddString(hCtrl, TranslateT("UserInfo (default)"));
- }
- SendNotify_InfoChanged(hDlg);
+ ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), myGlobals.UseDbxTree ? SW_HIDE : SW_SHOW);
+
+ SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIcon(ICO_DLG_ANNIVERSARY, TRUE));
+
+ // set colours
+ SendDlgItemMessage(hDlg, EDIT_REMIND, EM_LIMITTEXT, 2, 0);
+ SendDlgItemMessage(hDlg, SPIN_REMIND, UDM_SETRANGE32, 0, 50);
+ SendDlgItemMessage(hDlg, EDIT_REMIND2, EM_LIMITTEXT, 4, 0);
+ SendDlgItemMessage(hDlg, SPIN_REMIND2, UDM_SETRANGE32, 1, 8760);
+ SendDlgItemMessage(hDlg, EDIT_REMIND_SOUNDOFFSET, EM_LIMITTEXT, 2, 0);
+ SendDlgItemMessage(hDlg, SPIN_REMIND_SOUNDOFFSET, UDM_SETRANGE32, 0, 50);
+
+ HWND hCtrl;
+ if (hCtrl = GetDlgItem(hDlg, EDIT_REMIND_ENABLED)) {
+ ComboBox_AddString(hCtrl, TranslateT("Reminder disabled"));
+ ComboBox_AddString(hCtrl, TranslateT("Anniversaries only"));
+ ComboBox_AddString(hCtrl, TranslateT("Birthdays only"));
+ ComboBox_AddString(hCtrl, TranslateT("Everything"));
+ }
+ if (hCtrl = GetDlgItem(hDlg, EDIT_BIRTHMODULE)) {
+ ComboBox_AddString(hCtrl, TranslateT("mBirthday"));
+ ComboBox_AddString(hCtrl, TranslateT("UserInfo (default)"));
}
+ SendNotify_InfoChanged(hDlg);
return TRUE;
case WM_NOTIFY:
@@ -678,12 +676,12 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
BYTE bOld = db_get_b(NULL, MODNAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); // = 1
BYTE bNew = (BYTE)ComboBox_GetCurSel(GetDlgItem(hDlg, EDIT_BIRTHMODULE));
if (bOld != bNew) {
- //keep the database clean
- MAnnivDate mdb;
- MCONTACT hContact = NULL;
+ // keep the database clean
DBWriteComboByte(hDlg, EDIT_BIRTHMODULE, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE);
- //walk through all the contacts stored in the DB
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+
+ // walk through all the contacts stored in the DB
+ MAnnivDate mdb;
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
mdb.DBMoveBirthDate(hContact, bOld, bNew);
}
@@ -695,14 +693,13 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
SvcReminderEnable(FALSE);
bReminderCheck = FALSE;
}
- else
- bReminderCheck = TRUE;
+ else bReminderCheck = TRUE;
}
// update all contact list extra icons
if (bReminderCheck) {
- SvcReminderEnable(TRUE); // reinit reminder options from db
- SvcReminderCheckAll(NOTIFY_CLIST); // notify
+ SvcReminderEnable(TRUE); // reinit reminder options from db
+ SvcReminderCheckAll(NOTIFY_CLIST); // notify
}
RebuildMain();
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 7651ec6d09..59420bba5c 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -388,7 +388,7 @@ static BYTE CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE
BYTE bOverflow = FALSE;
WORD wDaysEarlier;
- if ((gRemindOpts.RemindState == REMIND_ANNIV) || (gRemindOpts.RemindState == REMIND_ALL)) {
+ if (gRemindOpts.RemindState == REMIND_ANNIV || gRemindOpts.RemindState == REMIND_ALL) {
for (int i = 0; i < ANID_LAST && !mta.DBGetAnniversaryDate(hContact, i); i++) {
mta.DBGetReminderOpts(hContact);
@@ -537,8 +537,7 @@ static BYTE CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti
static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0)
{
// ignore meta subcontacts here as their birthday information are collected explicitly
- if (hContact && (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) && !db_mc_isSub(hContact))
- {
+ if (hContact && (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) && !db_mc_isSub(hContact)) {
CEvent ca;
if (CheckBirthday(hContact, Now, ca, bNotify, LastAnwer) || CheckAnniversaries(hContact, Now, ca, bNotify)) {
@@ -560,30 +559,30 @@ static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotif
void SvcReminderCheckAll(const ENotify notify)
{
- if (gRemindOpts.RemindState != REMIND_OFF) {
- CEvent evt;
- MTime now;
- WORD a1 = 0;
+ if (gRemindOpts.RemindState == REMIND_OFF)
+ return;
- now.GetLocalTime();
+ MTime now;
+ now.GetLocalTime();
- //walk through all the contacts stored in the DB
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
- CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1);
+ // walk through all the contacts stored in the DB
+ CEvent evt;
+ WORD a1 = 0;
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1);
- if (notify != NOTIFY_CLIST) {
- // play sound for the next anniversary
- NotifyWithSound(evt);
+ if (notify != NOTIFY_CLIST) {
+ // play sound for the next anniversary
+ NotifyWithSound(evt);
- // popup anniversary list
- if (db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE))
- DlgAnniversaryListShow(0, 0);
+ // popup anniversary list
+ if (db_get_b(NULL, MODNAME, SET_ANNIVLIST_POPUP, FALSE))
+ DlgAnniversaryListShow(0, 0);
- if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
- NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of"));
- }
- UpdateTimer(FALSE);
+ if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
+ NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of"));
}
+ UpdateTimer(FALSE);
}
/***********************************************************************************************************
diff --git a/plugins/UserInfoEx/src/svc_reminder.h b/plugins/UserInfoEx/src/svc_reminder.h
index 3ece0495a6..5360a33b93 100644
--- a/plugins/UserInfoEx/src/svc_reminder.h
+++ b/plugins/UserInfoEx/src/svc_reminder.h
@@ -95,14 +95,14 @@ enum ENotify
/**
* Global functions:
**/
-void SvcReminderCheckAll(const ENotify notify);
-LPCSTR SvcReminderGetMyBirthdayModule(void);
+void SvcReminderCheckAll(const ENotify notify);
+LPCSTR SvcReminderGetMyBirthdayModule(void);
-void SvcReminderOnTopToolBarLoaded(void);
-void SvcReminderOnModulesLoaded(void);
+void SvcReminderOnTopToolBarLoaded(void);
+void SvcReminderOnModulesLoaded(void);
-void SvcReminderEnable(BYTE bEnable);
-void SvcReminderLoadModule(void);
-void SvcReminderUnloadModule(void);
+void SvcReminderEnable(BYTE bEnable);
+void SvcReminderLoadModule(void);
+void SvcReminderUnloadModule(void);
#endif /* _SVCREMINDER_H_ */