diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-12-20 08:05:18 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-12-20 08:05:18 +0000 |
commit | 8945c06437dca9a40882ccd7a768c63c47a70366 (patch) | |
tree | 0176f83aca430bbcfc834518bb591ca475e6ab39 /libsylph | |
parent | 83023f81b011ac5957c7f7077feedba5e22dfb54 (diff) |
look for all accounts when enable_swap_from is enabled.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@845 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/account.c | 31 | ||||
-rw-r--r-- | libsylph/account.h | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/libsylph/account.c b/libsylph/account.c index 794a3003..f9997ced 100644 --- a/libsylph/account.c +++ b/libsylph/account.c @@ -42,6 +42,8 @@ PrefsAccount *cur_account; static GList *account_list = NULL; +GHashTable *address_table; + void account_read_config_all(void) { @@ -244,6 +246,24 @@ PrefsAccount *account_find_from_msginfo(MsgInfo *msginfo) return ac; } +gboolean account_address_exist(const gchar *address) +{ + if (!address_table) { + GList *cur; + + address_table = g_hash_table_new(g_str_hash, g_str_equal); + for (cur = account_list; cur != NULL; cur = cur->next) { + PrefsAccount *ac = (PrefsAccount *)cur->data; + + if (ac->address) + g_hash_table_insert(address_table, ac->address, + GINT_TO_POINTER(1)); + } + } + + return (gboolean)g_hash_table_lookup(address_table, address); +} + void account_foreach(AccountFunc func, gpointer user_data) { GList *cur; @@ -267,6 +287,7 @@ void account_list_free(void) void account_append(PrefsAccount *ac_prefs) { account_list = g_list_append(account_list, ac_prefs); + account_updated(); } void account_set_as_default(PrefsAccount *ac_prefs) @@ -422,4 +443,14 @@ void account_destroy(PrefsAccount *ac_prefs) cur_account = ac_prefs; } } + + account_updated(); +} + +void account_updated(void) +{ + if (address_table) { + g_hash_table_destroy(address_table); + address_table = NULL; + } } diff --git a/libsylph/account.h b/libsylph/account.h index d21cfaee..395f07a7 100644 --- a/libsylph/account.h +++ b/libsylph/account.h @@ -43,6 +43,8 @@ PrefsAccount *account_find_from_item (FolderItem *item); PrefsAccount *account_find_from_message_file (const gchar *file); PrefsAccount *account_find_from_msginfo (MsgInfo *msginfo); +gboolean account_address_exist (const gchar *address); + void account_foreach (AccountFunc func, gpointer user_data); GList *account_get_list (void); @@ -58,4 +60,6 @@ FolderItem *account_get_special_folder(PrefsAccount *ac_prefs, void account_destroy (PrefsAccount *ac_prefs); +void account_updated (void); + #endif /* __ACCOUNT_H__ */ |