/* Special folders */
TnyFolder *outbox;
TnyFolder *sentbox;
+
+ /* last was send receive operation?*/
+ gboolean requested_send_receive;
};
#define MODEST_TNY_SEND_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->sentbox = modest_tny_account_get_special_folder (TNY_ACCOUNT(account),
TNY_FOLDER_TYPE_SENT);
+ priv->requested_send_receive = FALSE;
+
headers = tny_simple_list_new ();
tny_folder_get_headers (priv->outbox, headers, TRUE, NULL);
gpointer user_data)
{
ModestTnySendQueuePrivate *priv = NULL;
- SendInfo *info = NULL;
- GList *item = NULL;
- gchar* msg_uid = NULL;
priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
-
- /* Get sending info (create new if it doesn not exist) */
- msg_uid = modest_tny_send_queue_get_msg_id (header);
- item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self),
- msg_uid);
- info = item->data;
+ /* Note that header could be NULL. Tinymail notifies about
+ generic send queue errors with this signal as well, and
+ those notifications are not bound to any particular header
+ or message */
+ if (header) {
+ SendInfo *info = NULL;
+ GList *item = NULL;
+ gchar* msg_uid = NULL;
+
+ /* Get sending info (create new if it doesn not exist) */
+ msg_uid = modest_tny_send_queue_get_msg_id (header);
+ item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self),
+ msg_uid);
+
+ info = item->data;
- /* Keep in queue so that we remember that the opertion has failed */
- /* and was not just cancelled */
- if (err->code == TNY_SYSTEM_ERROR_CANCEL)
- info->status = MODEST_TNY_SEND_QUEUE_SUSPENDED;
- else
- info->status = MODEST_TNY_SEND_QUEUE_FAILED;
- priv->current = NULL;
-
- /* Notify status has changed */
- g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status);
+ /* Keep in queue so that we remember that the opertion has failed */
+ /* and was not just cancelled */
+ if (err->code == TNY_SYSTEM_ERROR_CANCEL)
+ info->status = MODEST_TNY_SEND_QUEUE_SUSPENDED;
+ else
+ info->status = MODEST_TNY_SEND_QUEUE_FAILED;
+ priv->current = NULL;
+
+ /* Notify status has changed */
+ g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status);
- /* free */
- g_free(msg_uid);
+ /* free */
+ g_free(msg_uid);
+ }
}
static void
g_object_unref (iter);
g_object_unref (G_OBJECT (headers));
}
+
+gboolean
+modest_tny_send_queue_get_requested_send_receive (ModestTnySendQueue *self)
+{
+ ModestTnySendQueuePrivate *priv;
+
+ g_return_val_if_fail (MODEST_IS_TNY_SEND_QUEUE (self), FALSE);
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+
+ return priv->requested_send_receive;
+}
+
+void
+modest_tny_send_queue_set_requested_send_receive (ModestTnySendQueue *self, gboolean requested_send_receive)
+{
+ ModestTnySendQueuePrivate *priv;
+
+ g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE (self));
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+
+ priv->requested_send_receive = requested_send_receive;
+}