Re: Line breaks in address headers



On 01/23/2004 02:54:17 AM, Andreas Schmidt wrote:
> Hi,
> 
> I noticed a problem with copy+paste of addresses. Occasionally,  
> a line break gets copied, too, and things get really messy in  
> the new mail's To/CC input field.

Could you try the attached patch?

Peter
Index: libbalsa/address-entry.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/address-entry.c,v
retrieving revision 1.35
diff -u -r1.35 address-entry.c
--- libbalsa/address-entry.c	26 Jan 2004 01:07:15 -0000	1.35
+++ libbalsa/address-entry.c	26 Jan 2004 04:48:39 -0000
@@ -586,6 +586,24 @@
     libbalsa_address_entry_show(address_entry);
 }
 
+static void
+lbae_filter(gchar * p)
+{
+    gchar *q = p;
+    g_assert(g_utf8_validate(p, -1, NULL));
+    while (*p) {
+	gunichar c = g_utf8_get_char(p);
+	gchar *r = g_utf8_next_char(p);
+	if (g_unichar_iscntrl(c)) {
+	    *q++ = ' ';
+	    p = r;
+	} else if (q < p) {
+	    while (p < r)
+		*q++ = *p++;
+	} else
+	    p = q = r;
+    }
+}
 
 /*************************************************************
  * libbalsa_fill_input:
@@ -623,6 +641,8 @@
     if (!typed)
 	typed = g_strdup("");
 
+    lbae_filter(typed);
+
     /*
      * Split the input string by comma.
      * str contains a list of e-mail addresses seperated by ','.
@@ -2083,8 +2103,10 @@
             g_object_ref(ed->address);
             res = g_list_append(res, ed->address);
         } else {
-            res = g_list_append(res, 
-                                libbalsa_address_new_from_string(ed->user));
+	    LibBalsaAddress *addr =
+		libbalsa_address_new_from_string(ed->user);
+	    if (addr)
+		res = g_list_append(res, addr);
         }
     }
     return res;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]