# HG changeset patch # User Mikael Berthe # Date 1208703403 -7200 # Node ID f83a51eaa5edd789aea12ff4ead0b5b921365696 # Parent 0121b6f3047cc2b72d7f91b69202eb6d1b96319f Fix multiline output in /buffer save diff -r 0121b6f3047c -r f83a51eaa5ed mcabber/src/hbuf.c --- a/mcabber/src/hbuf.c Sun Apr 20 16:06:37 2008 +0200 +++ b/mcabber/src/hbuf.c Sun Apr 20 16:56:43 2008 +0200 @@ -424,6 +424,7 @@ hbuf_block *blk; hbb_line line; guint last_persist_prefixflags; + guint prefixwidth; char pref[96]; FILE *fp; struct stat statbuf; @@ -438,6 +439,9 @@ return; } + prefixwidth = getprefixwidth(); + prefixwidth = MIN(prefixwidth, sizeof pref); + for (hbuf = g_list_first(hbuf); hbuf; hbuf = g_list_next(hbuf)) { int maxlen; @@ -462,7 +466,7 @@ line.mucnicklen = 0; // The nick is in the first one } - scr_line_prefix(&line, pref, sizeof pref); + scr_line_prefix(&line, pref, prefixwidth); fprintf(fp, "%s%s\n", pref, line.text); } diff -r 0121b6f3047c -r f83a51eaa5ed mcabber/src/screen.c --- a/mcabber/src/screen.c Sun Apr 20 16:06:37 2008 +0200 +++ b/mcabber/src/screen.c Sun Apr 20 16:56:43 2008 +0200 @@ -831,19 +831,19 @@ 6 }; -static const char *gettprefix() +static const char *gettprefix(void) { guint n = settings_opt_get_int("time_prefix"); return timeprefixes[(n < 3 ? n : 0)]; } -static const char *getspectprefix() +static const char *getspectprefix(void) { guint n = settings_opt_get_int("time_prefix"); return spectimeprefixes[(n < 3 ? n : 0)]; } -static unsigned getprefixwidth() +guint getprefixwidth(void) { guint n = settings_opt_get_int("time_prefix"); return timepreflengths[(n < 3 ? n : 0)]; @@ -1052,7 +1052,8 @@ static void scr_UpdateWindow(winbuf *win_entry) { int n; - int width, prefixwidth; + int width; + guint prefixwidth; char pref[96]; hbb_line **lines, *line; GList *hbuf_head; @@ -1060,6 +1061,7 @@ width = getmaxx(win_entry->win); prefixwidth = getprefixwidth(); + prefixwidth = MIN(prefixwidth, sizeof pref); // Should the window be empty? if (win_entry->bd->cleared) { @@ -1112,7 +1114,7 @@ wattrset(win_entry->win, get_color(color)); // Generate the prefix area and display it - scr_line_prefix(line, pref, sizeof pref); + scr_line_prefix(line, pref, prefixwidth); wprintw(win_entry->win, pref); // Make sure we are at the right position