From: Jose Dapena Paz Date: Mon, 10 Mar 2008 12:20:11 +0000 (+0000) Subject: * src/modest-mail-operation.c: X-Git-Tag: git_migration_finished~1575 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=d177faf17e34f7cffde5be9f86387dcd92f852e9 * src/modest-mail-operation.c: * If we haven't got cached messages, then we are in an open operation instead of a receive operation on moving messages (fixes NB#81891). pmo-trunk-r4293 --- diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 781d938..1f49f12 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -2244,16 +2244,29 @@ modest_mail_operation_get_msgs_full (ModestMailOperation *self, ModestMailOperationPrivate *priv = NULL; gint msg_list_size; TnyIterator *iter = NULL; + gboolean has_uncached_messages; g_return_if_fail (MODEST_IS_MAIL_OPERATION (self)); /* Init mail operation */ priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self); priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS; - priv->op_type = MODEST_MAIL_OPERATION_TYPE_RECEIVE; priv->done = 0; priv->total = tny_list_get_length(header_list); + /* Check uncached messages */ + for (iter = tny_list_create_iterator (header_list), has_uncached_messages = FALSE; + !has_uncached_messages && !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyHeader *header; + + header = (TnyHeader *) tny_iterator_get_current (iter); + if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED)) + has_uncached_messages = TRUE; + g_object_unref (header); + } + priv->op_type = has_uncached_messages?MODEST_MAIL_OPERATION_TYPE_RECEIVE:MODEST_MAIL_OPERATION_TYPE_OPEN; + /* Get account and set it into mail_operation */ if (tny_list_get_length (header_list) >= 1) { TnyIterator *iterator = tny_list_create_iterator (header_list);