{
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)
}
/* Set flags to supend sending operaiton (if removed, this is not necessary) */
- if (!remove) {
+ 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));
+ 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 */
TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->cancel_func (self, remove, err); /* FIXME */
+
+ frees:
+ if (headers != NULL)
+ g_object_unref (G_OBJECT (headers));
+ if (outbox != NULL)
+ g_object_unref (G_OBJECT (outbox));
+ if (iter != NULL)
+ g_object_unref (iter);
}
static void
case MODEST_TNY_SEND_QUEUE_UNKNONW:
case MODEST_TNY_SEND_QUEUE_SUSPENDED:
case MODEST_TNY_SEND_QUEUE_FAILED:
- tny_header_unset_flags (header, TNY_HEADER_FLAG_PRIORITY);
+ if (status != MODEST_TNY_SEND_QUEUE_SUSPENDED)
+ tny_header_unset_flags (header, TNY_HEADER_FLAG_PRIORITY);
existing = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE(self), msg_uid);
if(existing != NULL) return;
tny_camel_send_queue_flush (TNY_CAMEL_SEND_QUEUE(self));
frees:
- g_object_unref (G_OBJECT (headers));
- g_object_unref (G_OBJECT (outbox));
+ if (headers != NULL)
+ g_object_unref (G_OBJECT (headers));
+ if (outbox != NULL)
+ g_object_unref (G_OBJECT (outbox));
+ if (iter != NULL)
+ g_object_unref (iter);
}
gboolean
ModestTnySendQueueStatus queue_status = MODEST_TNY_SEND_QUEUE_SUSPENDED;
gchar *msg_uid = NULL;
- msg_uid = modest_tny_send_queue_get_msg_id (header);
+ msg_uid = modest_tny_send_queue_get_msg_id (header);
cache_mgr = modest_runtime_get_cache_mgr ();
send_queue_cache = modest_cache_mgr_get_cache (cache_mgr,
MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE);
ModestTnySendQueueStatus status = MODEST_TNY_SEND_QUEUE_WAITING;
const gchar *status_str = "";
if (msg_header != NULL) {
- /* TODO: ask send queue for msg sending status */
-/* status = get_status_of_uid (tny_header_get_message_id (msg_header)); */
status = get_status_of_uid (msg_header);
if (status == MODEST_TNY_SEND_QUEUE_SUSPENDED) {
tny_header_unset_flags (msg_header, TNY_HEADER_FLAG_PRIORITY);
tny_header_set_flags (msg_header, TNY_HEADER_FLAG_SUSPENDED_PRIORITY);
- }
+ }
/* if (prior_flags == TNY_HEADER_FLAG_SUSPENDED_PRIORITY) */
/* status = MODEST_TNY_SEND_QUEUE_SUSPENDED; */
}
status_str = get_status_string (status);
- /* TODO: for now we set the status to waiting always, we need a way to
- * retrieve the current send status of a message */
-/* status_str = get_status_string (MODEST_TNY_SEND_QUEUE_WAITING); */
display_date = g_strdup_printf("<small>%s</small>", status_str);
g_object_set (G_OBJECT (date_or_status_cell),
"markup", display_date,