#include <tny-store-account.h>
#include <tny-transport-account.h>
#include <tny-device.h>
-#include <tny-gnome-device.h>
#include <tny-account-store.h>
#include <tny-camel-transport-account.h>
#include <tny-camel-store-account.h>
#include <modest-marshal.h>
+#include <glib/gi18n.h>
#include "modest-account-mgr.h"
#include "modest-tny-account-store.h"
#include "modest-tny-platform-factory.h"
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
/* is it in the hash? if it's already there, it must be wrong... */
-// already_asked = g_hash_table_lookup (priv->password_hash, key) != NULL;
-/* if (already_asked) */
-/* g_warning ("password already asked for or in config (%s)", */
-/* key); */
-/* else */
-/* g_warning ("password not yet asked for or in config (%s)", */
-/* key); */
+ already_asked = g_hash_table_lookup (priv->password_hash, key) != NULL;
/* if the password is not already there, try ModestConf */
-// if (!already_asked)
+/* if (!already_asked) */
pwd = modest_account_mgr_get_string (priv->account_mgr,
key, MODEST_ACCOUNT_PASSWORD,
TRUE, NULL);
- /* if it was already asked, it must have been wrong, so ask again */
-/* if (!already_asked || !pwd || strlen(pwd) == 0) { */
-/* g_warning ("emit signal to get pass for %s", key); */
-
+/* /\* if it was already asked, it must have been wrong, so ask again *\/ */
+/* if (!already_asked || !pwd || strlen(pwd) == 0) { */
+
/* /\* we don't have it yet. we emit a signal to get the password somewhere *\/ */
/* const gchar* name = tny_account_get_name (account); */
/* *cancel = TRUE; */
/* } else */
/* *cancel = FALSE; */
-// g_hash_table_insert (priv->password_hash, (gpointer)key, (gpointer)pwd);
+/* g_hash_table_insert (priv->password_hash, key, pwd); */
return pwd;
}
TnyAccount *tny_account;
ModestTnyAccountStorePrivate *priv;
gchar *val;
-
+ GSList *options = NULL;
+ GError *error = NULL;
+
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (account, NULL);
g_return_val_if_fail (server_account, NULL);
return NULL;
}
+ /* Options */
+ options = modest_account_mgr_get_list (priv->account_mgr,
+ tny_account_get_id (tny_account),
+ MODEST_ACCOUNT_OPTIONS,
+ MODEST_CONF_VALUE_STRING,
+ TRUE,
+ &error);
+
+ if (error) {
+ g_warning ("Error retrieving account %s options: %s",
+ tny_account_get_id (tny_account), error->message);
+ g_error_free (error);
+ } else {
+ GSList *tmp = options;
+ while (options) {
+ tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account), options->data);
+ g_free (options->data);
+ options = g_slist_next (options);
+ }
+ g_slist_free (tmp);
+ }
+
/* hostname */
val = modest_account_mgr_get_string (priv->account_mgr, server_account,
MODEST_ACCOUNT_HOSTNAME, TRUE,
priv->store_lock = g_mutex_new ();
- /* FIXME: don't use GNOME */
pfact = TNY_PLATFORM_FACTORY (modest_tny_platform_factory_get_instance());
if (!pfact) {
g_printerr ("modest: cannot create platform factory\n");
cursor = accounts = modest_account_mgr_account_names (priv->account_mgr, NULL);
while (cursor) {
- gchar *account_name;
- gchar *server_account;
- TnyAccount *account;
-
- account_name = (gchar*)cursor->data;
- account = NULL;
+ gchar *account_name;
+ gchar *server_account;
+ TnyAccount *account;
+ gboolean is_server_account;
+
+ account_name = (gchar*)cursor->data;
+ account = NULL;
+ is_server_account = FALSE;
if (!modest_account_mgr_account_get_enabled (priv->account_mgr, account_name)) {
g_free (account_name);
if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT || modest_type == MODEST_PROTOCOL_TYPE_ANY) {
server_account = get_server_account_for_account (self, account_name,
MODEST_PROTOCOL_TYPE_TRANSPORT);
- if (server_account)
+ if (server_account) {
account = tny_account_from_name (self, account_name,
server_account,
MODEST_PROTOCOL_TYPE_TRANSPORT);
+ is_server_account = TRUE;
+ }
+
if (!account)
g_printerr ("modest: no transport account for '%s'\n",
account_name);
if (modest_type == MODEST_PROTOCOL_TYPE_STORE || modest_type == MODEST_PROTOCOL_TYPE_ANY) {
server_account = get_server_account_for_account (self, account_name,
MODEST_PROTOCOL_TYPE_STORE);
- if (server_account)
+ if (server_account) {
account = tny_account_from_name (self, account_name,
server_account,
MODEST_PROTOCOL_TYPE_STORE);
+ is_server_account = TRUE;
+ }
+
if (!account)
g_printerr ("modest: no store account for '%s'\n",
account_name);
g_slist_free (accounts);
tny_session_camel_set_account_store (priv->tny_session_camel, iface);
-/* tny_session_camel_set_current_accounts (priv->tny_session_camel, */
-/* list); */
}