diff mcabber/src/screen.c @ 727:1c3620668857

Expand tabs when reading history files
author Mikael Berthe <mikael@lilotux.net>
date Sun, 05 Mar 2006 22:29:14 +0100
parents 51be2bc1a820
children 421b337dc6d2
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sun Mar 05 19:09:17 2006 +0100
+++ b/mcabber/src/screen.c	Sun Mar 05 22:29:14 2006 +0100
@@ -978,29 +978,11 @@
 inline void scr_WriteMessage(const char *jid, const char *text,
                              time_t timestamp, guint prefix_flags)
 {
-  char *p, *xtext;
-  guint8 n =0;
+  char *xtext;
 
   if (!timestamp) timestamp = time(NULL);
 
-  xtext = (char*)text;
-
-  // Expand tabs
-  for (p=xtext; *p; p++)
-    if (*p == '\t') n++;
-  if (n) {
-    char *q;
-    xtext = g_new(char, strlen(text) + 1 + 8*n);
-    p = (char*)text;
-    q = xtext;
-    do {
-      if (*p == '\t') {
-        do { *q++ = ' '; } while ((q-xtext)%8);
-      } else {
-        *q++ = *p;
-      }
-    } while (*p++);
-  }
+  xtext = ut_expand_tabs(text); // Expand tabs
 
   // XXX Are there other special chars we should filter out?