aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.ja7
-rw-r--r--libsylph/account.c31
-rw-r--r--libsylph/account.h4
-rw-r--r--src/account_dialog.c1
-rw-r--r--src/folderview.c2
-rw-r--r--src/summaryview.c5
7 files changed, 56 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 32923f08..83c19fbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2005-12-20
+ * libsylph/account.[ch]: account_address_exist(): new.
+ src/account_dialog.c
+ src/summaryview.c: look for all accounts when the option "Display
+ recipient on `From' column if sender is yourself" is enabled.
+ src/folderview.c: write account config file immediately when an
+ account is removed.
+
+2005-12-20
+
* src/summaryview.c: summary_set_row(): fixed a memory leak.
2005-12-20
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 1ef6c44d..6fb8134b 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,12 @@
2005-12-20
+ * libsylph/account.[ch]: account_address_exist(): 新規。
+ src/account_dialog.c
+ src/summaryview.c: 「差出人が自分の場合は `差出人' カラムに宛先を
+ 表示する」オプションが有効の場合は全アカウントを調べるようにした。
+
+2005-12-20
+
* src/summaryview.c: summary_set_row(): メモリリークを修正。
2005-12-20
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__ */
diff --git a/src/account_dialog.c b/src/account_dialog.c
index c93ff11e..5826ed4e 100644
--- a/src/account_dialog.c
+++ b/src/account_dialog.c
@@ -224,6 +224,7 @@ void account_open(PrefsAccount *ac_prefs)
account_write_config_all();
account_set_menu();
main_window_reflect_prefs_all();
+ account_updated();
}
void account_set_missing_folder(void)
diff --git a/src/folderview.c b/src/folderview.c
index 52184244..8dca27ae 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -2440,6 +2440,7 @@ static void folderview_rm_imap_server_cb(FolderView *folderview, guint action,
account = item->folder->account;
folder_destroy(item->folder);
account_destroy(account);
+ account_write_config_all();
sel_path = gtk_tree_row_reference_get_path(folderview->selected);
if (sel_path) {
@@ -2631,6 +2632,7 @@ static void folderview_rm_news_server_cb(FolderView *folderview, guint action,
account = item->folder->account;
folder_destroy(item->folder);
account_destroy(account);
+ account_write_config_all();
sel_path = gtk_tree_row_reference_get_path(folderview->selected);
if (sel_path) {
diff --git a/src/summaryview.c b/src/summaryview.c
index f30bc735..bf10d2a7 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1881,13 +1881,12 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
date_s = msginfo->date;
else
date_s = _("(No Date)");
- if (prefs_common.swap_from && msginfo->from && msginfo->to &&
- cur_account && cur_account->address) {
+ if (prefs_common.swap_from && msginfo->from && msginfo->to) {
gchar *from;
Xstrdup_a(from, msginfo->from, return);
extract_address(from);
- if (!strcmp(from, cur_account->address))
+ if (account_address_exist(from))
sw_from_s = g_strconcat("-->", msginfo->to, NULL);
}