diff mcabber/src/hbuf.c @ 1486:f83a51eaa5ed

Fix multiline output in /buffer save
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 Apr 2008 16:56:43 +0200
parents 0121b6f3047c
children f61ed2466f7c
line wrap: on
line diff
--- 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);
   }