sync with 0.8.3cvs6
[claws.git] / src / account.c
index 54a75f8366f1e065c6a7a1eec182d801d9e907b4..ab54d7c54bfcb33b04957fb8023efbc17b35d822 100644 (file)
@@ -116,7 +116,7 @@ void account_read_config_all(void)
        gchar buf[PREFSBUFSIZE];
        PrefsAccount *ac_prefs;
 
-       debug_print(_("Reading all config for each account...\n"));
+       debug_print("Reading all config for each account...\n");
 
        rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ACCOUNT_RC, NULL);
        if ((fp = fopen(rcpath, "rb")) == NULL) {
@@ -131,7 +131,7 @@ void account_read_config_all(void)
                        strretchomp(buf);
                        memmove(buf, buf + 1, strlen(buf));
                        buf[strlen(buf) - 1] = '\0';
-                       debug_print(_("Found label: %s\n"), buf);
+                       debug_print("Found label: %s\n", buf);
                        ac_label_list = g_slist_append(ac_label_list,
                                                       g_strdup(buf));
                }
@@ -141,7 +141,7 @@ void account_read_config_all(void)
        /* read config data from file */
        cur_account = NULL;
        for (cur = ac_label_list; cur != NULL; cur = cur->next) {
-               ac_prefs = g_new0(PrefsAccount, 1);
+               ac_prefs = prefs_account_new();
                prefs_account_read_config(ac_prefs, (gchar *)cur->data);
                account_list = g_list_append(account_list, ac_prefs);
                if (ac_prefs->is_default)
@@ -227,6 +227,33 @@ PrefsAccount *account_find_from_id(gint id)
        return NULL;
 }
 
+/*
+ * account_find_all_from_address:
+ * @ac_list: initial list of accounts. NULL to create a new one.
+ * Accounts found in the @address will be appended to this list.
+ * @address: Email address string.
+ *
+ * Find all the mail (not news) accounts within the specified address.
+ *
+ * Return value: the original accounts list with the found accounts appended.
+ */
+GList *account_find_all_from_address(GList *ac_list, const gchar *address)
+{
+       GList *cur;
+       PrefsAccount *ac;
+
+       if (address == NULL)
+               return ac_list;
+
+       for (cur = account_list; cur != NULL; cur = cur->next) {
+               ac = (PrefsAccount *)cur->data;
+               if (ac->protocol != A_NNTP && ac->address &&
+                   strcasestr(address, ac->address) != NULL)
+                       ac_list = g_list_append(ac_list, ac);
+       }
+       return ac_list;
+}
+       
 void account_set_menu(void)
 {
        main_window_set_account_menu(account_list);
@@ -257,7 +284,7 @@ void account_edit_open(void)
                return;
        }
 
-       debug_print(_("Opening account edit window...\n"));
+       debug_print("Opening account edit window...\n");
 
        if (!edit_account.window)
                account_edit_create();
@@ -454,7 +481,7 @@ static void account_edit_create(void)
        GtkWidget *hbbox;
        GtkWidget *close_btn;
 
-       debug_print(_("Creating account edit window...\n"));
+       debug_print("Creating account edit window...\n");
 
        window = gtk_window_new (GTK_WINDOW_DIALOG);
        gtk_widget_set_usize (window, 500, 320);
@@ -618,7 +645,7 @@ static void account_edit_prefs(void)
            ac_prefs->folder && strcmp2(ac_name, ac_prefs->account_name) != 0) {
                folder_set_name(FOLDER(ac_prefs->folder),
                                ac_prefs->account_name);
-               folderview_rescan_all();
+               folderview_set_all();
        }
 
        account_clist_set();
@@ -663,12 +690,12 @@ static void account_delete(void)
        ac_prefs = gtk_clist_get_row_data(clist, row);
        if (ac_prefs->folder) {
                folder_destroy(FOLDER(ac_prefs->folder));
-               folderview_rescan_all();
+               folderview_set_all();
        }
        account_destroy(ac_prefs);
        account_clist_set();
 
-       debug_print(_("Removing deleted account references for all the folders...\n"));
+       debug_print("Removing deleted account references for all the folders...\n");
        list = folder_get_list();
        for (; list != NULL; list = list->next) {
                folder = FOLDER(list->data);