From 0cc59dbd32b1423cb2b9246dfdc964c35d47d1e8 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 9 Dec 2009 04:25:17 +0000 Subject: added a menu item to request disposition notification. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2375 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 40 +++++++++++++++++++++++++++++++++++++++- src/compose.h | 2 ++ 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compose.c b/src/compose.c index 2b509cf7..09a3f9b6 100644 --- a/src/compose.c +++ b/src/compose.c @@ -488,6 +488,10 @@ static void compose_customize_toolbar_cb(gpointer data, guint action, GtkWidget *widget); +static void compose_toggle_mdn_cb (gpointer data, + guint action, + GtkWidget *widget); + #if USE_GPGME static void compose_toggle_sign_cb (gpointer data, guint action, @@ -701,6 +705,9 @@ static GtkItemFactoryEntry compose_entries[] = {N_("/_Tools/---"), NULL, NULL, 0, ""}, {N_("/_Tools/Edit with e_xternal editor"), "X", compose_ext_editor_cb, 0, NULL}, + {N_("/_Tools/---"), NULL, NULL, 0, ""}, + {N_("/_Tools/Request _disposition notification"), NULL, compose_toggle_mdn_cb , 0, ""}, + #if USE_GPGME {N_("/_Tools/---"), NULL, NULL, 0, ""}, {N_("/_Tools/PGP Si_gn"), NULL, compose_toggle_sign_cb , 0, ""}, @@ -1194,6 +1201,13 @@ void compose_reedit(MsgInfo *msginfo) compose_connect_changed_callbacks(compose); compose_set_title(compose); + if (compose->use_mdn) { + GtkItemFactory *ifactory; + + ifactory = gtk_item_factory_from_widget(compose->menubar); + menu_set_active(ifactory, "/Tools/Request disposition notification", TRUE); + } + if (prefs_common.enable_autosave && prefs_common.autosave_itv > 0) compose->autosave_tag = g_timeout_add(prefs_common.autosave_itv * 60 * 1000, @@ -1562,6 +1576,7 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo) {"X-Sylpheed-Forward:", NULL, FALSE}, {"REP:", NULL, FALSE}, {"FWD:", NULL, FALSE}, + {"Disposition-Notification-To:", NULL, FALSE}, {NULL, NULL, FALSE}}; enum @@ -1569,7 +1584,8 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo) H_X_SYLPHEED_REPLY = 0, H_X_SYLPHEED_FORWARD = 1, H_REP = 2, - H_FWD = 3 + H_FWD = 3, + H_MDN = 4 }; gchar *file; @@ -1598,6 +1614,8 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo) } else if ((hnum == H_X_SYLPHEED_FORWARD || hnum == H_FWD) && !compose->forward_targets) { compose->forward_targets = g_strdup(str); + } else if (hnum == H_MDN) { + compose->use_mdn = TRUE; } } @@ -4516,6 +4534,13 @@ static gint compose_write_headers(Compose *compose, FILE *fp, } } + /* Disposition-Notification-To */ + if (compose->use_mdn && + !IS_IN_CUSTOM_HEADER("Disposition-Notification-To")) { + fprintf(fp, "Disposition-Notification-To: %s\n", + compose->account->address); + } + /* Organization */ if (compose->account->organization && !IS_IN_CUSTOM_HEADER("Organization")) { @@ -5340,6 +5365,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) compose->out_encoding = C_AUTO; + compose->use_mdn = FALSE; + #if USE_GPGME compose->use_signing = FALSE; compose->use_encryption = FALSE; @@ -7512,6 +7539,17 @@ static void compose_customize_toolbar_cb(gpointer data, guint action, toolbar_customize(widget, data); } +static void compose_toggle_mdn_cb(gpointer data, guint action, + GtkWidget *widget) +{ + Compose *compose = (Compose *)data; + + if (GTK_CHECK_MENU_ITEM(widget)->active) + compose->use_mdn = TRUE; + else + compose->use_mdn = FALSE; +} + #if USE_GPGME static void compose_toggle_sign_cb(gpointer data, guint action, GtkWidget *widget) diff --git a/src/compose.h b/src/compose.h index c81b31a0..10b4900b 100644 --- a/src/compose.h +++ b/src/compose.h @@ -170,6 +170,8 @@ struct _Compose CharSet out_encoding; + gboolean use_mdn; + /* privacy settings */ gboolean use_signing; gboolean use_encryption; -- cgit v1.2.3