Revision 3253 src/textview.c

View differences:

textview.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2012 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
......
1076 1076
	} else {
1077 1077
		/* text part */
1078 1078
		gtk_text_buffer_insert(buffer, &iter, "\n", 1);
1079
		if (!mimeinfo->main &&
1080
		    mimeinfo->parent &&
1081
		    mimeinfo->parent->children != mimeinfo)
1079
		if (mimeinfo->mime_type == MIME_TEXT_HTML ||
1080
		    (!mimeinfo->main && mimeinfo->parent &&
1081
		     mimeinfo->parent->children != mimeinfo))
1082 1082
			textview_add_part_widget(textview, &iter, mimeinfo, buf);
1083 1083
		textview_write_body(textview, mimeinfo, fp, charset);
1084 1084
	}
......
1142 1142
	level = mimeinfo->level;
1143 1143

  
1144 1144
	for (;;) {
1145
		textview_add_part(textview, mimeinfo, fp);
1146
		if (mimeinfo->parent && mimeinfo->parent->content_type &&
1147
		    !g_ascii_strcasecmp(mimeinfo->parent->content_type,
1148
					"multipart/alternative"))
1149
			mimeinfo = mimeinfo->parent->next;
1150
		else
1151
			mimeinfo = procmime_mimeinfo_next(mimeinfo);
1145
		if (mimeinfo->mime_type == MIME_MULTIPART &&
1146
		    mimeinfo->content_type &&
1147
		    !g_ascii_strcasecmp(mimeinfo->content_type,
1148
					"multipart/alternative")) {
1149
			MimeInfo *preferred_part = mimeinfo->children;
1150
			MimeInfo *child;
1151

  
1152
			if (prefs_common.alt_prefer_html) {
1153
				for (child = mimeinfo->children; child != NULL; child = child->next) {
1154
					if (child->mime_type == MIME_TEXT_HTML) {
1155
						preferred_part = child;
1156
						break;
1157
					}
1158
				}
1159
			}
1160

  
1161
			if (preferred_part) {
1162
				textview_add_part(textview, preferred_part, fp);
1163
				mimeinfo = preferred_part;
1164
				while (mimeinfo->next)
1165
					mimeinfo = mimeinfo->next;
1166
			}
1167
		} else {
1168
			textview_add_part(textview, mimeinfo, fp);
1169
		}
1170

  
1171
		mimeinfo = procmime_mimeinfo_next(mimeinfo);
1172

  
1152 1173
		if (!mimeinfo || mimeinfo->level <= level)
1153 1174
			break;
1154 1175
	}

Also available in: Unified diff