[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pan-devel] patch for viewing application/octet-stream images
From: |
K. Haley |
Subject: |
[Pan-devel] patch for viewing application/octet-stream images |
Date: |
Mon, 25 Aug 2003 19:34:16 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 |
Hi again,
Just throwing this out in case anyone else wants it. This patch
allows pan to display mime encoded images that have been improperly
given the app/octet-stream type. I've seen this just often enough to
try and fix it. It also fixes a debug_enter that should have been a
debug_exit.
Index: text.c
===================================================================
RCS file: /cvs/gnome/pan/pan/text.c,v
retrieving revision 1.368
diff -u -r1.368 text.c
--- text.c 31 Jul 2003 19:56:14 -0000 1.368
+++ text.c 26 Aug 2003 01:20:11 -0000
@@ -499,6 +499,8 @@
const GMimeContentType * type;
YencInfo * yenc;
+ debug_enter("insert_part_partfunc.");
+
/* We are only looking for leaf parts... */
if (!GMIME_IS_PART (obj))
return;
@@ -523,7 +525,16 @@
g_mime_stream_unref (stream);
}
- if (g_mime_content_type_is_type (type, "image", "*"))
+ gboolean is_image=FALSE;
+ if(g_mime_content_type_is_type(type, "application", "octet-stream"))
+ {
+ const char *type, *sub_type;
+
guess_part_type_from_filename(g_mime_part_get_filename(part),&type,&sub_type);
+ if(pan_strcmp(type,"image")==0)
+ is_image=TRUE;
+ }
+
+ if (is_image || g_mime_content_type_is_type (type, "image", "*"))
{
GdkPixbuf * pixbuf = get_pixbuf_from_gmime_part (part);
@@ -548,6 +559,8 @@
g_free (str);
}
+
+ debug_exit("insert_part_partfunc.");
}
static void
add_header (GtkTextBuffer * tbuf, int key_width, const char * header, const
char * value, iconv_t iconv_utf8)
@@ -815,7 +828,7 @@
if (old_mm!=NULL)
g_object_unref (old_mm);
- debug_enter ("set_current_message_impl");
+ debug_exit ("set_current_message_impl");
}
/**
@@ -1612,4 +1625,4 @@
text_massager = text_massager_new ();
return text_massager;
-}
+}
\ No newline at end of file
Index: base/util-mime.c
===================================================================
RCS file: /cvs/gnome/pan/pan/base/util-mime.c,v
retrieving revision 1.58
diff -u -r1.58 util-mime.c
--- base/util-mime.c 24 Jul 2003 23:20:50 -0000 1.58
+++ base/util-mime.c 26 Aug 2003 01:20:16 -0000
@@ -607,7 +607,7 @@
g_byte_array_free (line, TRUE);
}
-static void
+void
guess_part_type_from_filename (const char * filename,
const char ** setme_type,
const char ** setme_subtype)
@@ -1110,4 +1110,4 @@
g_mime_message_foreach_part (message, get_charset_partfunc, &retval);
return retval;
-}
+}
\ No newline at end of file
Index: base/util-mime.h
===================================================================
RCS file: /cvs/gnome/pan/pan/base/util-mime.h,v
retrieving revision 1.14
diff -u -r1.14 util-mime.h
--- base/util-mime.h 11 Mar 2003 22:35:33 -0000 1.14
+++ base/util-mime.h 26 Aug 2003 01:20:16 -0000
@@ -35,6 +35,10 @@
const char * pan_g_mime_message_get_charset (GMimeMessage * message);
+void
+guess_part_type_from_filename (const char * filename,
+ const char ** setme_type,
+ const char ** setme_subtype);
/**
*** YEnc Functions
**/
@@ -57,4 +61,4 @@
YencInfo;
-#endif
+#endif
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pan-devel] patch for viewing application/octet-stream images,
K. Haley <=