aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-04-05 02:43:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-04-05 02:43:19 +0000
commit7cc11916c2c87fb93a1ef39204751c96659d9c60 (patch)
tree0db763c14380a9d8f71c969e41836b0953ecf2f1
parent6eaee63faf9ec3311f75c3280bbbca769f65449c (diff)
print all texts in messages with print command.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3250 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--libsylph/procmsg.c43
2 files changed, 11 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index a6594e34..04096ce7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-04-05
+ * libsylph/procmsg.c: procmsg_print_message(): print all texts in
+ messages, not only the first one.
+
+2013-04-05
+
* src/printing.c: print all texts in messages, not only the first one.
2013-04-04
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index dd880a15..869c59de 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -1720,7 +1720,8 @@ static gint print_command_exec(const gchar *file, const gchar *cmdline)
if (buf[strlen(buf) - 1] != '&')
strcat(buf, "&");
- system(buf);
+ if (system(buf) != 0)
+ return -1;
return 0;
}
@@ -1792,49 +1793,17 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline,
gboolean all_headers)
{
gchar *prtmp;
- FILE *msgfp, *tmpfp, *prfp;
- gchar buf[BUFFSIZE];
g_return_if_fail(msginfo != NULL);
- if ((tmpfp = procmime_get_first_text_content
- (msginfo, conv_get_locale_charset_str())) == NULL) {
- g_warning("Can't get text part\n");
- return;
- }
-
prtmp = g_strdup_printf("%s%cprinttmp-%08x.txt",
get_mime_tmp_dir(), G_DIR_SEPARATOR,
print_id++);
- if ((prfp = g_fopen(prtmp, "w")) == NULL) {
- FILE_OP_ERROR(prtmp, "procmsg_print_message: fopen");
- g_free(prtmp);
- fclose(tmpfp);
- return;
- }
-
- if ((msgfp = procmsg_open_message(msginfo)) == NULL) {
- fclose(prfp);
- g_free(prtmp);
- fclose(tmpfp);
- return;
- }
-
- procmsg_write_headers(msginfo, NULL, msgfp, prfp,
- conv_get_locale_charset_str(), all_headers);
-
- fclose(msgfp);
-
- fputc('\n', prfp);
-
- while (fgets(buf, sizeof(buf), tmpfp) != NULL)
- fputs(buf, prfp);
-
- fclose(prfp);
- fclose(tmpfp);
-
- print_command_exec(prtmp, cmdline);
+ if (procmsg_save_message_as_text(msginfo, prtmp,
+ conv_get_locale_charset_str(),
+ all_headers) == 0)
+ print_command_exec(prtmp, cmdline);
g_free(prtmp);
}