/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (C) 1999-2020 the Claws Mail Team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gint llen = 0; \
strretchomp(lastline); \
llen = strlen(lastline); \
- if (lastline[llen-1] == ' ' && !account_signatures_matchlist_str_found(lastline, "%s") && \
+ if (lastline[llen-1] == ' ' && !account_sigsep_matchlist_str_found(lastline, "%s") && \
!(llen == 2 && lastline[1] == ' ' && strchr(prefs_common.quote_chars, lastline[0]))) { \
/* this is flowed */ \
if (delsp) \
tmp_file = TRUE;
readend = mimeinfo->offset + mimeinfo->length;
- account_signatures_matchlist_create(); /* FLUSH_LASTLINE will use it */
+ account_sigsep_matchlist_create(); /* FLUSH_LASTLINE will use it */
*buf = '\0';
if (encoding == ENC_QUOTED_PRINTABLE) {
claws_fclose(outfp);
claws_fclose(infp);
- account_signatures_matchlist_delete();
+ account_sigsep_matchlist_delete();
if (err == TRUE) {
return FALSE;
depth = g_node_depth(node);
for (i = 0; i < depth; i++)
g_print(" ");
- g_print("%s/%s (offset:%d length:%d encoding: %d)\n", typenames[mimeinfo->type], mimeinfo->subtype, mimeinfo->offset, mimeinfo->length, mimeinfo->encoding_type);
+ g_print("%s/%s (offset:%d length:%d encoding: %d)\n",
+ (mimeinfo->type < 8)? typenames[mimeinfo->type] : "unknown",
+ mimeinfo->subtype, mimeinfo->offset, mimeinfo->length, mimeinfo->encoding_type);
return FALSE;
}
/* Returns an open GInputStream. The caller should just
* read mimeinfo->length bytes from it and then release it. */
-GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo,
- GError **error)
+GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo)
{
cm_return_val_if_fail(mimeinfo != NULL, NULL);
if (mimeinfo->encoding_type != ENC_BINARY &&
- !procmime_decode_content(mimeinfo))
+ !procmime_decode_content(mimeinfo)) {
+ g_warning("could not decode part");
return NULL;
-
+ }
if (mimeinfo->content == MIMECONTENT_MEM) {
/* NULL for destroy func, since we're not copying
* the data for the stream. */
mimeinfo->length, g_free);
}
}
+
+GdkPixbuf *procmime_get_part_as_pixbuf(MimeInfo *mimeinfo, GError **error)
+{
+ GdkPixbuf *pixbuf;
+ GInputStream *stream;
+
+ if (error)
+ *error = NULL;
+
+ stream = procmime_get_part_as_inputstream(mimeinfo);
+ if (stream == NULL) {
+ if (error)
+ *error = g_error_new_literal(G_FILE_ERROR, -1, _("Could not decode part"));
+ return NULL;
+ }
+
+ pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, error);
+ g_object_unref(stream);
+
+ if (error && *error != NULL)
+ return NULL;
+
+ return pixbuf;
+}
+