X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-mail-operation.c;h=81afa1aa3b60d4ce207c62270e7dbb460240875e;hp=0b68327bbd3fa8f4baf0fb43f0c42d0038e63f42;hb=da78e6ee855df22bbf1dc327d551c9ccd4206c3a;hpb=485870760ff8f682e2d2cb76f9772306be45e230 diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 0b68327..81afa1a 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -648,16 +648,14 @@ static void common_send_mail_operation_end (TnySendQueue *queue, TnyMsg *msg, SendMsgInfo *info) { - if (msg == info->msg) { - g_signal_handler_disconnect (queue, info->msg_sent_handler); - info->msg_sent_handler = 0; - g_signal_handler_disconnect (queue, info->error_happened_handler); - info->error_happened_handler = 0; - g_object_unref (info->msg); - modest_mail_operation_notify_end (info->mail_op); - g_object_unref (info->mail_op); - g_slice_free (SendMsgInfo, info); - } + g_signal_handler_disconnect (queue, info->msg_sent_handler); + g_signal_handler_disconnect (queue, info->error_happened_handler); + + g_object_unref (info->msg); + modest_mail_operation_notify_end (info->mail_op); + g_object_unref (info->mail_op); + + g_slice_free (SendMsgInfo, info); } static void @@ -666,12 +664,13 @@ send_mail_msg_sent_handler (TnySendQueue *queue, TnyHeader *header, TnyMsg *msg, { SendMsgInfo *info = (SendMsgInfo *) userdata; - if (msg == info->msg) { + if (!strcmp (tny_msg_get_url_string (msg), + tny_msg_get_url_string (info->msg))) { ModestMailOperationPrivate *priv = MODEST_MAIL_OPERATION_GET_PRIVATE (info->mail_op); priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS; + + common_send_mail_operation_end (queue, msg, info); } - - common_send_mail_operation_end (queue, msg, info); } static void @@ -680,15 +679,16 @@ send_mail_error_happened_handler (TnySendQueue *queue, TnyHeader *header, TnyMsg { SendMsgInfo *info = (SendMsgInfo *) userdata; - if (msg == info->msg) { + if (!strcmp (tny_msg_get_url_string (msg), + tny_msg_get_url_string (info->msg))) { ModestMailOperationPrivate *priv = MODEST_MAIL_OPERATION_GET_PRIVATE (info->mail_op); priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, MODEST_MAIL_OPERATION_ERROR_OPERATION_CANCELED, "modest: send mail failed\n"); + + common_send_mail_operation_end (queue, msg, info); } - - common_send_mail_operation_end (queue, msg, info); } @@ -1291,6 +1291,9 @@ inbox_refreshed_cb (TnyFolder *inbox, g_object_unref (info->inbox_observer); info->inbox_observer = NULL; + /* Update the last updated key, even if we don't have to get new headers */ + modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL)); + if (new_headers_array->len == 0) goto send_mail; @@ -1350,9 +1353,6 @@ inbox_refreshed_cb (TnyFolder *inbox, g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL); g_ptr_array_free (new_headers_array, FALSE); - /* Update the last updated key */ - modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL)); - send_mail: /* Send mails */ priv->done = 0; @@ -1550,9 +1550,9 @@ modest_mail_operation_update_account (ModestMailOperation *self, /* Get all folders and continue in the callback */ folders = tny_simple_list_new (); - tny_folder_store_get_folders_async (TNY_FOLDER_STORE (store_account), - folders, recurse_folders_async_cb, - NULL, NULL, info); + tny_folder_store_get_folders_async (TNY_FOLDER_STORE (store_account), + folders, recurse_folders_async_cb, + NULL, NULL, info); } /*