aboutsummaryrefslogtreecommitdiff
path: root/libsylph/account.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-20 08:05:18 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-20 08:05:18 +0000
commit8945c06437dca9a40882ccd7a768c63c47a70366 (patch)
tree0176f83aca430bbcfc834518bb591ca475e6ab39 /libsylph/account.c
parent83023f81b011ac5957c7f7077feedba5e22dfb54 (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/account.c')
-rw-r--r--libsylph/account.c31
1 files changed, 31 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;
+ }
}