/* 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)
prefs_account_save_config_all(account_list);
}
+/*
+ * 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;
+}
+
PrefsAccount *account_find_from_smtp_server(const gchar *address,
const gchar *smtp_server)
{
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)
+PrefsAccount *account_find_from_item(FolderItem *item)
{
- 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);
+ g_return_val_if_fail(item != NULL, NULL);
+
+ ac = item->account;
+ if (!ac) {
+ FolderItem *cur_item = item->parent;
+ while (cur_item != NULL) {
+ if (cur_item->account && cur_item->apply_sub) {
+ ac = cur_item->account;
+ break;
+ }
+ cur_item = cur_item->parent;
+ }
}
- return ac_list;
+ if (!ac)
+ ac = item->folder->account;
+
+ return ac;
}
-
+
void account_set_menu(void)
{
main_window_set_account_menu(account_list);
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();
item->prefs->enable_default_account = FALSE;
item->prefs->default_account = 0;
prefs_folder_item_save_config(item);
+
+ return FALSE;
}
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();