# HG changeset patch
# Parent 634cc23e8c1c5764623d17d12170b3fb7d67e5d9
Fix empty prefix filling
Not useful in vanilla, as there's no prefixes
longer than that static string. Also not add spaces
to prefixes - they are already in format string.
XXX: Not really sure about this all, why are we getting rid of spaces in the end?
diff -r 634cc23e8c1c mcabber/mcabber/screen.c
--- a/mcabber/mcabber/screen.c Fri Oct 17 22:42:07 2014 +0200
+++ b/mcabber/mcabber/screen.c Tue Nov 11 20:58:44 2014 +0200
@@ -1087,9 +1087,9 @@
if (line->timestamp &&
!(line->flags & (HBB_PREFIX_SPECIAL|HBB_PREFIX_CONT))) {
- timepreflen = strftime(date, 30, gettprefix(), localtime(&line->timestamp));
+ timepreflen = strftime(date, 63, gettprefix(), localtime(&line->timestamp));
} else
- strcpy(date, " ");
+ memset(date, ' ', (preflen>64) ? 64 : preflen);
if (!(line->flags & HBB_PREFIX_CONT)) {
if (line->flags & HBB_PREFIX_INFO) {
@@ -1129,13 +1129,12 @@
receiptflag = '-';
g_snprintf(pref, preflen, "%s%c%c> ", date, receiptflag, cryptflag);
} else if (line->flags & HBB_PREFIX_SPECIAL) {
- timepreflen = strftime(date, 30, getspectprefix(), localtime(&line->timestamp));
- g_snprintf(pref, preflen, "%s ", date);
+ timepreflen = strftime(pref, preflen, getspectprefix(), localtime(&line->timestamp));
} else {
- g_snprintf(pref, preflen, "%s ", date);
+ strncpy(pref, date, preflen);
}
} else {
- g_snprintf(pref, preflen, " ");
+ strncpy(pref, date, preflen);
}
return timepreflen;
}