+static gboolean
+has_contents_receiver (gpointer engine, const gchar *data,
+ size_t len, gboolean *has_contents)
+{
+ if (len > 1 || ((len == 1)&&(data[0]!='\n'))) {
+ *has_contents = TRUE;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean
+modest_msg_view_get_message_is_empty (ModestMsgView *self)
+{
+ /* TODO: Find some gtkhtml API to check whether there is any (visible, non markup)
+ * text in the message:
+ */
+ ModestMsgViewPrivate *priv = MODEST_MSG_VIEW_GET_PRIVATE (self);
+ gboolean has_contents = FALSE;
+
+ gtk_html_export (GTK_HTML (priv->gtkhtml), "text/plain",
+ (GtkHTMLSaveReceiverFn) has_contents_receiver, &has_contents);
+
+ return !has_contents;
+}
+
+