fix-date-fill.diff
changeset 87 78238d26911a
parent 51 5e5992999357
child 92 66f7e2aa040c
equal deleted inserted replaced
86:ac5fed257211 87:78238d26911a
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent 450e74018eb436aef07e67ef7ae49cd05f48b3c9
     2 # Parent 634cc23e8c1c5764623d17d12170b3fb7d67e5d9
     3 Fix empty prefix filling
     3 Fix empty prefix filling
     4 Not useful in vanilla, as there's no prefixes
     4 Not useful in vanilla, as there's no prefixes
     5 longer than that static string. Also not add spaces
     5 longer than that static string. Also not add spaces
     6 to prefixes - they are already in format string.
     6 to prefixes - they are already in format string.
     7 
     7 
     8 diff -r 450e74018eb4 mcabber/mcabber/screen.c
     8 XXX: Not really sure about this all, why are we getting rid of spaces in the end?
     9 --- a/mcabber/mcabber/screen.c	Thu Oct 18 01:49:44 2012 +0300
     9 
    10 +++ b/mcabber/mcabber/screen.c	Thu Oct 18 02:08:24 2012 +0300
    10 diff -r 634cc23e8c1c mcabber/mcabber/screen.c
    11 @@ -1139,9 +1139,9 @@
    11 --- a/mcabber/mcabber/screen.c	Fri Oct 17 22:42:07 2014 +0200
       
    12 +++ b/mcabber/mcabber/screen.c	Tue Nov 11 20:58:44 2014 +0200
       
    13 @@ -1087,9 +1087,9 @@
    12  
    14  
    13    if (line->timestamp &&
    15    if (line->timestamp &&
    14        !(line->flags & (HBB_PREFIX_SPECIAL|HBB_PREFIX_CONT))) {
    16        !(line->flags & (HBB_PREFIX_SPECIAL|HBB_PREFIX_CONT))) {
    15 -    strftime(date, 30, gettprefix(), localtime(&line->timestamp));
    17 -    timepreflen = strftime(date, 30, gettprefix(), localtime(&line->timestamp));
    16 +    strftime(date, 63, gettprefix(), localtime(&line->timestamp));
    18 +    timepreflen = strftime(date, 63, gettprefix(), localtime(&line->timestamp));
    17    } else
    19    } else
    18 -    strcpy(date, "           ");
    20 -    strcpy(date, "           ");
    19 +    memset(date, ' ', (preflen>64) ? 64 : preflen);
    21 +    memset(date, ' ', (preflen>64) ? 64 : preflen);
    20  
    22  
    21    if (!(line->flags & HBB_PREFIX_CONT)) {
    23    if (!(line->flags & HBB_PREFIX_CONT)) {
    22      if (line->flags & HBB_PREFIX_INFO) {
    24      if (line->flags & HBB_PREFIX_INFO) {
    23 @@ -1181,13 +1181,12 @@
    25 @@ -1129,13 +1129,12 @@
    24          receiptflag = '-';
    26          receiptflag = '-';
    25        g_snprintf(pref, preflen, "%s%c%c> ", date, receiptflag, cryptflag);
    27        g_snprintf(pref, preflen, "%s%c%c> ", date, receiptflag, cryptflag);
    26      } else if (line->flags & HBB_PREFIX_SPECIAL) {
    28      } else if (line->flags & HBB_PREFIX_SPECIAL) {
    27 -      strftime(date, 30, getspectprefix(), localtime(&line->timestamp));
    29 -      timepreflen = strftime(date, 30, getspectprefix(), localtime(&line->timestamp));
    28 -      g_snprintf(pref, preflen, "%s   ", date);
    30 -      g_snprintf(pref, preflen, "%s   ", date);
    29 +      strftime(pref, preflen, getspectprefix(), localtime(&line->timestamp));
    31 +      timepreflen = strftime(pref, preflen, getspectprefix(), localtime(&line->timestamp));
    30      } else {
    32      } else {
    31 -      g_snprintf(pref, preflen, "%s    ", date);
    33 -      g_snprintf(pref, preflen, "%s    ", date);
    32 +      strncpy(pref, date, preflen);
    34 +      strncpy(pref, date, preflen);
    33      }
    35      }
    34    } else {
    36    } else {
    35 -    g_snprintf(pref, preflen, "                ");
    37 -    g_snprintf(pref, preflen, "                ");
    36 +    strncpy(pref, date, preflen);
    38 +    strncpy(pref, date, preflen);
    37    }
    39    }
       
    40    return timepreflen;
    38  }
    41  }
    39