local_account = modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store(),
MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
account_id);
+ if (!local_account) {
+ g_printerr ("modest: %s: modest_tny_account_store_get_tny_account_by(ID) returned NULL for %s\n", __FUNCTION__, account_id);
+ return NULL;
+ }
+
g_free (account_id);
} else {
/* Other local folders are all in one on-disk directory: */
/* There is no need to do this _async, as these are local folders. */
/* TODO: However, this seems to fail sometimes when the network is busy,
- * returning an empty list. murrayc. */
+ * returning an empty list. murrayc. */
tny_folder_store_get_folders (TNY_FOLDER_STORE (local_account),
folders, NULL, NULL);
+
+ if (tny_list_get_length (folders) == 0) {
+ gchar* url_string = tny_account_get_url_string (local_account);
+ g_printerr ("modest: %s: tny_folder_store_get_folders() returned an empty list for account with URL '%s'\n",
+ __FUNCTION__, url_string);
+ g_free (url_string);
+ }
+
iter = tny_list_create_iterator (folders);
while (!tny_iterator_is_done (iter)) {
g_object_unref (G_OBJECT (iter));
g_object_unref (G_OBJECT (local_account));
+ /*
+ if (!special_folder) {
+ g_warning ("%s: Returning NULL.", __FUNCTION__);
+ }
+ */
+
return special_folder;
}
/**
* modest_tny_account_new_from_server_account:
* @account_mgr: a valid account mgr instance
- * @account_name: the server account name for which to create a corresponding tny account
+ * @session: A valid TnySessionCamel instance.
+ * @account_data: the server account for which to create a corresponding tny account
* @type: the type of account to create (TNY_ACCOUNT_TYPE_STORE or TNY_ACCOUNT_TYPE_TRANSPORT)
*
* get a tnyaccount corresponding to the server_accounts (store or transport) for this account.
*/
static TnyAccount*
modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
+ TnySessionCamel *session,
ModestServerAccountData *account_data)
{
gchar *url = NULL;
g_return_val_if_fail (account_mgr, NULL);
+ g_return_val_if_fail (session, NULL);
g_return_val_if_fail (account_data, NULL);
/* sanity checks */
}
tny_account_set_id (tny_account, account_data->account_name);
+ /* This must be set quite early, or other set() functions will fail. */
+ tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (tny_account), session);
+
/* Handle connection requests:
* This (badly-named) signal will be called when we try to use an offline account. */
g_signal_connect (G_OBJECT (tny_account), "connection-status-changed",
TnyAccount*
modest_tny_account_new_from_server_account_name (ModestAccountMgr *account_mgr,
- const gchar *server_account_name)
+ TnySessionCamel *session,
+ const gchar *server_account_name)
{
ModestServerAccountData *account_data =
modest_account_mgr_get_server_account_data (account_mgr,
return NULL;
TnyAccount *result = modest_tny_account_new_from_server_account (
- account_mgr, account_data);
+ account_mgr, session, account_data);
modest_account_mgr_free_server_account_data (account_mgr, account_data);
return NULL;
}
- tny_account = modest_tny_account_new_from_server_account (account_mgr, server_data);
+ tny_account = modest_tny_account_new_from_server_account (account_mgr, session, server_data);
if (!tny_account) {
g_printerr ("modest: failed to create tny account for %s (%s)\n",
account_data->account_name, server_data->account_name);
return NULL;
}
- tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session);
tny_account_set_forget_pass_func (tny_account,
forget_pass_func ? forget_pass_func : forget_pass_dummy);
tny_account_set_pass_func (tny_account,