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
{
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
{
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);
}
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;
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;
/* 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);
}
/*