File: x-face-view-support.patch

package info (click to toggle)
evolution 2.0.4-2sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 86,600 kB
  • ctags: 29,239
  • sloc: ansic: 282,229; sh: 11,353; xml: 7,480; makefile: 3,293; perl: 1,591
file content (136 lines) | stat: -rw-r--r-- 4,225 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
diff -Nuar evolution-2.0.3.orig/mail/Makefile.am evolution-2.0.3/mail/Makefile.am
--- evolution-2.0.3.orig/mail/Makefile.am	2004-07-09 20:17:59.000000000 +0900
+++ evolution-2.0.3/mail/Makefile.am	2004-12-09 17:49:28.000000000 +0900
@@ -197,7 +197,8 @@
 	$(EVOLUTION_MAIL_LIBS)
 
 libevolution_mail_la_LDFLAGS =				\
-	-avoid-version -module
+	-avoid-version -module \
+	-lcompface
 
 libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h
 
diff -Nuar evolution-2.0.3.orig/mail/Makefile.in evolution-2.0.3/mail/Makefile.in
--- evolution-2.0.3.orig/mail/Makefile.in	2004-12-07 02:27:21.000000000 +0900
+++ evolution-2.0.3/mail/Makefile.in	2004-12-09 17:49:28.000000000 +0900
@@ -436,7 +436,8 @@
 
 
 libevolution_mail_la_LDFLAGS = \
-	-avoid-version -module
+	-avoid-version -module \
+	-lcompface
 
 
 libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h
diff -Nuar evolution-2.0.3.orig/mail/em-format-html.c evolution-2.0.3/mail/em-format-html.c
--- evolution-2.0.3.orig/mail/em-format-html.c	2004-12-06 16:47:05.000000000 +0900
+++ evolution-2.0.3/mail/em-format-html.c	2004-12-09 17:49:28.000000000 +0900
@@ -62,6 +62,7 @@
 #include <camel/camel-file-utils.h>
 
 #include <e-util/e-msgport.h>
+#include <e-util/e-mktemp.h>
 
 #include "mail-component.h"
 #include "mail-config.h"
@@ -71,6 +72,9 @@
 #include "em-html-stream.h"
 #include "em-utils.h"
 
+#include <compface.h>
+#include <string.h>
+
 #define d(x)
 
 #define EFH_TABLE_OPEN "<table>"
@@ -332,6 +336,31 @@
 	return part;
 }
 
+CamelMimePart *
+em_format_html_buffer_part(EMFormatHTML *efh, const char *mime_type, const char *buf, size_t len)
+{
+	CamelMimePart *part;
+	CamelStream *stream;
+	CamelDataWrapper *dw;
+
+	stream = camel_stream_mem_new_with_buffer(buf, len);
+	if (stream == NULL)
+		return NULL;
+
+	part = camel_mime_part_new();
+	dw = camel_data_wrapper_new();
+	camel_data_wrapper_construct_from_stream(dw, stream);
+	camel_object_unref(stream);
+	if (mime_type)
+		camel_data_wrapper_set_mime_type(dw, mime_type);
+	part = camel_mime_part_new();
+	camel_medium_set_content_object((CamelMedium *)part, dw);
+	camel_object_unref(dw);
+	/* camel_mime_part_set_filename(part, name); */
+
+	return part;
+}
+
 /* all this api is a pain in the bum ... */
 
 EMFormatHTMLPObject *
@@ -1640,6 +1669,7 @@
 	CamelContentType *ct;
 	struct _camel_header_raw *header;
 	int rupert = FALSE;
+	CamelMimePart * xfacepart = NULL;
 			
 	ct = camel_mime_part_get_content_type((CamelMimePart *)part);
 	charset = camel_content_type_param (ct, "charset");
@@ -1662,10 +1692,11 @@
 	} else {
 		while (h->next) {
 			int mailer;
+			int xface;
 
 			header = ((CamelMimePart *)part)->headers;
 			mailer = !g_ascii_strcasecmp (h->name, "X-Evolution-Mailer");
-			
+			xface  = !g_ascii_strcasecmp (h->name, "X-Face");
 			while (header) {
 				if (mailer && (!g_ascii_strcasecmp (header->name, "X-Mailer") ||
 					       !g_ascii_strcasecmp (header->name, "User-Agent") ||
@@ -1678,6 +1709,15 @@
 					efh_format_header (emf, stream, part, &xmailer, h->flags, charset);
 					if (strstr(header->value, "Evolution"))
 						rupert = TRUE;
+				} else if (xface && (!g_ascii_strcasecmp (header->name, "X-Face") ||
+						     !g_ascii_strcasecmp (header->name, "Face"))) {
+					char buf[2048];
+
+					strncpy(buf, header->value, sizeof(buf));
+					if(uncompface(buf) < 0) return;
+					WriteFacexb(buf, 1);
+
+					xfacepart = em_format_html_buffer_part((EMFormatHTML *)emf, "image/x-bmp", buf, strlen(buf) );
 				} else if (!g_ascii_strcasecmp (header->name, h->name)) {
 					efh_format_header(emf, stream, part, header, h->flags, charset);
 				}
@@ -1703,6 +1743,19 @@
 			}
 			g_free(classid);
 		}
+		if (xfacepart) {
+			char * classid;
+			const char * msgid;
+			
+			msgid = camel_mime_message_get_message_id( (CamelMimeMessage *)part );
+			classid = g_strdup_printf("xface://%s", msgid);
+
+			camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=48 height=48 border=1 src=\"%s\"></td>", classid);
+			em_format_add_puri(emf, sizeof(EMFormatPURI), classid,
+					   xfacepart, efh_write_image);
+			camel_object_unref(xfacepart);
+			g_free(classid);
+		}
 		camel_stream_printf (stream, "</tr></table>\n</font>\n");
 	}
 }