From 7144b415c73ff52615da3f8743a7801e6efa6bc7 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Thu, 17 Jan 2008 18:41:14 +0000 Subject: [PATCH] * Don't check size limits in modest_mail_operation_get_msgs_full. This mail operation is only used interactively and in those cases limits must not be used. * Remove obsolete error emev_ni_ui_imap_msg_size_exceed_error * Remove unused MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT Fixes NB#79414 pmo-trunk-r4061 --- src/modest-error.h | 1 - src/modest-mail-operation.c | 112 ++++++++++++++----------------------------- src/modest-ui-actions.c | 8 +--- 3 files changed, 36 insertions(+), 85 deletions(-) diff --git a/src/modest-error.h b/src/modest-error.h index cba6d3f..11a1803 100644 --- a/src/modest-error.h +++ b/src/modest-error.h @@ -45,7 +45,6 @@ typedef enum _ModestErrorCode { MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND, MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES, MODEST_MAIL_OPERATION_ERROR_FOLDER_EXISTS, /* Folder to be created exists already. */ - MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT, /* A message was too big to retrieve. */ MODEST_MAIL_OPERATION_ERROR_RETRIEVAL_NUMBER_LIMIT, /* There were too many messages to retrieve. */ MODEST_MAIL_OPERATION_ERROR_INSTANCE_CREATION_FAILED, } ModestErrorCode; diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index e178724..d053862 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -2246,8 +2246,7 @@ modest_mail_operation_get_msgs_full (ModestMailOperation *self, GDestroyNotify notify) { ModestMailOperationPrivate *priv = NULL; - gboolean size_ok = TRUE; - gint max_size; + gint msg_list_size; TnyIterator *iter = NULL; g_return_if_fail (MODEST_IS_MAIL_OPERATION (self)); @@ -2278,84 +2277,43 @@ modest_mail_operation_get_msgs_full (ModestMailOperation *self, } } - /* Get msg size limit */ - max_size = modest_conf_get_int (modest_runtime_get_conf (), - MODEST_CONF_MSG_SIZE_LIMIT, - &(priv->error)); - if (priv->error) { - g_clear_error (&(priv->error)); - max_size = G_MAXINT; - } else { - max_size = max_size * KB; - } + msg_list_size = compute_message_list_size (header_list); - /* Check message size limits. If there is only one message - always retrieve it */ - if (iter != NULL) { - while (!tny_iterator_is_done (iter) && size_ok) { - TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter)); - if (header) { - if (tny_header_get_message_size (header) >= max_size) - size_ok = FALSE; - g_object_unref (header); - } - - tny_iterator_next (iter); - } - g_object_unref (iter); - } - - if (size_ok) { - const gint msg_list_size = compute_message_list_size (header_list); + modest_mail_operation_notify_start (self); + iter = tny_list_create_iterator (header_list); + while (!tny_iterator_is_done (iter)) { + /* notify about the start of the operation */ + ModestMailOperationState *state; + state = modest_mail_operation_clone_state (self); + state->done = 0; + state->total = 0; + g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], + 0, state, NULL); - modest_mail_operation_notify_start (self); - iter = tny_list_create_iterator (header_list); - while (!tny_iterator_is_done (iter)) { - /* notify about the start of the operation */ - ModestMailOperationState *state; - state = modest_mail_operation_clone_state (self); - state->done = 0; - state->total = 0; - g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], - 0, state, NULL); - - GetMsgInfo *msg_info = NULL; - TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter)); - TnyFolder *folder = tny_header_get_folder (header); - - /* Create the message info */ - msg_info = g_slice_new0 (GetMsgInfo); - msg_info->mail_op = g_object_ref (self); - msg_info->header = g_object_ref (header); - msg_info->user_callback = user_callback; - msg_info->user_data = user_data; - msg_info->destroy_notify = notify; - msg_info->last_total_bytes = 0; - msg_info->sum_total_bytes = 0; - msg_info->total_bytes = msg_list_size; - - /* The callback will call it per each header */ - tny_folder_get_msg_async (folder, header, get_msg_async_cb, get_msg_status_cb, msg_info); - - /* Free and go on */ - g_object_unref (header); - g_object_unref (folder); - tny_iterator_next (iter); - } - g_object_unref (iter); - } else { - /* Set status failed and set an error */ - priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; - /* FIXME: the error msg is different for pop */ - g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, - MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT, - _("emev_ni_ui_imap_msg_size_exceed_error")); - /* Remove from queue and free resources */ - modest_mail_operation_notify_end (self); - if (notify) - notify (user_data); + GetMsgInfo *msg_info = NULL; + TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter)); + TnyFolder *folder = tny_header_get_folder (header); + + /* Create the message info */ + msg_info = g_slice_new0 (GetMsgInfo); + msg_info->mail_op = g_object_ref (self); + msg_info->header = g_object_ref (header); + msg_info->user_callback = user_callback; + msg_info->user_data = user_data; + msg_info->destroy_notify = notify; + msg_info->last_total_bytes = 0; + msg_info->sum_total_bytes = 0; + msg_info->total_bytes = msg_list_size; + + /* The callback will call it per each header */ + tny_folder_get_msg_async (folder, header, get_msg_async_cb, get_msg_status_cb, msg_info); + + /* Free and go on */ + g_object_unref (header); + g_object_unref (folder); + tny_iterator_next (iter); } - + g_object_unref (iter); } diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index ea4cd48..8d618d3 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -1020,16 +1020,10 @@ modest_ui_actions_get_msgs_full_error_handler (ModestMailOperation *mail_op, { const GError *error; GObject *win = NULL; - const gchar *err_msg; + const gchar *err_msg = (const gchar *) user_data; win = modest_mail_operation_get_source (mail_op); error = modest_mail_operation_get_error (mail_op); - - /* Select error message */ - if (error->code == MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT) - err_msg = _("emev_ni_ui_imap_msg_size_exceed_error"); - else - err_msg = (const gchar *) user_data; /* Show error */ modest_platform_run_information_dialog ((GtkWindow *) win, err_msg); -- 1.7.9.5