summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.h2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp6
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp12
-rw-r--r--plugins/UserInfoEx/src/stdafx.cxx2
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp76
6 files changed, 44 insertions, 56 deletions
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 1df1143d7f..859272dbf1 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -2,7 +2,7 @@
UserinfoEx plugin for Miranda NG
Copyright:
-© 2012-24 Miranda NG team (https://miranda-ng.org)
+© 2012-25 Miranda NG team (https://miranda-ng.org)
© 2006-10 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol
This program is free software; you can redistribute it and/or
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.h b/plugins/UserInfoEx/src/dlg_msgbox.h
index 594ec78352..10d468a6fa 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.h
+++ b/plugins/UserInfoEx/src/dlg_msgbox.h
@@ -2,7 +2,7 @@
UserinfoEx plugin for Miranda NG
Copyright:
-© 2012-24 Miranda NG team (https://miranda-ng.org)
+© 2012-25 Miranda NG team (https://miranda-ng.org)
© 2006-10 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol
This program is free software; you can redistribute it and/or
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index e26522981f..1f27050971 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -401,7 +401,7 @@ uint8_t CExImContactXML::ExportEvents()
TiXmlElement *xmlEvent = _xmlDoc.NewElement("evt");
if (xmlEvent) {
xmlEvent->SetAttribute("type", dbei.eventType);
- xmlEvent->SetAttribute("time", (int)dbei.timestamp);
+ xmlEvent->SetAttribute("time", (int)dbei.getUnixtime());
xmlEvent->SetAttribute("flag", (int)dbei.flags);
TiXmlText *xmlText = _xmlDoc.NewText(pBase64Data);
@@ -914,8 +914,8 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, const TiXmlElement *xmlEvent)
// timestamp must be valid
DBEVENTINFO dbei = {};
- dbei.timestamp = xmlEvent->IntAttribute("time");
- if (dbei.timestamp == 0)
+ dbei.iTimestamp = xmlEvent->IntAttribute("time");
+ if (dbei.iTimestamp == 0)
return ERROR_INVALID_TIMESTAMP;
LPCSTR tmp = xmlEvent->GetText();
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index c6a1a05ca5..9afb7811f8 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -44,7 +44,7 @@ uint32_t WhenAdded(uint32_t dwUIN, LPCSTR)
memcpy(&dwEvtUIN, dbei.pBlob, sizeof(uint32_t));
MIR_FREE(dbei.pBlob);
if (dwEvtUIN == dwUIN)
- return dbei.timestamp;
+ return dbei.getUnixtime();
}
}
}
@@ -522,7 +522,7 @@ uint32_t TimeOf(MEVENT hEvent)
{
DBEVENTINFO dbei;
if (!GetInfo(hEvent, &dbei))
- return dbei.timestamp;
+ return dbei.getUnixtime();
return 0;
}
@@ -541,7 +541,7 @@ uint32_t TimeOf(MEVENT hEvent)
bool __forceinline IsEqual(const DBEVENTINFO *d1, const DBEVENTINFO *d2, bool Data)
{
bool res = d1 && d2 &&
- (d1->timestamp == d2->timestamp) &&
+ (d1->getUnixtime() == d2->getUnixtime()) &&
(d1->eventType == d2->eventType) &&
(d1->cbBlob == d2->cbBlob) &&
(!d1->szModule || !d2->szModule || !_stricmp(d1->szModule, d2->szModule));
@@ -574,7 +574,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei)
hDbExistingEvent = db_event_first(hContact);
if (hDbExistingEvent) {
if (!GetInfo(hDbExistingEvent, &edbei)) {
- if ((dbei->timestamp < edbei.timestamp))
+ if ((dbei->getUnixtime() < edbei.getUnixtime()))
return false;
if (IsEqual(dbei, &edbei, false)) {
@@ -596,7 +596,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei)
}
if (hDbExistingEvent) {
MEVENT sdbe = hDbExistingEvent;
- for (MEVENT edbe = sdbe; edbe && !GetInfo(edbe, &edbei) && (dbei->timestamp <= edbei.timestamp); edbe = db_event_prev(hContact, edbe)) {
+ for (MEVENT edbe = sdbe; edbe && !GetInfo(edbe, &edbei) && (dbei->getUnixtime() <= edbei.getUnixtime()); edbe = db_event_prev(hContact, edbe)) {
hDbExistingEvent = edbe;
//compare without data (faster)
if ( result = IsEqual(dbei, &edbei, false)) {
@@ -612,7 +612,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei)
} /*end for*/
if (!result) {
- for (MEVENT edbe = db_event_next(hContact, sdbe); edbe && !GetInfo(edbe, &edbei) && (dbei->timestamp >= edbei.timestamp); edbe = db_event_next(hContact, edbe)) {
+ for (MEVENT edbe = db_event_next(hContact, sdbe); edbe && !GetInfo(edbe, &edbei) && (dbei->getUnixtime() >= edbei.getUnixtime()); edbe = db_event_next(hContact, edbe)) {
hDbExistingEvent = edbe;
//compare without data (faster)
if (result = IsEqual(dbei, &edbei, false)) {
diff --git a/plugins/UserInfoEx/src/stdafx.cxx b/plugins/UserInfoEx/src/stdafx.cxx
index 13f28e1314..f111565f38 100644
--- a/plugins/UserInfoEx/src/stdafx.cxx
+++ b/plugins/UserInfoEx/src/stdafx.cxx
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 82e3351baf..87bb0592bf 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -355,12 +355,24 @@ static uint8_t NotifyWithSound(const CEvent &evt)
* "check for anniversary" functions
***********************************************************************************************************/
+static wchar_t* GetSex(MCONTACT hContact)
+{
+ switch (GenderOf(hContact)) {
+ case 'M':
+ return TranslateT("He");
+ case 'F':
+ return TranslateT("She");
+ default:
+ return TranslateT("He/she");
+ }
+}
+
static uint8_t CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, uint8_t bNotify)
{
int numAnniversaries = 0;
int Diff = 0;
MAnnivDate mta;
- CMStringW tszMsg;
+ CMStringW wszMsg;
if (gRemindOpts.RemindState == REMIND_ANNIV || gRemindOpts.RemindState == REMIND_ALL) {
for (int i = 0; i < ANID_LAST && !mta.DBGetAnniversaryDate(hContact, i); i++) {
@@ -383,28 +395,18 @@ static uint8_t CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, ui
if (bNotify) {
// first anniversary found
if (numAnniversaries == 1)
- switch (GenderOf(hContact)){
- case 0:
- tszMsg += TranslateT("He/she has the following anniversaries:");
- break;
- case 'M':
- tszMsg += TranslateT("He has the following anniversaries:");
- break;
- case 'F':
- tszMsg += TranslateT("She has the following anniversaries:");
- break;
- }
- tszMsg.Append(L"\n- ");
+ wszMsg.AppendFormat(TranslateT("%s has the following anniversaries:"), GetSex(hContact));
+ wszMsg.Append(L"\n- ");
switch (Diff) {
case 0:
- tszMsg.AppendFormat(TranslateT("%d. %s today"), mta.Age(), mta.Description());
+ wszMsg.AppendFormat(TranslateT("%d. %s today"), mta.Age(), mta.Description());
break;
case 1:
- tszMsg.AppendFormat(TranslateT("%d. %s tomorrow"), mta.Age() + 1, mta.Description());
+ wszMsg.AppendFormat(TranslateT("%d. %s tomorrow"), mta.Age() + 1, mta.Description());
break;
default:
- tszMsg.AppendFormat(TranslateT("%d. %s in %d days"), mta.Age() + 1, mta.Description(), Diff);
+ wszMsg.AppendFormat(TranslateT("%d. %s in %d days"), mta.Age() + 1, mta.Description(), Diff);
}
}
}
@@ -414,12 +416,12 @@ static uint8_t CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, ui
// show one popup for all anniversaries
if (numAnniversaries != 0 && bNotify) {
- if (tszMsg.GetLength() >= MAX_SECONDLINE) {
- tszMsg.Truncate(MAX_SECONDLINE - 5);
- tszMsg.Append(L"\n...");
+ if (wszMsg.GetLength() >= MAX_SECONDLINE) {
+ wszMsg.Truncate(MAX_SECONDLINE - 5);
+ wszMsg.Append(L"\n...");
}
- NotifyWithPopup(hContact, CEvent::ANNIVERSARY, Diff, LPGENW("Anniversaries"), tszMsg);
+ NotifyWithPopup(hContact, CEvent::ANNIVERSARY, Diff, LPGENW("Anniversaries"), wszMsg);
}
return numAnniversaries != 0;
@@ -459,39 +461,25 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, uint8_t bN
}
if (bNotify) {
- wchar_t szMsg[MAXDATASIZE];
- uint16_t cchMsg = 0;
+ CMStringW wszMsg;
switch (Diff) {
case 0:
- cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday today."), Clist_GetContactDisplayName(hContact));
+ wszMsg.Format(TranslateT("%s has birthday today."), Clist_GetContactDisplayName(hContact));
break;
case 1:
- cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday tomorrow."), Clist_GetContactDisplayName(hContact));
+ wszMsg.Format(TranslateT("%s has birthday tomorrow."), Clist_GetContactDisplayName(hContact));
break;
default:
- cchMsg = mir_snwprintf(szMsg, TranslateT("%s has birthday in %d days."), Clist_GetContactDisplayName(hContact), Diff);
+ wszMsg.Format(TranslateT("%s has birthday in %d days."), Clist_GetContactDisplayName(hContact), Diff);
}
+
int age = mtb.Age(&Now);
- if (age > 0)
- switch (GenderOf(hContact)){
- case 0:
- mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
- TranslateT("\nHe/she becomes %d years old."),
- age + (Diff > 0));
- break;
- case 'M':
- mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
- TranslateT("\nHe becomes %d years old."),
- age + (Diff > 0));
- break;
- case 'F':
- mir_snwprintf(szMsg + cchMsg, _countof(szMsg) - cchMsg,
- TranslateT("\nShe becomes %d years old."),
- age + (Diff > 0));
- break;
- }
- NotifyWithPopup(hContact, CEvent::BIRTHDAY, Diff, mtb.Description(), szMsg);
+ if (age > 0) {
+ wszMsg.AppendChar('\n');
+ wszMsg.AppendFormat(TranslateT("%s becomes %d years old."), GetSex(hContact), age + (Diff > 0));
+ }
+ NotifyWithPopup(hContact, CEvent::BIRTHDAY, Diff, mtb.Description(), wszMsg);
}
return true;
}