X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=824a67dec87b52b848cd7b34774c3492a28cfe8b;hp=c577ded5af1a9ae8e0ac4672f37bfadee4685bf6;hb=58cbe9db1e63b6f9bb18c9bac457e48cdaaff8a0;hpb=cb6d9108fd7dbff68eac11d1e790d81f64c85fa7 diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index c577ded..824a67d 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -818,8 +818,7 @@ modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self TnyAccountType type) { TnyAccount *account = NULL; - ModestAccountData *account_data; - const gchar *id = NULL; + gchar *id = NULL; ModestTnyAccountStorePrivate *priv; g_return_val_if_fail (self, NULL); @@ -828,17 +827,26 @@ modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self NULL); priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self); - - account_data = modest_account_mgr_get_account_data (priv->account_mgr, account_name); - if (!account_data) { - g_printerr ("modest: cannot get account data for account '%s'\n", account_name); - return NULL; - } - if (type == TNY_ACCOUNT_TYPE_STORE && account_data->store_account) - id = account_data->store_account->account_name; - else if (account_data->transport_account) - id = account_data->transport_account->account_name; + /* Special case for the local account */ + if (!strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID)) { + id = g_strdup (MODEST_LOCAL_FOLDERS_ACCOUNT_ID); + } else { + ModestAccountData *account_data; + + account_data = modest_account_mgr_get_account_data (priv->account_mgr, account_name); + if (!account_data) { + g_printerr ("modest: cannot get account data for account '%s'\n", account_name); + return NULL; + } + + if (type == TNY_ACCOUNT_TYPE_STORE && account_data->store_account) + id = g_strdup (account_data->store_account->account_name); + else if (account_data->transport_account) + id = g_strdup (account_data->transport_account->account_name); + + modest_account_mgr_free_account_data (priv->account_mgr, account_data); + } if (!id) g_printerr ("modest: could not get an id for account %s\n", @@ -851,7 +859,6 @@ modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self type == TNY_ACCOUNT_TYPE_STORE? "store" : "transport", account_name, id ? id : ""); - modest_account_mgr_free_account_data (priv->account_mgr, account_data); return account; }