X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-account-mgr-helpers.c;h=1542e83b53d0e819dcca716f8ced84200c648da3;hp=d1c36264ed7a6fba9c54af2e93df9bc2fb72c4de;hb=f8f62f368b4cc8403b6e118510a786c6db098df9;hpb=7929406e046ed92142ff337bd9161e6a16e1d04e diff --git a/src/modest-account-mgr-helpers.c b/src/modest-account-mgr-helpers.c index d1c3626..1542e83 100644 --- a/src/modest-account-mgr-helpers.c +++ b/src/modest-account-mgr-helpers.c @@ -65,13 +65,13 @@ gboolean modest_account_mgr_set_signature (ModestAccountMgr *self, const gchar* return result; } -gchar* modest_account_mgr_get_signature (ModestAccountMgr *self, const gchar* name, - gboolean* use_signature) +gchar* +modest_account_mgr_get_signature (ModestAccountMgr *self, + const gchar* name, + gboolean* use_signature) { - if (use_signature) { - *use_signature = - modest_account_mgr_get_bool (self, name, MODEST_ACCOUNT_USE_SIGNATURE, FALSE); - } + *use_signature = + modest_account_mgr_get_bool (self, name, MODEST_ACCOUNT_USE_SIGNATURE, FALSE); return modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_SIGNATURE, FALSE); } @@ -98,9 +98,9 @@ ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccoun gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self, - const gchar* connection_name, const gchar* server_account_name) + const gchar* connection_id, const gchar* server_account_name) { - modest_account_mgr_remove_connection_specific_smtp (self, connection_name); + modest_account_mgr_remove_connection_specific_smtp (self, connection_id); ModestConf *conf = MODEST_ACCOUNT_MGR_GET_PRIVATE (self)->modest_conf; @@ -115,7 +115,7 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self result = FALSE; } else { /* The server account is in the item after the connection name: */ - list = g_slist_append (list, (gpointer)connection_name); + list = g_slist_append (list, (gpointer)connection_id); list = g_slist_append (list, (gpointer)server_account_name); /* Reset the changed list: */ @@ -138,22 +138,22 @@ gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self * modest_account_mgr_remove_connection_specific_smtp * @self: a ModestAccountMgr instance * @name: the account name - * @connection_name: A libconic IAP connection name + * @connection_id: A libconic IAP connection id * * Disassacoiate a server account to use with the specific connection for this account. * * Returns: TRUE if it worked, FALSE otherwise */ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self, - const gchar* connection_name) + const gchar* connection_id) { ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); gboolean result = TRUE; GError *err = NULL; GSList *list = modest_conf_get_list (priv->modest_conf, - MODEST_CONF_CONNECTION_SPECIFIC_SMTP_LIST, - MODEST_CONF_VALUE_STRING, &err); + MODEST_CONF_CONNECTION_SPECIFIC_SMTP_LIST, + MODEST_CONF_VALUE_STRING, &err); if (err) { g_printerr ("modest: %s: error getting list: %s.\n", __FUNCTION__, err->message); g_error_free (err); @@ -165,7 +165,7 @@ gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *s return FALSE; /* The server account is in the item after the connection name: */ - GSList *list_connection = g_slist_find_custom (list, connection_name, (GCompareFunc)strcmp); + GSList *list_connection = g_slist_find_custom (list, connection_id, (GCompareFunc)strcmp); if (list_connection) { GSList *account_node = g_slist_next (list_connection); /* remove both items: */ @@ -205,13 +205,13 @@ gboolean modest_account_mgr_set_use_connection_specific_smtp (ModestAccountMgr * /** * modest_account_mgr_get_connection_specific_smtp * @self: a ModestAccountMgr instance - * @connection_name: A libconic IAP connection name + * @connection_id: A libconic IAP connection id * * Retrieve a server account to use with this specific connection for this account. * * Returns: a server account name to use for this connection, or NULL if none is specified. */ -gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, const gchar* connection_name) +gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, const gchar* connection_id) { gchar *result = NULL; @@ -232,8 +232,8 @@ gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, /* The server account is in the item after the connection name: */ GSList *iter = list; while (iter) { - const gchar* this_connection_name = (const gchar*)(iter->data); - if (strcmp (this_connection_name, connection_name) == 0) { + const gchar* this_connection_id = (const gchar*)(iter->data); + if (strcmp (this_connection_id, connection_id) == 0) { iter = g_slist_next (iter); if (iter) { @@ -253,7 +253,7 @@ gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, /* if (!result) { - printf (" debug: no server found for connection_name=%s.\n", connection_name); + printf (" debug: no server found for connection_id=%s.\n", connection_id); } */ @@ -284,8 +284,7 @@ modest_account_mgr_set_server_account_username (ModestAccountMgr *self, const gc /* We don't know anything about new usernames: */ if (strcmp (existing_username, username) != 0) - modest_account_mgr_set_server_account_username_has_succeeded (self, account_name, - TRUE); + modest_account_mgr_set_server_account_username_has_succeeded (self, account_name, FALSE); g_free (existing_username); } @@ -306,15 +305,6 @@ modest_account_mgr_set_server_account_username_has_succeeded (ModestAccountMgr * succeeded, TRUE /* server account */); } -void -modest_account_mgr_set_server_account_password (ModestAccountMgr *self, const gchar* account_name, - const gchar* password) -{ - modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PASSWORD, - password, TRUE /* server account */); -} - - gchar* modest_account_mgr_get_server_account_password (ModestAccountMgr *self, const gchar* account_name) { @@ -496,25 +486,32 @@ modest_account_mgr_save_server_settings (ModestAccountMgr *self, has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_HOSTNAME, hostname, TRUE); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_USERNAME, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_USERNAME, username, TRUE)); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PASSWORD, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PASSWORD, password, TRUE)); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PROTO, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PROTO, protocol, TRUE)); - has_errors || (has_errors = !modest_account_mgr_set_int (self, account_name, MODEST_ACCOUNT_PORT, + if (!has_errors) + (has_errors = !modest_account_mgr_set_int (self, account_name, MODEST_ACCOUNT_PORT, port, TRUE)); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_AUTH_MECH, auth_protocol, TRUE)); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_SECURITY, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_SECURITY, security, TRUE)); } else { const gchar *uri = modest_server_account_settings_get_uri (settings); has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_URI, uri, TRUE); - has_errors || (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PROTO, + if (!has_errors) + (has_errors = !modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_PROTO, protocol, TRUE)); } @@ -566,6 +563,7 @@ modest_account_mgr_load_account_settings (ModestAccountMgr *self, modest_account_settings_set_enabled (settings, modest_account_mgr_get_enabled (self, name)); modest_account_settings_set_retrieve_type (settings, modest_account_mgr_get_retrieve_type (self, name)); + modest_account_settings_set_retrieve_limit (settings, modest_account_mgr_get_retrieve_limit (self, name)); default_account = modest_account_mgr_get_default_account (self); modest_account_settings_set_is_default (settings,