Re: Encoded words

Robert Grimm <[email protected]>
Newsgroups gmane.network.slrn.user
Organization Disorganized
Message-ID <[email protected]>
Maybe my mails got lost, so I resend it here.
I have no idea, how to handle legacy mailaddresses, though I haven't
seen such for a while. The patches behave well with 0.9.9p1 and
1.0.0pre2.

#v+
diff -urNad slrn-pre1.0.0~/src/art.c slrn-pre1.0.0/src/art.c
--- slrn-pre1.0.0~/src/art.c	2009-03-30 14:56:43.000000000 +0200
+++ slrn-pre1.0.0/src/art.c	2009-03-31 07:59:38.026329932 +0200
@@ -5588,13 +5588,30 @@
 static Slrn_Header_Type *process_xover (Slrn_XOver_Type *xov)
 {
    Slrn_Header_Type *h;
-   
+   char *hn = "Subject: ";
+   char *s, *s1;
+
    h = (Slrn_Header_Type *) slrn_safe_malloc (sizeof (Slrn_Header_Type));
    
    slrn_map_xover_to_header (xov, h, 1);
    Number_Total++;
+
+   /* have to know it's a Subject for slrn_rfc1522_decode_string */
+   s = slrn_strdup_strcat(hn, h->subject, NULL);
    
-   slrn_rfc1522_decode_string (&h->subject);
+   slrn_rfc1522_decode_string (&s);
+
+   s1 = slrn_strbyte(s, ':');
+   s1++;
+
+   if (NULL != (s1 = slrn_skip_whitespace(s1)))
+     {
+	   slrn_free (h->subject);
+	   h->subject = slrn_safe_strmalloc(s1);
+     }
+
+   slrn_free (s);
+
    slrn_rfc1522_decode_string (&h->from);
 
    get_header_real_name (h);
diff -urNad slrn-pre1.0.0~/src/mime.c slrn-pre1.0.0/src/mime.c
--- slrn-pre1.0.0~/src/mime.c	2009-03-31 07:59:37.000000000 +0200
+++ slrn-pre1.0.0/src/mime.c	2009-03-31 07:59:38.028329620 +0200
@@ -333,6 +333,7 @@
    char *after_whitespace;
    unsigned int count;
    unsigned int len;
+   int addr_spec_header = 1;
    int keep_nl = 0;
 
    count = 0;
@@ -354,15 +355,33 @@
 	*s_ptr = s;
 	/* return 0; */
      }
+    /* headers may contain '<' encoded_word '>' */
+   if ((0 == slrn_case_strncmp (s, "Subject:", 8)) ||
+       (0 == slrn_case_strncmp (s, "Organization:", 13)) ||
+       (0 == slrn_case_strncmp (s, "Comments:", 9)) ||
+       (0 == slrn_case_strncmp (s, "Keywords:", 9)))
+           addr_spec_header = 0;
 
    while (1)
      {
 	char *decoded_start, *decoded_end;
 
+	s1 = s;
+
 	while ((NULL != (s = slrn_strbyte (s, '=')))
 	       && (s[1] != '?')) s++;
 	if (s == NULL) break;
 	
+	if ((NULL != (s1 = slrn_strbyte (s1, '<')))
+			&& addr_spec_header
+			&& s1 < s)
+	  {
+		s = s1;
+		while (NULL != (s = slrn_strbyte (s, '>')))
+		    s++;
+		if (s == NULL) break;
+	  }
+
 	s1 = s;
 
 	charset = s = s1 + 2;
#v-

Rob


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.