- TnySendQueue *send_queue = NULL;
- ModestMailOperationPrivate *priv;
-
- g_return_if_fail (self && MODEST_IS_MAIL_OPERATION (self));
- g_return_if_fail (transport_account && TNY_IS_TRANSPORT_ACCOUNT (transport_account));
- g_return_if_fail (msg && TNY_IS_MSG (msg));
-
- priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
-
- /* Get account and set it into mail_operation */
- priv->account = g_object_ref (transport_account);
- priv->op_type = MODEST_MAIL_OPERATION_TYPE_SEND;
- priv->done = 1;
- priv->total = 1;
-
- send_queue = TNY_SEND_QUEUE (modest_runtime_get_send_queue (transport_account, TRUE));
- if (!TNY_IS_SEND_QUEUE(send_queue)) {
- if (priv->error) {
- g_error_free (priv->error);
- priv->error = NULL;
- }
- g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
- MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
- "modest: could not find send queue for account\n");
- priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
- modest_mail_operation_notify_end (self);
- } else {
- modest_mail_operation_notify_start (self);
- /* Add the msg to the queue. The callback will
- finalize the mail operation */
- tny_send_queue_add_async (send_queue, msg, send_mail_on_added_to_outbox,
- NULL, g_object_ref (self));
- modest_tny_send_queue_set_requested_send_receive (MODEST_TNY_SEND_QUEUE (send_queue),
- FALSE);
- }