summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r--plugins/UserInfoEx/src/classMTime.cpp33
-rw-r--r--plugins/UserInfoEx/src/classMTime.h1
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp7
3 files changed, 39 insertions, 2 deletions
diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp
index 9ca9591b26..35955d4d14 100644
--- a/plugins/UserInfoEx/src/classMTime.cpp
+++ b/plugins/UserInfoEx/src/classMTime.cpp
@@ -344,6 +344,39 @@ WORD MTime::DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat)
return cchTimeFormat;
}
+WORD MTime::DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat)
+{
+ if (!ptszTimeFormat || !cchTimeFormat)
+ return 0;
+
+ WORD wRes = DateFormat(ptszTimeFormat, cchTimeFormat);
+ if (wRes != 0)
+ return wRes;
+
+ SYSTEMTIME AltSysTime = _SysTime;
+ MTime mtNow;
+ mtNow.GetLocalTime();
+ AltSysTime.wYear=mtNow.Year();
+
+ if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) {
+ *ptszTimeFormat = 0;
+ return 0;
+ }
+
+ TCHAR tszText[10];
+ _itot(mtNow.Year(), tszText, 10);
+ TCHAR * tszYear = _tcsstr(ptszTimeFormat, tszText);
+
+ if (tszYear && mir_tstrlen(tszYear) == 4)
+ mir_tstrcpy(tszYear, _T("????"));
+ else {
+ *ptszTimeFormat = 0;
+ return 0;
+ }
+
+ return cchTimeFormat;
+}
+
WORD MTime::DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat)
{
if (!ptszTimeFormat || !cchTimeFormat)
diff --git a/plugins/UserInfoEx/src/classMTime.h b/plugins/UserInfoEx/src/classMTime.h
index d0f02420fd..2964a0dc3c 100644
--- a/plugins/UserInfoEx/src/classMTime.h
+++ b/plugins/UserInfoEx/src/classMTime.h
@@ -60,6 +60,7 @@ public:
WORD TimeFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat);
WORD TimeFormat(tstring& str);
WORD DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat);
+ WORD DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat);
WORD DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat);
// return single attributes
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index d76858851f..f7632f0d6a 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -702,13 +702,16 @@ class CAnnivList
mir_free(ptszProto);
// forth line: age
- AddSubItem(iItem, COLUMN_AGE, _itot(ad.Age(&mtNow), szText, 10));
+ if (ad.Age(&mtNow))
+ AddSubItem(iItem, COLUMN_AGE, _itot(ad.Age(&mtNow), szText, 10));
+ else
+ AddSubItem(iItem, COLUMN_AGE, _T("???"));
// fifth line: anniversary
AddSubItem(iItem, COLUMN_DESC, (LPTSTR)ad.Description());
// sixth line: date
- ad.DateFormat(szText, SIZEOF(szText));
+ ad.DateFormatAlt(szText, SIZEOF(szText));
AddSubItem(iItem, COLUMN_DATE, szText);
_numRows++;