summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp4
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp26
2 files changed, 19 insertions, 11 deletions
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index b69891d543..84cf9ea991 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -612,14 +612,14 @@ int UpdateBirthdayEntry(HWND hList, MCONTACT hContact, int entry, int bShowAll,
mir_sntprintf(buffer, SIZEOF(buffer), NA);
ListView_SetItemText(hList, entry, 2, buffer);
- if ((year != 0) && (month != 0) && (day != 0))
+ if ((month != 0) && (day != 0))
mir_sntprintf(buffer, SIZEOF(buffer), _T("%04d-%02d-%02d"), year, month, day);
else
mir_sntprintf(buffer, SIZEOF(buffer), NA);
ListView_SetItemText(hList, entry, 3, buffer);
- if (age < 400) //hopefully noone lives longer than this :)
+ if (age < 400 && age > 0) //hopefully noone lives longer than this :)
mir_sntprintf(buffer, SIZEOF(buffer), _T("%d"), age);
else
mir_sntprintf(buffer, SIZEOF(buffer), NA);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index edf8dc7458..336970b224 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -94,11 +94,15 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
sex = TranslateT("He/She");
break;
}
- if (dtb > 0)
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s will be %d years old."), text, sex, age);
+ if (age > 0) {
+ if (dtb > 0)
+ mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s will be %d years old."), text, sex, age);
+ else
+ mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ }
else
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
-
+ mir_tstrncpy(pd.lptzText, text, mir_tstrlen(text));
+
PUAddPopupT(&pd);
return 0;
@@ -134,11 +138,15 @@ int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
sex = TranslateT("He/She");
break;
}
- if (dab > 0)
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
- else
- mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
-
+ if (age > 0){
+ if (dab > 0)
+ mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ else
+ mir_sntprintf(pd.lptzText, SIZEOF(pd.lptzText), TranslateT("%s\n%s just turned %d."), text, sex, age);
+ }
+ else
+ mir_tstrncpy(pd.lptzText, text, mir_tstrlen(text));
+
PUAddPopupT(&pd);
return 0;
}