[Xfce4-commits] <postler:master> Move parsing of the message body into parse_body()
Christian Dywan
noreply at xfce.org
Thu Dec 2 04:26:01 CET 2010
Updating branch refs/heads/master
to ad84a0b2b017e8f60197f82581ed428db439d783 (commit)
from dd221b4d328823779d8b369d47464cad24fbc5c7 (commit)
commit ad84a0b2b017e8f60197f82581ed428db439d783
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Dec 2 01:25:43 2010 +0100
Move parsing of the message body into parse_body()
postler/postler-content.vala | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index c5095f4..faa4108 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -505,7 +505,6 @@ public class Postler.Content : WebKit.WebView {
var stream = new DataInputStream (contents.read (null));
string line;
string content_type = null;
- string mime_type = "text/plain";
string charset = null;
string[] parts;
@@ -611,7 +610,20 @@ public class Postler.Content : WebKit.WebView {
if (reply != "")
reply = linkify_address (reply, arguments);
+ parse_body (stream, content_type, ref charset);
+ } catch (GLib.Error contents_error) {
+ throw new GLib.FileError.FAILED (_("Failed to read message: %s").
+ printf (contents_error.message));
+ }
+ notify_property ("message-parts");
+ }
+
+ void parse_body (DataInputStream stream, string content_type,
+ ref string charset) throws GLib.Error {
+
+ try {
string? boundary = null;
+ string mime_type = "text/plain";
string? fname = null;
parse_content_type (content_type, ref charset, ref boundary,
ref mime_type, ref fname);
@@ -638,6 +650,7 @@ public class Postler.Content : WebKit.WebView {
int in_quote = 0;
bool in_signature = false;
string inner_boundary = "";
+ string line;
while ((line = stream.read_line (null, null)) != null) {
if (multipart > 0) {
if (line.has_prefix ("--")) {
@@ -667,6 +680,7 @@ public class Postler.Content : WebKit.WebView {
}
/* Content-Type can span over multiple lines */
+ string[] parts;
if (message_part.mime_type.has_suffix (";"))
parts = { "content-type",
message_part.mime_type + line };
@@ -770,11 +784,9 @@ public class Postler.Content : WebKit.WebView {
message_part.body.append (plain_text ? "<br>" : " ");
}
}
- } catch (GLib.Error contents_error) {
- throw new GLib.FileError.FAILED (_("Failed to read message: %s").
- printf (contents_error.message));
+ } catch (GLib.Error error) {
+ throw error;
}
- notify_property ("message-parts");
}
public bool display (string location) {
More information about the Xfce4-commits
mailing list