ModestAccountMgr *mgr;
ModestAccountRetrieveType retrieve_type;
TnyList *new_headers = NULL;
- gboolean headers_only, ignore_limit;
+ gboolean headers_only, ignore_limit, succeeded;
TnyTransportAccount *transport_account = NULL;
info = (UpdateAccountInfo *) user_data;
/* Update the last updated key, even if we don't have to get new headers */
modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL));
+ if (!canceled && !err)
+ modest_account_mgr_set_server_account_username_has_succeeded (mgr, tny_account_get_id (priv->account), TRUE);
if (new_headers_array->len == 0)
goto send_mail;
g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL);
g_ptr_array_free (new_headers_array, FALSE);
+ if (priv->error)
+ succeeded = FALSE;
+ else
+ succeeded = TRUE;
+ modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (),
+ tny_account_get_name (priv->account),
+ succeeded);
send_mail:
/* Get the transport account */
transport_account = (TnyTransportAccount *)
if (err || canceled) {
/* Try to continue anyway */
- } else {
+ } else if (info->poke_all) {
+ /* We're not getting INBOX children if we don't want to poke all */
TnyIterator *iter = tny_list_create_iterator (list);
while (!tny_iterator_is_done (iter)) {
TnyFolderStore *folder = (TnyFolderStore*) tny_iterator_get_current (iter);
account_name,
TNY_ACCOUNT_TYPE_STORE);
+ /* The above function could return NULL */
+ if (!priv->account) {
+ /* Check if the operation was a success */
+ g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
+ MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
+ "no account");
+ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
+
+ /* Call the user callback */
+ if (callback)
+ callback (self, NULL, user_data);
+
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
+
+ return;
+ }
+
/* Create the helper object */
info = g_slice_new0 (UpdateAccountInfo);
info->pending_calls = 1;
helper->user_callback = user_callback;
helper->user_data = user_data;
- /* Refresh the folder. TODO: tinymail could issue a status
- updates before the callback call then this could happen. We
- must review the design */
modest_mail_operation_notify_start (self);
/* notify that the operation was started */