#include <tny-iterator.h>
#include <tny-folder.h>
#include <tny-camel-msg.h>
+#include <tny-folder-change.h>
+#include <tny-folder-observer.h>
#include <modest-tny-account.h>
#include <modest-runtime.h>
+#include <modest-platform.h>
#include <widgets/modest-window-mgr.h>
#include <modest-marshal.h>
#include <string.h> /* strcmp */
static void
modest_tny_send_queue_add (TnySendQueue *self, TnyMsg *msg, GError **err)
{
- ModestTnySendQueuePrivate *priv;
+ ModestTnySendQueuePrivate *priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE(self);
TnyHeader *header = NULL;
SendInfo *info = NULL;
GList* existing = NULL;
g_return_if_fail (TNY_IS_SEND_QUEUE(self));
g_return_if_fail (TNY_IS_CAMEL_MSG(msg));
- priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
- header = tny_msg_get_header (msg);
-
- /* Note that this call actually sets the message id to something
- * sensible. */
TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_func (self, msg, err); /* FIXME */
- /* Check whether the mail is already in the queue */
-/* msg_id = tny_header_get_message_id (header); */
- msg_id = tny_header_get_uid (header);
- g_return_if_fail (msg_id != NULL);
+ /* TODO: We cannot access the message ID of the message here because
+ * it might just have been created. Wait for it being added to outbox. */
+
+ header = tny_msg_get_header (msg);
+ msg_id = tny_header_get_message_id (header);
+ g_return_if_fail(msg_id != NULL);
+
+ /* Put newly added message in WAITING state */
existing = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE(self), msg_id);
if(existing != NULL)
{
g_signal_emit (self, signals[STATUS_CHANGED], 0, info->msg_id, info->status);
- /* free */
- g_object_unref (header);
+ g_object_unref(G_OBJECT(header));
}
static void
(GInstanceInitFunc) modest_tny_send_queue_instance_init,
NULL
};
+
my_type = g_type_register_static (TNY_TYPE_CAMEL_SEND_QUEUE,
"ModestTnySendQueue",
&my_info, 0);
/* Get message uid */
uid = tny_header_get_uid (header);
- tmp = g_strsplit (uid, "__", 2);
- if (tmp[1] != NULL)
- msg_uid = g_strconcat (tmp[0], "_", NULL);
- else
- msg_uid = g_strdup(tmp[0]);
-
- /* free */
- g_strfreev(tmp);
+ if (uid)
+ tmp = g_strsplit (uid, "__", 2);
+
+ if (tmp) {
+ if (tmp[1] != NULL)
+ msg_uid = g_strconcat (tmp[0], "_", NULL);
+ else
+ msg_uid = g_strdup(tmp[0]);
+
+ /* free */
+ g_strfreev(tmp);
+ }
return msg_uid;
}
g_queue_delete_link (priv->queue, item);
priv->current = NULL;
+ modest_platform_information_banner (NULL, NULL, _("mcen_ib_message_sent"));
+
/* free */
g_free(msg_id);
}