#include <modest-runtime.h>
#include <modest-defs.h>
#include <string.h>
+#include <strings.h>
static const gchar * null_means_empty (const gchar * str);
}
-gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self,
- const gchar* connection_id, const gchar* server_account_name)
+gboolean
+modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self,
+ const gchar* connection_id,
+ const gchar* server_account_name)
{
modest_account_mgr_remove_connection_specific_smtp (self, connection_id);
result = FALSE;
} else {
/* The server account is in the item after the connection name: */
- list = g_slist_append (list, (gpointer)connection_id);
- list = g_slist_append (list, (gpointer)server_account_name);
+ list = g_slist_append (list, g_strdup (connection_id));
+ list = g_slist_append (list, g_strdup (server_account_name));
/* Reset the changed list: */
modest_conf_set_list (conf, MODEST_CONF_CONNECTION_SPECIFIC_SMTP_LIST, list,
}
}
- /* TODO: Should we free the items too, or just the list? */
- g_slist_free (list);
+ /* Free the list */
+ if (list) {
+ g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
+ }
return result;
}
*
* Returns: TRUE if it worked, FALSE otherwise
*/
-gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self,
- const gchar* connection_id)
+gboolean
+modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self,
+ const gchar* connection_id)
{
ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
result = FALSE;
}
- /* TODO: Should we free the items too, or just the list? */
- g_slist_free (list);
+ /* Free the list */
+ if (list) {
+ g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
+ }
return result;
}
iter = g_slist_next (iter);
}
- /*
- if (!result) {
- printf (" debug: no server found for connection_id=%s.\n", connection_id);
+ /* Free the list */
+ if (list) {
+ g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
}
- */
-
- /* TODO: Should we free the items too, or just the list? */
- g_slist_free (list);
return result;
}
TRUE /* server account */);
if (password && strlen (password)) {
result = TRUE;
- }
+ /* Clean password */
+ bzero (password, strlen (password));
+ }
+
g_free (password);
return result;
}
static gchar*
util_increment_name (const gchar* text)
{
+ g_return_val_if_fail (text, NULL);
+
/* Get the end character,
* also doing a UTF-8 validation which is required for using g_utf8_prev_char().
*/
break;
}
- p = g_utf8_prev_char (p);
+ p = g_utf8_find_prev_char (text, p);
}
if(!alpha_end) {