diff options
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index 9e639ee2a5..a6b47e92ad 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -2420,6 +2420,64 @@ mail_config_get_default_transport (void) return NULL; } +void +mail_config_uri_renamed(GCompareFunc uri_cmp, const char *old, const char *new) +{ + MailConfigAccount *ac; + const GSList *l; + int work = 0; + + l = mail_config_get_accounts(); + while (l) { + ac = l->data; + if (ac->sent_folder_uri && uri_cmp(ac->sent_folder_uri, old)) { + g_free(ac->sent_folder_uri); + ac->sent_folder_uri = g_strdup(new); + work = 1; + } + if (ac->drafts_folder_uri && uri_cmp(ac->drafts_folder_uri, old)) { + g_free(ac->drafts_folder_uri); + ac->drafts_folder_uri = g_strdup(new); + work = 1; + } + l = l->next; + } + + /* nasty ... */ + if (work) + mail_config_write(); +} + +void +mail_config_uri_deleted(GCompareFunc uri_cmp, const char *uri) +{ + MailConfigAccount *ac; + const GSList *l; + int work = 0; + /* assumes these can't be removed ... */ + extern char *default_sent_folder_uri, *default_drafts_folder_uri; + + l = mail_config_get_accounts(); + while (l) { + ac = l->data; + if (ac->sent_folder_uri && uri_cmp(ac->sent_folder_uri, uri)) { + g_free(ac->sent_folder_uri); + ac->sent_folder_uri = g_strdup(default_sent_folder_uri); + work = 1; + } + if (ac->drafts_folder_uri && uri_cmp(ac->drafts_folder_uri, uri)) { + g_free(ac->drafts_folder_uri); + ac->drafts_folder_uri = g_strdup(default_drafts_folder_uri); + work = 1; + } + l = l->next; + } + + /* nasty again */ + if (work) + mail_config_write(); +} + GSList * mail_config_get_sources (void) { |