Re: Possible bug in Balsa 0.4.9



On Mon, 22 Mar 1999 19:32:17 Jon Earle wrote:
> 
> If I try to forward or reply to a message with an imbedded jpg file, 
> I get a segmentation fault:

This has been fixed.  I don't think that Stuart Parmenter (the Balsa
author) has placed the fix in CVS yet, though.  Here's a patch for the
interim.  This should be applied to balsa/libbalsa/mime.c

> Furthermore, I don't know if this is a bug or not, but a colleague 
> forwarded me a message that she received.  Balsa could not display the 
> forwarded message - it just printed "--MESSAGE--" on the screen, whereby
> the only thing I could do was to save the attachment with an arbitrary name.

Sounds like the message was forwarded as an attachment.  Perhaps this could be
handled more clearly/intelligently but for now, I don't really think it's a
major bug.  Just view the file after you save it in any ol' text editor.  :)

As usual, not speaking for anyone but myself here. :-)

---------------
Jesse D. Sightler
http://www3.pair.com/jsight/

"An honest answer can get you into a lot of trouble." 
         - Anonymous
--- /home/jsight/gnomecvs/balsa/libbalsa/mime.c	Sun Feb 21 10:28:00 1999
+++ mime.c	Mon Mar 15 18:29:11 1999
@@ -33,9 +33,74 @@
 
 #include "mime.h"
 
+  GString *reply;
 
 static gchar tmp_file_name[PATH_MAX + 1];
 
+void process_mime_multipart (Message * message, BODY * bdy, FILE * msg_stream, gchar *reply_prefix_str);
+
+void process_mime_part (Message * message, BODY * bdy, FILE * msg_stream, gchar *reply_prefix_str);
+
+void
+process_mime_part (Message * message, BODY * bdy, FILE * msg_stream, gchar *reply_prefix_str)
+{
+  size_t alloced;
+  gchar *ptr = 0;
+  switch (bdy->type)
+    {
+    case TYPEOTHER:
+      break;
+    case TYPEAUDIO:
+      break;
+    case TYPEAPPLICATION:
+      break;
+    case TYPEIMAGE:
+      break;
+    case TYPEMESSAGE:
+      break;
+    case TYPEMULTIPART:
+      process_mime_multipart (message, bdy, msg_stream, reply_prefix_str);
+      break;
+    case TYPETEXT:
+	      {
+		STATE s;
+		fseek (msg_stream, bdy->offset, 0);
+		s.fpin = msg_stream;
+		mutt_mktemp (tmp_file_name);
+		s.prefix = reply_prefix_str;
+		s.fpout = fopen (tmp_file_name, "w+");
+		mutt_decode_attachment (bdy, &s);
+		fflush (s.fpout);
+		alloced = readfile (s.fpout, &ptr);
+		if (ptr)
+		  ptr[alloced - 1] = '\0';
+		if (reply)
+		  {
+		    reply = g_string_append (reply, "\n");
+		    reply = g_string_append (reply, ptr);
+		  }
+		else
+		  reply = g_string_new (ptr);
+		fclose (s.fpout);
+		unlink (tmp_file_name);
+                break;
+	      } 
+      break;
+    case TYPEVIDEO:
+      break;
+    }
+
+}
+
+void
+process_mime_multipart (Message * message, BODY * bdy, FILE * msg_stream, gchar *reply_prefix_str)
+{
+  BODY *p;
+  for (p = bdy->parts; p; p = p->next)
+    {
+      process_mime_part (message, p, msg_stream, reply_prefix_str);
+    }
+}
 
 GString *
 content2reply (Message * message,
@@ -45,9 +110,8 @@
   Body *body;
   FILE *msg_stream;
   gchar msg_filename[PATH_MAX];
-  size_t alloced;
-  gchar *ptr = 0;
-  GString *reply = 0;
+
+  reply = 0;
 
   switch (message->mailbox->type)
     {
@@ -76,47 +140,11 @@
   body_list = message->body_list;
   while (body_list)
     {
-      BODY *b;
       body = (Body *) body_list->data;
-
-      b = body->mutt_body;
-      while (b)
-	{
-	  switch (body->mutt_body->type)
-	    {
-	    case TYPEMULTIPART:
-	      {
-		b = b->parts;
-		continue;
-	      }
-	    case TYPETEXT:
-	      {
-		STATE s;
-		fseek (msg_stream, body->mutt_body->offset, 0);
-		s.fpin = msg_stream;
-		mutt_mktemp (tmp_file_name);
-		s.prefix = reply_prefix_str; /* arp */
-		s.fpout = fopen (tmp_file_name, "w+");
-		mutt_decode_attachment (body->mutt_body, &s);
-		fflush (s.fpout);
-		alloced = readfile (s.fpout, &ptr);
-		if (ptr)
-		  ptr[alloced - 1] = '\0';
-		if (reply)
-		  {
-		    reply = g_string_append (reply, "\n");
-		    reply = g_string_append (reply, ptr);
-		  }
-		else
-		  reply = g_string_new (ptr);
-		fclose (s.fpout);
-		unlink (tmp_file_name);
-	      }
-	    }
-	  b = b->next;
-	}
+      process_mime_part (message, body->mutt_body, msg_stream, reply_prefix_str);
       body_list = g_list_next (body_list);
-    }
+    }    
+
   fclose (msg_stream);
   return reply;
 }


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