Revision 3249 src/printing.c

View differences:

printing.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2006 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
48 48
	MsgInfo *msginfo;
49 49
	gint n_pages;
50 50
	gchar *hdr_data;
51
	gchar *msg_text_file;
51 52
	FILE *fp;
52 53
} MsgPrintInfo;
53 54

  
......
173 174
	gint n_pages = 1;
174 175
	PageInfo *pinfo;
175 176
	gint i;
176
	FILE *fp;
177
	FILE *fp = NULL;
177 178
	gchar buf[BUFFSIZE];
178 179
	glong pos = 0;
179 180

  
......
229 230
					       NULL);
230 231
		fclose(msgfp);
231 232
	} else {
232
		fp = procmime_get_first_text_content(mpinfo->msginfo, NULL);
233
		mpinfo->msg_text_file = get_tmp_file();
234
		if (procmsg_save_message_as_text(mpinfo->msginfo, mpinfo->msg_text_file, NULL, print_data->all_headers) == 0) {
235
			if ((fp = g_fopen(mpinfo->msg_text_file, "rb")) != NULL) {
236
				while (fgets(buf, sizeof(buf), fp) != NULL)
237
					if (buf[0] == '\r' || buf[0] == '\n')
238
						break;
239
			}
240
		}
233 241
	}
234 242
	if (!fp) {
235 243
		g_warning("Can't get text part\n");
......
486 494
		g_free(print_data->msgs[i].hdr_data);
487 495
		if (print_data->msgs[i].fp)
488 496
			fclose(print_data->msgs[i].fp);
497
		if (print_data->msgs[i].msg_text_file) {
498
			g_unlink(print_data->msgs[i].msg_text_file);
499
			g_free(print_data->msgs[i].msg_text_file);
500
		}
489 501
	}
490 502
	g_free(print_data);
491 503

  

Also available in: Unified diff