summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-02 12:47:51 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-02 12:47:51 +0300
commit95332e6d7069dccc8007395e1bf885fe24b25d7a (patch)
treeacc9114db5ea8a0aaad480fa32dd61b21a424012 /plugins/UserInfoEx/src
parentf8f31804a06f1944353a69e05eb30a0278c64415 (diff)
UInfoEx: the idea of backing up birthdays conflicts with the current birthdays' storage schema
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp95
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp8
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp6
-rw-r--r--plugins/UserInfoEx/src/resource.h1
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp44
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.h1
6 files changed, 5 insertions, 150 deletions
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index c237fbb343..5bbd5f6132 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -617,110 +617,23 @@ int MAnnivDate::DBWriteAnniversaryDate(MCONTACT hContact, uint16_t wIndex)
static uint16_t AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *pNewProtoDate)
{
- MSGBOX MB;
- wchar_t szMsg[MAXDATASIZE];
- wchar_t szDate[MAX_PATH];
- wchar_t szoldDate[MAX_PATH];
-
+ wchar_t szDate[MAX_PATH], szoldDate[MAX_PATH];
pOldCustomDate->DateFormat(szoldDate, _countof(szoldDate));
pNewProtoDate->DateFormat(szDate, _countof(szDate));
+ wchar_t szMsg[MAXDATASIZE];
mir_snwprintf(szMsg,
TranslateT("%s provides a new birthday via protocol.\nIt is %s. The old one was %s.\n\nDo you want to use this as the new birthday for this contact?"),
Clist_GetContactDisplayName(hContact), szDate, szoldDate);
+ MSGBOX MB;
MB.cbSize = sizeof(MSGBOX);
MB.hParent = nullptr;
MB.hiLogo = g_plugin.getIcon(IDI_ANNIVERSARY);
MB.hiMsg = nullptr;
- MB.uType = MB_YESALLNO|MB_ICON_QUESTION|MB_INFOBAR|MB_NOPOPUP;
+ MB.uType = MB_YESALLNO | MB_ICON_QUESTION | MB_INFOBAR | MB_NOPOPUP;
MB.ptszTitle = LPGENW("Update custom birthday");
MB.ptszInfoText = LPGENW("Keeps your custom birthday up to date.");
MB.ptszMsg = szMsg;
return MsgBoxService(NULL, (LPARAM)&MB);
}
-
-/**
- * name: BackupBirthday
- * class: MAnnivDate
- * desc: tries to read birthday date from protocol and compares it with the classes date
- * param: hContact - handle to a contact to read the date from
- * pszProto - basic protocol module
- * return: 0 if backup was done, 1 otherwise
- **/
-
-int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const uint8_t bDontIgnoreAnything, PWORD lastAnswer)
-{
- if (!hContact)
- return 1;
-
- // This birthday is a protocol based or metasubcontact's anniversary and no custom information exist,
- // so directly back it up under all circumstances!
- if ( _wFlags & (MADF_HASPROTO | MADF_HASMETA)) {
- if (lastAnswer == nullptr) {
- DBWriteDateStamp(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
- DBWriteBirthDate(hContact);
- }
- return 1;
- }
-
- // A custom birthday was set by user before and is not to be ignored
- if ((_wFlags & MADF_HASCUSTOM) && (bDontIgnoreAnything || !lastAnswer || (*lastAnswer != IDNONE))) {
- if (!pszProto)
- pszProto = Proto_GetBaseAccountName(hContact);
-
- if (pszProto) {
- uint8_t bIsMeta = DB::Module::IsMeta(pszProto);
- uint8_t bIsMetaSub = !bIsMeta && db_mc_isSub(hContact);
- MAnnivDate mdbNewProto;
- MAnnivDate mdbIgnore;
-
- const int nSubContactCount = (bIsMeta) ? db_mc_getSubCount(hContact) : 0;
-
- uint8_t bWantBackup = !mdbNewProto.DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)
- && !IsEqual(mdbNewProto.SystemTime())
- && (bDontIgnoreAnything || (db_get_dw(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbNewProto.DateStamp()))
- && !bIsMetaSub;
-
- // allow backup only, if the custom setting differs from all meta subcontacts' protocol based settings, too.
- for (int i = 0; (i < nSubContactCount) && bWantBackup && bIsMeta; i++) {
- MCONTACT hSubContact = db_mc_getSub(hContact, i);
- if (hSubContact && !mdbIgnore.DBGetDate(hSubContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
- bWantBackup = bWantBackup
- && !IsEqual(mdbIgnore.SystemTime())
- && (bDontIgnoreAnything || (db_get_dw(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED, 0) != mdbIgnore.DateStamp()));
- }
- if (bWantBackup) {
- if (!lastAnswer || *lastAnswer != IDALL) {
- uint16_t rc = AskUser(hContact, this, &mdbNewProto);
- if (lastAnswer)
- *lastAnswer = rc;
-
- if (IDYES != rc && IDALL != rc) {
- // special handling for metasubcontacts required?!
- mdbNewProto.DBWriteDateStamp(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
- bWantBackup = FALSE;
- }
- }
- if (bWantBackup) {
- Set(mdbNewProto);
- DBWriteDateStamp(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
- DBWriteBirthDate(hContact);
-
- // update metasubcontacts
- for (int i = 0; i < nSubContactCount; i++) {
- MCONTACT hSubContact = db_mc_getSub(hContact, i);
- if (hSubContact) {
- if (!mdbIgnore.DBGetDate(hSubContact, Proto_GetBaseAccountName(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
- mdbIgnore.DBWriteDateStamp(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
-
- DBWriteBirthDate(hSubContact);
- }
- }
- return 0;
- }
- }
- }
- }
- return 1;
-}
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index 4e5544934f..97d5a0111e 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -243,14 +243,6 @@ void RebuildMain()
g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) &&
g_plugin.getByte(SET_REMIND_MENUENABLED, DEFVAL_REMIND_MENUENABLED);
if (bRemindMenus) {
- // make backup of each protocol based birthday
- SET_UID(mi, 0x67980bea, 0x8fca, 0x4642, 0x96, 0x78, 0x6a, 0xc0, 0xe3, 0x74, 0x4c, 0x2a);
- mi.pszService = MS_USERINFO_REMINDER_AGGRASIVEBACKUP;
- mi.name.a = LPGEN("Backup birthdays");
- mi.position = 500253000;
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_BIRTHDAY_BACKUP);
- hMenuItem[item++] = Menu_AddMainMenuItem(&mi);
-
// Check anniversaries
SET_UID(mi, 0xcc1c8aa1, 0x7d1, 0x4554, 0x9c, 0xfe, 0xc4, 0x1e, 0xb9, 0x5d, 0x4a, 0xf);
mi.pszService = MS_USERINFO_REMINDER_CHECK;
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index f3c0b500c7..697c838f1b 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -536,7 +536,6 @@ 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), SW_SHOW);
SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_ANNIVERSARY, true));
@@ -568,7 +567,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
DBGetCheckBtn(hDlg, CHECK_REMIND_FLASHICON, SET_REMIND_FLASHICON, FALSE);
DBGetCheckBtn(hDlg, CHECK_REMIND_VISIBLEONLY, SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE);
DBGetCheckBtn(hDlg, CHECK_REMIND_STARTUP, SET_REMIND_CHECKON_STARTUP, FALSE);
- DBGetCheckBtn(hDlg, CHECK_REMIND_SECURED, SET_REMIND_SECUREBIRTHDAY, FALSE);
SetDlgItemInt(hDlg, EDIT_REMIND, g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, g_plugin.getByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
@@ -597,7 +595,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
DBWriteCheckBtn(hDlg, CHECK_REMIND_FLASHICON, SET_REMIND_FLASHICON);
DBWriteCheckBtn(hDlg, CHECK_REMIND_VISIBLEONLY, SET_REMIND_CHECKVISIBLE);
DBWriteCheckBtn(hDlg, CHECK_REMIND_STARTUP, SET_REMIND_CHECKON_STARTUP);
- DBWriteCheckBtn(hDlg, CHECK_REMIND_SECURED, SET_REMIND_SECUREBIRTHDAY);
DBWriteEditByte(hDlg, EDIT_REMIND_SOUNDOFFSET, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET);
DBWriteEditWord(hDlg, EDIT_REMIND2, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL);
@@ -633,7 +630,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
CHECK_REMIND_MI, EDIT_REMIND, EDIT_REMIND2, SPIN_REMIND, SPIN_REMIND2, TXT_REMIND,
TXT_REMIND2, TXT_REMIND3, TXT_REMIND4, TXT_REMIND6, TXT_REMIND8, TXT_REMIND9,
TXT_REMIND_LASTCHECK, CHECK_REMIND_FLASHICON, CHECK_REMIND_VISIBLEONLY,
- CHECK_REMIND_SECURED, CHECK_REMIND_STARTUP, EDIT_REMIND_SOUNDOFFSET, SPIN_REMIND_SOUNDOFFSET
+ CHECK_REMIND_STARTUP, EDIT_REMIND_SOUNDOFFSET, SPIN_REMIND_SOUNDOFFSET
};
EnableControls(hDlg, idCtrl, _countof(idCtrl), bEnabled);
@@ -644,7 +641,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
case CHECK_REMIND_FLASHICON:
case CHECK_REMIND_VISIBLEONLY:
case CHECK_REMIND_STARTUP:
- case CHECK_REMIND_SECURED:
if (bInitialized && HIWORD(wParam) == BN_CLICKED)
NotifyParentOfChange(hDlg);
break;
diff --git a/plugins/UserInfoEx/src/resource.h b/plugins/UserInfoEx/src/resource.h
index 19246a14db..8a97761ddd 100644
--- a/plugins/UserInfoEx/src/resource.h
+++ b/plugins/UserInfoEx/src/resource.h
@@ -276,7 +276,6 @@
#define CHECK_SMS 40104
#define CHECK_REMIND_STARTUP 40104
#define CHECK_OPT_DETECTUTF 40105
-#define CHECK_REMIND_SECURED 40105
#define CHECK_REMIND_HIDDEN 40106
#define CHECK_REMIND_VISIBLEONLY 40106
#define CHECK_OPT_ICOVERSION 40108
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index e5cc1dad7a..ba2d059ead 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -449,10 +449,6 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, uint8_t bN
mtb.DBGetReminderOpts(hContact);
- // make backup of each protocol based birthday
- if (g_plugin.getByte(SET_REMIND_SECUREBIRTHDAY, TRUE))
- mtb.BackupBirthday(hContact, nullptr, 0, LastAnwer);
-
if (mtb.RemindOption() != BST_UNCHECKED) {
uint16_t wDaysEarlier = (mtb.RemindOption() == BST_CHECKED) ? mtb.RemindOffset() : -1;
if (wDaysEarlier == (uint16_t)-1)
@@ -674,45 +670,6 @@ static INT_PTR CheckService(WPARAM, LPARAM)
return 0;
}
-/**
-* This is the service function for MS_USERINFO_REMINDER_AGGRASIVEBACKUP.
-*
-* @param hContact - handle to single contact or NULL to backup all
-* @param lParam - if 1, the messagebox will not be displayed
-*
-* return: 0
-**/
-
-static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam)
-{
- MAnnivDate mdb;
-
- if (hContact) {
- if (!mdb.DBGetBirthDate(hContact))
- mdb.BackupBirthday(hContact, nullptr, TRUE);
- }
- else {
- uint16_t a1 = 0;
-
- // walk through all the contacts stored in the DB
- for (auto &cc : Contacts())
- if (!db_mc_isSub(cc) && !mdb.DBGetBirthDate(cc))
- mdb.BackupBirthday(cc, nullptr, TRUE, &a1);
- }
-
- if (lParam != TRUE) {
- MSGBOX mBox;
- mBox.cbSize = sizeof(MSGBOX);
- mBox.hParent = nullptr;
- mBox.hiLogo = g_plugin.getIcon(IDI_BIRTHDAY);
- mBox.uType = MB_ICON_INFO;
- mBox.ptszTitle = TranslateT("Update custom birthday");
- mBox.ptszMsg = TranslateT("Backing up and syncing all birthdays complete!");
- MsgBoxService(NULL, (LPARAM)&mBox);
- }
- return 0;
-}
-
/***********************************************************************************************************
* timer stuff
***********************************************************************************************************/
@@ -850,7 +807,6 @@ void SvcReminderLoadModule(void)
// create service functions
CreateServiceFunction(MS_USERINFO_REMINDER_CHECK, CheckService);
- CreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService);
// register hotkey
HOTKEYDESC hk = {};
diff --git a/plugins/UserInfoEx/src/svc_reminder.h b/plugins/UserInfoEx/src/svc_reminder.h
index c177d0d29e..f162800866 100644
--- a/plugins/UserInfoEx/src/svc_reminder.h
+++ b/plugins/UserInfoEx/src/svc_reminder.h
@@ -50,7 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SET_REMIND_BIRTHDAY_ENABLED "RemindBirthday"
#define SET_REMIND_BIRTHDAY_OFFSET "RemindBirthdayOffset"
#define SET_REMIND_CHECKON_STARTUP "RemindStartupCheck"
-#define SET_REMIND_SECUREBIRTHDAY "RemindSecureBirthday"
#define SET_REMIND_BIRTHDAY_IGNORED "RemindSecureIgnored"
#define SET_REMIND_SOUNDOFFSET "RemindSoundOffset"
#define SET_POPUP_ENABLED "PopupEnabled"