pan-users
[Top][All Lists]
Advanced

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

[Pan-users] Fix for broken multipart yenc display


From: Per Hedeland
Subject: [Pan-users] Fix for broken multipart yenc display
Date: Sat, 12 Aug 2006 16:15:32 +0200 (CEST)

Seems this was broken for all yenc multipart posts (in 0.14 too) - I'd
consider it a stupiditiy if not a bug in the gmime filter, since even
though it looks for the =ybegin/=ypart/=yend lines itself, you must
explicitly reset its state when starting a new part or it won't decode
anything more. Symptom is the same as with the uu case, parts after the
first show up black or with garbage contents.

Anyway, patch below (I'm afraid the indentation has become a bit botched
in that file, partly because of my previous patch using tabs in the
"standard" way (I'm a bit allergic to auto-setting of variables in
emacs), but I didn't want to mess up this patch with re-indentation).

--Per Hedeland

--- pan-0.107/pan/usenet-utils/mime-utils.cc.ORIG       Tue Aug  8 22:11:32 2006
+++ pan-0.107/pan/usenet-utils/mime-utils.cc    Sat Aug 12 15:58:03 2006
@@ -397,6 +397,7 @@
   {
     GMimeStream * stream;
     GMimeStream * filter_stream;
+    GMimeFilter * filter;
     char * filename;
     unsigned int valid_lines;
     EncType type;
@@ -410,7 +411,7 @@
     guint y_pcrc;
     size_t y_size;
 
-    TempPart (EncType intype=ENC_UU, char *infilename=0): stream(0),
+    TempPart (EncType intype=ENC_UU, char *infilename=0): stream(0), filter(0),
       filter_stream(0), filename(infilename), valid_lines(0), type(intype),
       y_line_len(0), y_attach_size(0), y_part(0),
       y_offset_begin(0), y_offset_end(0),
@@ -419,6 +420,8 @@
     ~TempPart () {
       g_free (filename);
       g_object_unref (stream);
+      if (filter)
+        g_object_unref (filter);
       if (filter_stream)
        g_object_unref (filter_stream);
     }
@@ -453,12 +456,11 @@
       if (part->type != ENC_PLAIN) {
        part->filter_stream =
          g_mime_stream_filter_new_with_stream (part->stream);
-       GMimeFilter * filter = part->type == ENC_UU
+        part->filter = part->type == ENC_UU
          ? g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC)
          : g_mime_filter_yenc_new (GMIME_FILTER_YENC_DIRECTION_DECODE);
        g_mime_stream_filter_add (GMIME_STREAM_FILTER(part->filter_stream),
-                                 filter);
-       g_object_unref (filter);
+                                  part->filter);
       }
     }
 
@@ -538,9 +540,13 @@
                                        int line_len, attach_size, part;
                                        yenc_parse_begin_line (line_str, 
&fname, &line_len, &attach_size, &part);
                                        cur = find_filename_part (appendme, 
fname);
-                                       if (cur)
+                                       if (cur) {
                                                g_free (fname);
-                                       else {
+            g_mime_filter_yenc_set_state (GMIME_FILTER_YENC (cur->filter),
+                                          GMIME_YDECODE_STATE_INIT);
+          }
+                                       else
+          {
                                                cur = new TempPart 
(type=ENC_YENC, fname);
                                                cur->y_line_len = line_len;
                                                cur->y_attach_size = 
attach_size;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]