aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog23
-rw-r--r--mail/mail-account-gui.c19
-rw-r--r--mail/mail-account-gui.h6
-rw-r--r--mail/mail-callbacks.c48
-rw-r--r--mail/mail-config.c80
-rw-r--r--mail/mail-config.glade145
-rw-r--r--mail/mail-config.h39
7 files changed, 315 insertions, 45 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 39d1ea7918..fbef455982 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,28 @@
2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-callbacks.c (composer_get_message): Add the auto-cc/bcc
+ recipients here. The problem with setting them in the composer is
+ that what if the user changes which account he wants to use? We'd
+ either have to clear the cc/bcc lists *or* we'd have to leave them
+ alone. Either way is bad. We can't just clear the entries because
+ the user may have added addresses since the composer was
+ opened. We don't want to leave any old auto-cc/bcc addresses there
+ because that isn't desirable either. So we give up and add them
+ here after the user has already hit the send button.
+
+ * mail-config.c (account_copy): Update to copy the always-[b]cc
+ options.
+ (account_destroy): Update to destroy the above options.
+ (config_read): Update to read in those values.
+ (mail_config_write): Save those options.
+
+ * mail-account-gui.c (mail_account_gui_new): Setup Always Cc/Bcc
+ widgets.
+ (mail_account_gui_save): Get the user-entered values for the
+ always-cc/bcc stuff.
+
+2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
+
* mail-account-gui.c (setup_service): If the provider is NULL,
don't do anything.
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 856d72984f..8672d4e0d9 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -1347,6 +1347,18 @@ mail_account_gui_new (MailConfigAccount *account)
}
set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name);
+ /* Always Cc */
+ gui->always_cc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_cc"));
+ gtk_toggle_button_set_active (gui->always_cc, account->always_cc);
+ gui->cc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "cc_addrs"));
+ e_utf8_gtk_entry_set_text (gui->cc_addrs, account->cc_addrs);
+
+ /* Always Bcc */
+ gui->always_bcc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_bcc"));
+ gtk_toggle_button_set_active (gui->always_bcc, account->always_bcc);
+ gui->bcc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "bcc_addrs"));
+ e_utf8_gtk_entry_set_text (gui->bcc_addrs, account->bcc_addrs);
+
/* Security */
gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key"));
if (account->pgp_key)
@@ -1633,7 +1645,7 @@ mail_account_gui_save (MailAccountGui *gui)
const MailConfigAccount *old_account;
CamelProvider *provider = NULL;
CamelURL *source_url = NULL, *url;
- gchar *new_name;
+ char *new_name;
gboolean old_enabled;
if (!mail_account_gui_identity_complete (gui, NULL) ||
@@ -1728,6 +1740,11 @@ mail_account_gui_save (MailAccountGui *gui)
if (source_url)
camel_url_free (source_url);
+ account->always_cc = gtk_toggle_button_get_active (gui->always_cc);
+ account->cc_addrs = e_utf8_gtk_entry_get_text (gui->cc_addrs);
+ account->always_bcc = gtk_toggle_button_get_active (gui->always_bcc);
+ account->bcc_addrs = e_utf8_gtk_entry_get_text (gui->bcc_addrs);
+
g_free (account->pgp_key);
account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key);
account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self);
diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h
index 23ee016198..190d983a83 100644
--- a/mail/mail-account-gui.h
+++ b/mail/mail-account-gui.h
@@ -95,6 +95,12 @@ typedef struct {
GtkButton *sent_folder_button;
MailAccountGuiFolder sent_folder;
+ /* always cc/bcc */
+ GtkToggleButton *always_cc;
+ GtkEntry *cc_addrs;
+ GtkToggleButton *always_bcc;
+ GtkEntry *bcc_addrs;
+
/* Security */
GtkEntry *pgp_key;
GtkToggleButton *pgp_encrypt_to_self;
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 3f1baa452f..1c6a40609f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -452,12 +452,45 @@ composer_get_message (EMsgComposer *composer)
if (message == NULL)
return NULL;
+ /* Add info about the sending account */
+ account = e_msg_composer_get_preferred_account (composer);
+ if (account) {
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
+
+ /* add the always-cc/bcc addresses */
+ if (account->always_cc && account->cc_addrs) {
+ CamelInternetAddress *addrs;
+
+ addrs = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (addrs), account->cc_addrs);
+ iaddr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+ if (iaddr)
+ camel_address_cat (CAMEL_ADDRESS (addrs), CAMEL_ADDRESS (iaddr));
+ camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_CC, addrs);
+ camel_object_unref (CAMEL_OBJECT (addrs));
+ }
+
+ if (account->always_bcc && account->bcc_addrs) {
+ CamelInternetAddress *addrs;
+
+ addrs = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (addrs), account->bcc_addrs);
+ iaddr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC);
+ if (iaddr)
+ camel_address_cat (CAMEL_ADDRESS (addrs), CAMEL_ADDRESS (iaddr));
+ camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_BCC, addrs);
+ camel_object_unref (CAMEL_OBJECT (addrs));
+ }
+ }
+
recipients = e_msg_composer_get_recipients (composer);
/* Check for invalid recipients */
if (recipients) {
gboolean have_invalid = FALSE;
- gchar *msg, *new_msg;
+ char *msg, *new_msg;
GtkWidget *message_box;
for (i = 0; recipients[i] && !have_invalid; ++i) {
@@ -524,7 +557,7 @@ composer_get_message (EMsgComposer *composer)
so that it can present the user with a dialog whose text has been
modified to reflect this situation. */
- const gchar *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
+ const char *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
gboolean hidden_list_case = FALSE;
if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;"))
@@ -569,14 +602,6 @@ composer_get_message (EMsgComposer *composer)
}
}
- /* Add info about the sending account */
- account = e_msg_composer_get_preferred_account (composer);
- if (account) {
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
- }
-
/* Get the message recipients and 'touch' them, boosting their use scores */
recipients = e_msg_composer_get_recipients (composer);
e_destination_touchv (recipients);
@@ -618,7 +643,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
send->composer = composer;
gtk_object_ref (GTK_OBJECT (composer));
gtk_widget_hide (GTK_WIDGET (composer));
- e_msg_composer_set_enable_autosave(composer, FALSE);
+ e_msg_composer_set_enable_autosave (composer, FALSE);
mail_send_mail (transport->url, message, composer_sent_cb, send);
}
@@ -639,6 +664,7 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
message = composer_get_message (composer);
if (message == NULL)
return;
+
info = camel_message_info_new ();
info->flags = CAMEL_MESSAGE_SEEN;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index a21af27d17..4151c0c3a7 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -76,7 +76,7 @@ typedef struct {
gboolean show_preview;
gboolean thread_list;
gboolean hide_deleted;
- gint paned_size;
+ int paned_size;
gboolean send_html;
gboolean confirm_unwanted_html;
gboolean citation_highlight;
@@ -85,11 +85,11 @@ typedef struct {
gboolean prompt_only_bcc;
gboolean confirm_expunge;
gboolean do_seen_timeout;
- gint seen_timeout;
+ int seen_timeout;
gboolean empty_trash_on_exit;
GSList *accounts;
- gint default_account;
+ int default_account;
GSList *news;
@@ -117,7 +117,7 @@ static MailConfig *config = NULL;
/* Prototypes */
static void config_read (void);
-static void mail_config_set_default_account_num (gint new_default);
+static void mail_config_set_default_account_num (int new_default);
/* Identity */
@@ -210,6 +210,11 @@ account_copy (const MailConfigAccount *account)
new->sent_folder_name = g_strdup (account->sent_folder_name);
new->sent_folder_uri = g_strdup (account->sent_folder_uri);
+ new->always_cc = account->always_cc;
+ new->cc_addrs = g_strdup (account->cc_addrs);
+ new->always_bcc = account->always_bcc;
+ new->bcc_addrs = g_strdup (account->bcc_addrs);
+
new->pgp_key = g_strdup (account->pgp_key);
new->pgp_encrypt_to_self = account->pgp_encrypt_to_self;
new->pgp_always_sign = account->pgp_always_sign;
@@ -238,6 +243,9 @@ account_destroy (MailConfigAccount *account)
g_free (account->sent_folder_name);
g_free (account->sent_folder_uri);
+ g_free (account->cc_addrs);
+ g_free (account->bcc_addrs);
+
g_free (account->pgp_key);
g_free (account->smime_key);
@@ -362,6 +370,32 @@ config_read (void)
else
g_free (val);
+ path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
+ account->always_cc = bonobo_config_get_boolean_with_default (
+ config->db, path, FALSE, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
+ g_free (path);
+ if (val && *val)
+ account->cc_addrs = val;
+ else
+ g_free (val);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
+ account->always_bcc = bonobo_config_get_boolean_with_default (
+ config->db, path, FALSE, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ val = bonobo_config_get_string (config->db, path, NULL);
+ g_free (path);
+ if (val && *val)
+ account->bcc_addrs = val;
+ else
+ g_free (val);
+
/* get the pgp info */
path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
@@ -500,7 +534,7 @@ config_read (void)
"/News/Sources/num", 0, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- gchar *path, *r;
+ char *path, *r;
path = g_strdup_printf ("/News/Sources/url_%d", i);
@@ -679,6 +713,24 @@ mail_config_write (void)
account->sent_folder_uri, NULL);
g_free (path);
+ path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
+ bonobo_config_set_boolean (config->db, path, account->always_cc, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path,
+ account->cc_addrs, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
+ bonobo_config_set_boolean (config->db, path, account->always_bcc, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path,
+ account->bcc_addrs, NULL);
+ g_free (path);
+
/* account pgp options */
path = g_strdup_printf ("/Mail/Accounts/account_pgp_key_%d", i);
bonobo_config_set_string_wrapper (config->db, path, account->pgp_key, NULL);
@@ -773,7 +825,7 @@ mail_config_write (void)
bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- gchar *path;
+ char *path;
n = g_slist_nth_data (config->news, i);
@@ -1149,14 +1201,14 @@ mail_config_set_hide_deleted (gboolean value)
config->hide_deleted = value;
}
-gint
+int
mail_config_get_paned_size (void)
{
return config->paned_size;
}
void
-mail_config_set_paned_size (gint value)
+mail_config_set_paned_size (int value)
{
config->paned_size = value;
}
@@ -1221,14 +1273,14 @@ mail_config_set_do_seen_timeout (gboolean do_seen_timeout)
config->do_seen_timeout = do_seen_timeout;
}
-gint
+int
mail_config_get_mark_as_seen_timeout (void)
{
return config->seen_timeout;
}
void
-mail_config_set_mark_as_seen_timeout (gint timeout)
+mail_config_set_mark_as_seen_timeout (int timeout)
{
config->seen_timeout = timeout;
}
@@ -1876,8 +1928,8 @@ new_source_created (MailConfigAccount *account)
CamelProvider *prov;
CamelFolder *inbox;
CamelException ex;
- gchar *name;
- gchar *url;
+ char *name;
+ char *url;
/* no source, don't bother. */
if (!account->source || !account->source->url)
@@ -2015,14 +2067,14 @@ mail_config_remove_account (MailConfigAccount *account)
return config->accounts;
}
-gint
+int
mail_config_get_default_account_num (void)
{
return config->default_account;
}
static void
-mail_config_set_default_account_num (gint new_default)
+mail_config_set_default_account_num (int new_default)
{
config->default_account = new_default;
}
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 2aa4748e51..1991576d0a 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -1847,13 +1847,154 @@ Kerberos
</widget>
</widget>
</widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame2</name>
+ <label>Composing Messages</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox67</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox61</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table8</name>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>0</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>always_cc</name>
+ <can_focus>True</can_focus>
+ <label>Always carbon-copy to:</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>always_bcc</name>
+ <can_focus>True</can_focus>
+ <label>Always blind carbon-copy to:</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>cc_addrs</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>bcc_addrs</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label35</name>
- <label>Special Folders</label>
+ <label>Defaults</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -3134,7 +3275,7 @@ Quoted
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>True</expand>
+ <expand>False</expand>
<fill>True</fill>
</child>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index c54fef4eba..2575f8b817 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -32,38 +32,43 @@ extern "C" {
#endif /* __cplusplus */
typedef struct {
- gchar *name;
- gchar *address;
- gchar *organization;
- gchar *signature;
- gchar *html_signature;
+ char *name;
+ char *address;
+ char *organization;
+ char *signature;
+ char *html_signature;
gboolean has_html_signature;
} MailConfigIdentity;
typedef struct {
- gchar *url;
+ char *url;
gboolean keep_on_server;
gboolean auto_check;
- gint auto_check_time;
+ int auto_check_time;
gboolean save_passwd;
gboolean enabled;
} MailConfigService;
typedef struct {
- gchar *name;
+ char *name;
MailConfigIdentity *id;
MailConfigService *source;
MailConfigService *transport;
- gchar *drafts_folder_name, *drafts_folder_uri;
- gchar *sent_folder_name, *sent_folder_uri;
+ char *drafts_folder_name, *drafts_folder_uri;
+ char *sent_folder_name, *sent_folder_uri;
- gchar *pgp_key;
+ gboolean always_cc;
+ char *cc_addrs;
+ gboolean always_bcc;
+ char *bcc_addrs;
+
+ char *pgp_key;
gboolean pgp_encrypt_to_self;
gboolean pgp_always_sign;
- gchar *smime_key;
+ char *smime_key;
gboolean smime_encrypt_to_self;
gboolean smime_always_sign;
} MailConfigAccount;
@@ -134,8 +139,8 @@ void mail_config_set_show_preview (const char *uri, gboolean value);
gboolean mail_config_get_hide_deleted (void);
void mail_config_set_hide_deleted (gboolean value);
-gint mail_config_get_paned_size (void);
-void mail_config_set_paned_size (gint size);
+int mail_config_get_paned_size (void);
+void mail_config_set_paned_size (int size);
gboolean mail_config_get_send_html (void);
void mail_config_set_send_html (gboolean send_html);
@@ -152,8 +157,8 @@ void mail_config_set_citation_color (guint32);
gint mail_config_get_do_seen_timeout (void);
void mail_config_set_do_seen_timeout (gboolean do_seen_timeout);
-gint mail_config_get_mark_as_seen_timeout (void);
-void mail_config_set_mark_as_seen_timeout (gint timeout);
+int mail_config_get_mark_as_seen_timeout (void);
+void mail_config_set_mark_as_seen_timeout (int timeout);
gboolean mail_config_get_prompt_empty_subject (void);
void mail_config_set_prompt_empty_subject (gboolean value);
@@ -193,7 +198,7 @@ void mail_config_service_set_save_passwd (MailConfigService *service, gboolean s
gboolean mail_config_find_account (const MailConfigAccount *account);
const MailConfigAccount *mail_config_get_default_account (void);
-gint mail_config_get_default_account_num (void);
+int mail_config_get_default_account_num (void);
const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
const MailConfigAccount *mail_config_get_account_by_source_url (const char *url);
const MailConfigAccount *mail_config_get_account_by_transport_url (const char *url);