messageview->statusbar = NULL;
messageview->statusbar_cid = 0;
+ messageview->show_full_text= FALSE;
+
messageview->msginfo_update_callback_id =
hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, messageview_update_msg, (gpointer) messageview);
gchar *subject = NULL;
g_return_val_if_fail(msginfo != NULL, -1);
+ if (msginfo != messageview->msginfo)
+ messageview->show_full_text = FALSE;
+
if (messageview->mimeview->textview &&
messageview->mimeview->textview->loading) {
messageview->mimeview->textview->stop_loading = TRUE;
main_create_mailing_list_menu(messageview->mainwin, messageview->msginfo);
if (messageview->msginfo && messageview->msginfo->extradata
- && messageview->msginfo->extradata->partial_recv)
+ && messageview->msginfo->extradata->partial_recv
+ && !noticeview_is_visible(messageview->noticeview))
partial_recv_show(messageview->noticeview,
messageview->msginfo);
else if (messageview->msginfo && messageview->msginfo->extradata &&
(messageview->msginfo->extradata->dispositionnotificationto ||
messageview->msginfo->extradata->returnreceiptto) &&
!MSG_IS_RETRCPT_SENT(messageview->msginfo->flags) &&
- !prefs_common.never_send_retrcpt)
+ !prefs_common.never_send_retrcpt &&
+ !noticeview_is_visible(messageview->noticeview))
return_receipt_show(messageview->noticeview,
messageview->msginfo);
return FALSE;
}
#endif
+
+static void messageview_show_partial_display_cb(NoticeView *noticeview, MessageView *messageview)
+{
+ messageview->show_full_text = TRUE;
+ main_window_cursor_wait(mainwindow_get_mainwindow());
+ GTK_EVENTS_FLUSH();
+ messageview_show(messageview, messageview->msginfo, messageview->all_headers);
+ main_window_cursor_normal(mainwindow_get_mainwindow());
+}
+
+void messageview_show_partial_display(MessageView *messageview, MsgInfo *msginfo,
+ size_t length)
+{
+ gchar *msg = g_strdup_printf(_("Show all %s."), to_human_readable(length));
+ noticeview_set_icon(messageview->noticeview, STOCK_PIXMAP_NOTICE_WARN);
+ noticeview_set_text(messageview->noticeview, _("Only the first megabyte of text is shown."));
+ noticeview_set_button_text(messageview->noticeview, msg);
+ g_free(msg);
+ noticeview_set_button_press_callback(messageview->noticeview,
+ G_CALLBACK(messageview_show_partial_display_cb),
+ (gpointer) messageview);
+ noticeview_show(messageview->noticeview);
+}
+
static void return_receipt_show(NoticeView *noticeview, MsgInfo *msginfo)
{
gchar *addr = NULL;
CodeConverter *conv;
const gchar *charset, *p, *cmd;
GSList *cur;
-
+ gboolean continue_write = TRUE;
+ size_t wrote = 0, i = 0;
+
if (textview->messageview->forced_charset)
charset = textview->messageview->forced_charset;
else
}
fseek(tmpfp, mimeinfo->offset, SEEK_SET);
debug_print("Viewing text content of type: %s (length: %d)\n", mimeinfo->subtype, mimeinfo->length);
- while ((ftell(tmpfp) < mimeinfo->offset + mimeinfo->length) &&
- (fgets(buf, sizeof(buf), tmpfp) != NULL)) {
+ while (((i = ftell(tmpfp)) < mimeinfo->offset + mimeinfo->length) &&
+ (fgets(buf, sizeof(buf), tmpfp) != NULL)
+ && continue_write) {
textview_write_line(textview, buf, conv, TRUE);
if (textview->stop_loading) {
fclose(tmpfp);
return;
}
+ wrote += ftell(tmpfp)-i;
+ if (mimeinfo->length > 1024*1024
+ && wrote > 1024*1024
+ && !textview->messageview->show_full_text) {
+ continue_write = FALSE;
+ }
}
fclose(tmpfp);
}
}
}
+ if (continue_write == FALSE) {
+ messageview_show_partial_display(
+ textview->messageview,
+ textview->messageview->msginfo,
+ mimeinfo->length);
+ }
GTK_EVENTS_FLUSH();
}