+{
+ ModestTnySendQueuePrivate *priv;
+ SendInfo *info;
+ TnyIterator *iter = NULL;
+ TnyFolder *outbox = NULL;
+ TnyList *headers = tny_simple_list_new ();
+ TnyHeader *header = NULL;
+
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+ if(priv->current != NULL)
+ {
+ info = priv->current->data;
+ priv->current = NULL;
+
+ /* Keep in list until retry, so that we know that this was suspended
+ * by the user and not by an error. */
+ info->status = MODEST_TNY_SEND_QUEUE_SUSPENDED;
+
+ g_signal_emit (self, signals[STATUS_CHANGED], 0, info->msg_id, info->status);
+ }
+
+ /* Set flags to supend sending operaiton (if removed, this is not necessary) */
+ if (!remove) {
+ outbox = modest_tny_send_queue_get_outbox (TNY_SEND_QUEUE(self));
+ tny_folder_get_headers (outbox, headers, TRUE, err);
+ if (err != NULL) goto frees;
+ iter = tny_list_create_iterator (headers);
+ while (!tny_iterator_is_done (iter)) {
+ header = TNY_HEADER (tny_iterator_get_current (iter));
+ if (header) {
+ tny_header_unset_flags (header, TNY_HEADER_FLAG_PRIORITY);
+ tny_header_set_flags (header, TNY_HEADER_FLAG_SUSPENDED_PRIORITY);
+ tny_iterator_next (iter);
+ g_object_unref (header);
+ }
+ }
+
+ g_queue_foreach (priv->queue, (GFunc)modest_tny_send_queue_info_free, NULL);
+ g_queue_free (priv->queue);
+ priv->queue = g_queue_new();
+ }
+
+ /* Dont call super class implementaiton, becasue camel removes messages from outbox */