Re: [evolution-patches] Patch for the receipt bounty (#127534)
- From: ERDI Gergo <cactus cactus rulez org>
- To: Jeffrey Stedfast <fejj ximian com>
- Cc: Not Zed <notzed ximian com>, evolution-patches lists ximian com
- Subject: Re: [evolution-patches] Patch for the receipt bounty (#127534)
- Date: Mon, 16 Aug 2004 14:17:44 +0200 (CEST)
On Thu, 12 Aug 2004, ERDI Gergo wrote:
So here's a new version with all the discussed improvements and decisions. I
also modified the code to use a userflag instead of a dedicated
RECEIPT_HANDLED bitfield.
and by now I've also modified the account editor to include a combo box
for the setting.
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus cactus rulez org =---'
The smallest handcuff in the world is a wedding ring.
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.657
diff -u -u -r1.657 ChangeLog
--- composer/ChangeLog 13 Aug 2004 16:27:16 -0000 1.657
+++ composer/ChangeLog 16 Aug 2004 12:10:48 -0000
@@ -1,3 +1,8 @@
+2004-08-16 ERDI Gergo <cactus cactus rulez org>
+
+ * e-msg-composer.c (build_message): Create an MDN header if a
+ receipt is requested by the user
+
2004-08-13 Radek Doulik <rodo ximian com>
* e-msg-composer.c (e_msg_composer_show_sig_file): set paragraph
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.479
diff -u -u -r1.479 e-msg-composer.c
--- composer/e-msg-composer.c 13 Aug 2004 16:27:16 -0000 1.479
+++ composer/e-msg-composer.c 16 Aug 2004 12:10:58 -0000
@@ -437,6 +437,15 @@
composer->extra_hdr_names->pdata[i],
composer->extra_hdr_values->pdata[i]);
}
+
+ /* Message Disposition Notification */
+ if (composer->request_receipt) {
+ char *mdn_address = hdrs->account->id->reply_to;
+ if (!mdn_address || !*mdn_address)
+ mdn_address = hdrs->account->id->address;
+
+ camel_medium_add_header (CAMEL_MEDIUM (new), "Disposition-Notification-To", mdn_address);
+ }
if (composer->mime_body) {
plain_encoding = CAMEL_TRANSFER_ENCODING_7BIT;
@@ -499,7 +508,7 @@
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "save-data-on", &ev);
}
- data = get_text (composer->persist_stream_interface, "text/html");
+ data = get_text (composer->persist_stream_interface, "text/html");
if (save_html_object_data) {
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "save-data-off", &ev);
CORBA_exception_free (&ev);
@@ -1910,6 +1919,19 @@
}
static void
+menu_insert_receipt_cb (BonoboUIComponent *component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ gpointer user_data)
+{
+ if (type != Bonobo_UIComponent_STATE_CHANGED)
+ return;
+
+ e_msg_composer_set_request_receipt (E_MSG_COMPOSER (user_data), atoi (state));
+}
+
+static void
menu_changed_charset_cb (BonoboUIComponent *component,
const char *path,
Bonobo_UIComponent_EventType type,
@@ -2206,6 +2228,14 @@
bonobo_ui_component_add_listener (
composer->uic, "ViewBCC",
menu_view_bcc_cb, composer);
+
+ /* Insert/Request Receipt */
+ bonobo_ui_component_set_prop (
+ composer->uic, "/commands/RequestReceipt",
+ "state", composer->request_receipt ? "1" : "0", NULL);
+ bonobo_ui_component_add_listener (
+ composer->uic, "RequestReceipt",
+ menu_insert_receipt_cb, composer);
/* Security -> PGP Sign */
bonobo_ui_component_set_prop (
@@ -5129,6 +5159,7 @@
}
+
/**
* e_msg_composer_get_view_bcc:
* @composer: A message composer widget
@@ -5177,6 +5208,47 @@
e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (composer->hdrs),
e_msg_composer_get_visible_flags (composer));
}
+
+
+
+/**
+ * e_msg_composer_get_request_receipt
+ * @composer: A message composer widget
+ *
+ * Get the status of the "Request receipt" flag.
+ *
+ * Return value: The status of the "Request receipt" flag.
+ **/
+gboolean
+e_msg_composer_get_request_receipt (EMsgComposer *composer)
+{
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->request_receipt;
+}
+
+
+/**
+ * e_msg_composer_set_request_receipt:
+ * @composer: A message composer widget
+ * @state: whether to request or not a receipt
+ *
+ * If set, a message delivery notification request will be sent to the recipient
+ */
+void
+e_msg_composer_set_request_receipt (EMsgComposer *composer, gboolean request_receipt)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ if ((composer->request_receipt && request_receipt) ||
+ (!composer->request_receipt && !request_receipt))
+ return;
+
+ composer->request_receipt = request_receipt;
+ bonobo_ui_component_set_prop (composer->uic, "/commands/RequestReceipt",
+ "state", composer->request_receipt ? "1" : "0", NULL);
+}
+
EDestination **
Index: composer/e-msg-composer.h
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
retrieving revision 1.91
diff -u -u -r1.91 e-msg-composer.h
--- composer/e-msg-composer.h 27 Jul 2004 16:52:17 -0000 1.91
+++ composer/e-msg-composer.h 16 Aug 2004 12:10:59 -0000
@@ -101,6 +101,7 @@
guint32 view_bcc : 1;
guint32 view_cc : 1;
guint32 view_subject : 1;
+ guint32 request_receipt : 1;
guint32 has_changed : 1;
guint32 autosaved : 1;
@@ -191,6 +192,10 @@
gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer);
void e_msg_composer_set_view_bcc (EMsgComposer *composer,
gboolean view_bcc);
+
+gboolean e_msg_composer_get_request_receipt (EMsgComposer *composer);
+void e_msg_composer_set_request_receipt (EMsgComposer *composer,
+ gboolean request_receipt);
EDestination **e_msg_composer_get_recipients (EMsgComposer *composer);
EDestination **e_msg_composer_get_to (EMsgComposer *composer);
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.479
diff -u -u -r1.479 ChangeLog
--- e-util/ChangeLog 13 Aug 2004 16:44:28 -0000 1.479
+++ e-util/ChangeLog 16 Aug 2004 12:11:01 -0000
@@ -24,6 +24,10 @@
* e-icon-factory.c (icon_foreach_remove): We must return TRUE here
so that things actually get removed from the list
+2004-08-07 ERDI Gergo <cactus cactus rulez org>
+
+ * e-account.h: Added new receipt_policy field to services
+
2004-08-05 Rodrigo Moya <rodrigo novell com>
* e-icon-factory.c (e_icon_factory_init): connect to "changed"
Index: e-util/e-account.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.c,v
retrieving revision 1.10
diff -u -u -r1.10 e-account.c
--- e-util/e-account.c 9 Apr 2004 19:47:06 -0000 1.10
+++ e-util/e-account.c 16 Aug 2004 12:11:03 -0000
@@ -244,6 +244,56 @@
}
}
+static EAccountReceiptPolicy
+str_to_receipt_policy (const char *str)
+{
+ if (!strcmp (str, "ask"))
+ return E_ACCOUNT_RECEIPT_ASK;
+ if (!strcmp (str, "always"))
+ return E_ACCOUNT_RECEIPT_ALWAYS;
+
+ return E_ACCOUNT_RECEIPT_NEVER;
+}
+
+static char*
+receipt_policy_to_str (EAccountReceiptPolicy val)
+{
+ char *ret = 0;
+
+ switch (val) {
+ case E_ACCOUNT_RECEIPT_NEVER:
+ ret = "never";
+ break;
+ case E_ACCOUNT_RECEIPT_ASK:
+ ret = "ask";
+ break;
+ case E_ACCOUNT_RECEIPT_ALWAYS:
+ ret = "always";
+ break;
+ }
+
+ return ret;
+}
+
+static gboolean
+xml_set_receipt_policy (xmlNodePtr node, const char *name, EAccountReceiptPolicy *val)
+{
+ EAccountReceiptPolicy new_val;
+ char *buf;
+
+ if ((buf = xmlGetProp (node, name))) {
+ new_val = str_to_receipt_policy (buf);
+ xmlFree (buf);
+
+ if (new_val != *val) {
+ *val = new_val;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
static gboolean
xml_set_content (xmlNodePtr node, char **val)
{
@@ -314,6 +364,7 @@
changed |= xml_set_bool (node, "auto-check", &service->auto_check);
changed |= xml_set_int (node, "auto-check-timeout", &service->auto_check_time);
+ changed |= xml_set_receipt_policy (node, "receipt-policy", &service->receipt_policy);
if (service->auto_check && service->auto_check_time <= 0) {
service->auto_check = FALSE;
service->auto_check_time = 0;
@@ -447,6 +498,7 @@
dest->source->auto_check = src->source->auto_check;
dest->source->auto_check_time = src->source->auto_check_time;
dest->source->save_passwd = src->source->save_passwd;
+ dest->source->receipt_policy = src->source->receipt_policy;
g_free (dest->transport->url);
dest->transport->url = g_strdup (src->transport->url);
@@ -527,7 +579,7 @@
xmlSetProp (src, "keep-on-server", account->source->keep_on_server ? "true" : "false");
xmlSetProp (src, "auto-check", account->source->auto_check ? "true" : "false");
sprintf (buf, "%d", account->source->auto_check_time);
- xmlSetProp (src, "auto-check-timeout", buf);
+ xmlSetProp (src, "receipt-policy", receipt_policy_to_str (account->source->receipt_policy));
if (account->source->url)
xmlNewTextChild (src, NULL, "url", account->source->url);
@@ -655,6 +707,7 @@
{ /* E_ACCOUNT_SOURCE_AUTO_CHECK */ 1<<EAP_LOCK_AUTOCHECK },
{ /* E_ACCOUNT_SOURCE_AUTO_CHECK_TIME */ 1<<EAP_LOCK_AUTOCHECK },
{ /* E_ACCOUNT_SOURCE_SAVE_PASSWD */ 1<<EAP_LOCK_SAVE_PASSWD },
+ { /* E_ACCOUNT_SROUCE_RECEIPT_POLICY */ },
{ /* E_ACCOUNT_TRANSPORT_URL */ 1<<EAP_LOCK_TRANSPORT },
{ /* E_ACCOUNT_TRANSPORT_SAVE_PASSWD */ 1<<EAP_LOCK_SAVE_PASSWD },
Index: e-util/e-account.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.h,v
retrieving revision 1.7
diff -u -u -r1.7 e-account.h
--- e-util/e-account.h 1 Apr 2004 19:48:43 -0000 1.7
+++ e-util/e-account.h 16 Aug 2004 12:11:03 -0000
@@ -40,6 +40,7 @@
E_ACCOUNT_SOURCE_AUTO_CHECK,
E_ACCOUNT_SOURCE_AUTO_CHECK_TIME,
E_ACCOUNT_SOURCE_SAVE_PASSWD,
+ E_ACCOUNT_SOURCE_RECEIPT_POLICY,
E_ACCOUNT_TRANSPORT_URL,
E_ACCOUNT_TRANSPORT_SAVE_PASSWD,
@@ -80,12 +81,19 @@
char *sig_uid;
} EAccountIdentity;
+typedef enum _EAccountReceiptPolicy {
+ E_ACCOUNT_RECEIPT_NEVER,
+ E_ACCOUNT_RECEIPT_ASK,
+ E_ACCOUNT_RECEIPT_ALWAYS
+} EAccountReceiptPolicy;
+
typedef struct _EAccountService {
char *url;
gboolean keep_on_server;
gboolean auto_check;
int auto_check_time;
gboolean save_passwd;
+ EAccountReceiptPolicy receipt_policy;
} EAccountService;
typedef struct _EAccount {
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3434
diff -u -u -r1.3434 ChangeLog
--- mail/ChangeLog 16 Aug 2004 03:31:21 -0000 1.3434
+++ mail/ChangeLog 16 Aug 2004 12:11:22 -0000
@@ -1,3 +1,12 @@
+2004-08-16 ERDI Gergo <cactus cactus rulez org>
+
+ * mail-errors.xml: Added new dialog for receipt requests
+
+ * em-composer-utils.c (em_utils_guess_account): Made guess_account
+ public, to be callable from em-folder-view
+ (em_utils_send_receipt): New function to send an RFC
+ 2298-compliant message delivery notification
+
2004-08-13 Not Zed <NotZed Ximian com>
* em-utils.c (em_utils_message_to_html): don't include the
Index: mail/em-composer-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.c,v
retrieving revision 1.21
diff -u -u -r1.21 em-composer-utils.c
--- mail/em-composer-utils.c 4 Aug 2004 15:20:57 -0000 1.21
+++ mail/em-composer-utils.c 16 Aug 2004 12:11:27 -0000
@@ -27,6 +27,9 @@
#include <string.h>
#include <gtk/gtkdialog.h>
+#include <netdb.h> /* define MAXHOSTNAMELEN on Solaris */
+#include <sys/param.h> /* define MAXHOSTNAMELEN elsewhere */
+
#include <gal/util/e-util.h>
#include "mail-mt.h"
@@ -48,8 +51,9 @@
#include "e-util/e-account-list.h"
#include <camel/camel-string-utils.h>
+#include <camel/camel-stream-mem.h>
-static EAccount *guess_account (CamelMimeMessage *message, CamelFolder *folder);
+static EAccount * guess_account (CamelMimeMessage *message, CamelFolder *folder);
struct emcs_t {
unsigned int ref_count;
@@ -187,6 +191,7 @@
if (emcs && emcs->folder) {
/* set any replied flags etc */
camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set);
+ camel_folder_set_message_user_flag (emcs->folder, emcs->uid, "receipt-handled", TRUE);
camel_object_unref (emcs->folder);
emcs->folder = NULL;
g_free (emcs->uid);
@@ -1101,6 +1106,159 @@
g_return_if_fail (uid != NULL);
mail_get_message (folder, uid, redirect_msg, NULL, mail_thread_new);
+}
+
+
+static gboolean
+em_utils_ask_receipt (CamelFolder *folder, CamelMimeMessage *message)
+{
+ /* Check the account's receipt policy settings, and pop up a
+ * dialog if the policy is ASK */
+
+ EAccount *account = guess_account (message, folder);
+
+ if (account->source->receipt_policy == E_ACCOUNT_RECEIPT_ASK) {
+ const char *receipt_address = camel_medium_get_header (CAMEL_MEDIUM (message), "Disposition-Notification-To");
+ const char *subject = camel_mime_message_get_subject (message);
+
+ return (e_error_run (NULL, "mail:ask-receipt", receipt_address, subject) == GTK_RESPONSE_YES);
+ }
+
+ return (account->source->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS);
+}
+
+void
+em_utils_handle_receipt (CamelFolder *folder, const char *uid)
+{
+ CamelMimeMessage *message = camel_folder_get_message (folder, uid, NULL);
+
+ g_return_if_fail (message);
+
+ if (camel_folder_get_message_user_flag (folder, uid, "receipt-handled"))
+ return;
+#if 0
+ camel_folder_set_message_user_flag (folder, uid, "receipt-handled", TRUE);
+#endif
+
+ if (!camel_medium_get_header (CAMEL_MEDIUM (message), "Disposition-Notification-To"))
+ return;
+
+ if (em_utils_ask_receipt (folder, message))
+ em_utils_send_receipt (folder, message);
+}
+
+static void
+em_utils_receipt_done_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info,
+ int queued, const char *appended_uid, void *data)
+{
+ camel_message_info_free (info);
+}
+
+void
+em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
+{
+ EAccount *account = guess_account (message, folder);
+
+ CamelMimeMessage *receipt = camel_mime_message_new ();
+ CamelMultipart *body = camel_multipart_new ();
+ CamelMimePart *part;
+ CamelDataWrapper *receipt_text, *receipt_data;
+ CamelContentType *type;
+ CamelInternetAddress *addr;
+ CamelStream *stream;
+ CamelFolder *out_folder;
+ CamelMessageInfo *info;
+ const char *message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-ID");
+ const char *message_date = camel_medium_get_header (CAMEL_MEDIUM (message), "Date");
+ const char *message_subject = camel_mime_message_get_subject (message);
+ const char *receipt_address = camel_medium_get_header (CAMEL_MEDIUM (message), "Disposition-Notification-To");
+ char hostname[MAXHOSTNAMELEN + 1];
+ char *self_address, *receipt_subject;
+
+ if (!receipt_address)
+ return;
+
+ /* Collect information for the receipt */
+ if (!gethostname (hostname, MAXHOSTNAMELEN) || !hostname[0])
+ strncpy (hostname, "localhost.localdomain", MAXHOSTNAMELEN);
+ self_address = account->id->address;
+ if (!message_id)
+ message_id = "";
+ if (!message_date)
+ message_date ="";
+
+ /* Create toplevel container */
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (body),
+ "multipart/report;"
+ "report-type=\"disposition-notification\"");
+ camel_multipart_set_boundary (body, NULL);
+
+ /* Create textual receipt */
+ receipt_text = camel_data_wrapper_new ();
+ type = camel_content_type_new ("text", "plain");
+ camel_data_wrapper_set_mime_type_field (receipt_text, type);
+ camel_content_type_unref (type);
+ stream = camel_stream_mem_new ();
+ camel_stream_printf (stream,
+ "Your message to %s about \"%s\" "
+ "(dated %s) has been read by the user.",
+ self_address, message_subject, message_date);
+ camel_data_wrapper_construct_from_stream (receipt_text, stream);
+ camel_object_unref (stream);
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part), receipt_text);
+ camel_object_unref (receipt_text);
+ camel_multipart_add_part (body, part);
+ camel_object_unref (part);
+
+ /* Create the machine-readable receipt */
+ receipt_data = camel_data_wrapper_new ();
+ type = camel_content_type_new ("message", "disposition-notification");
+ camel_data_wrapper_set_mime_type_field (receipt_data, type);
+ camel_content_type_unref (type);
+ stream = camel_stream_mem_new ();
+ camel_stream_printf (stream,
+ "Reporting-UA: %s; %s\n"
+ "Final-Recipient: rfc822; %s\n"
+ "Original-Message-ID:%s\n"
+ "Disposition: manual-action/MDN-sent-manually; displayed",
+ hostname, "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT,
+ self_address, message_id);
+ camel_data_wrapper_construct_from_stream (receipt_data, stream);
+ camel_object_unref (stream);
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part), receipt_data);
+ camel_object_unref (receipt_data);
+ camel_multipart_add_part (body, part);
+ camel_object_unref (part);
+
+ /* Finish creating the message */
+ camel_medium_set_content_object (CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body));
+ camel_object_unref (body);
+
+ receipt_subject = g_strdup_printf ("Delivery Notification for: \"%s\"", message_subject);
+ camel_mime_message_set_subject (receipt, receipt_subject);
+ g_free (receipt_subject);
+
+ addr = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (addr), self_address);
+ camel_mime_message_set_recipients (receipt, CAMEL_RECIPIENT_TYPE_TO, addr);
+ camel_object_unref (addr);
+
+ addr = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (addr), receipt_address);
+ camel_mime_message_set_from (receipt, addr);
+ camel_object_unref (addr);
+
+ camel_medium_set_header (CAMEL_MEDIUM (receipt), "Return-Path", "<>");
+
+ /* Send the receipt */
+ out_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ info = camel_message_info_new ();
+ info->flags = CAMEL_MESSAGE_SEEN;
+ mail_append_mail (out_folder, receipt, info, em_utils_receipt_done_cb, 0);
}
/* Replying to messages... */
Index: mail/em-composer-utils.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.h,v
retrieving revision 1.7
diff -u -u -r1.7 em-composer-utils.h
--- mail/em-composer-utils.h 28 Jul 2004 14:38:50 -0000 1.7
+++ mail/em-composer-utils.h 16 Aug 2004 12:11:27 -0000
@@ -34,6 +34,7 @@
struct _CamelMimeMessage;
struct _EMsgComposer;
struct _EMFormat;
+struct _EAccount;
void em_composer_utils_setup_callbacks (struct _EMsgComposer *composer, struct _CamelFolder *folder, const char *uid,
guint32 flags, guint32 set, struct _CamelFolder *drafts, const char *drafts_uid);
@@ -62,6 +63,9 @@
void em_utils_redirect_message (struct _CamelMimeMessage *message);
void em_utils_redirect_message_by_uid (struct _CamelFolder *folder, const char *uid);
+
+void em_utils_handle_receipt (struct _CamelFolder *folder, const char *uid);
+void em_utils_send_receipt (struct _CamelFolder *folder, struct _CamelMimeMessage *message);
enum {
REPLY_MODE_SENDER,
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.85
diff -u -u -r1.85 em-folder-view.c
--- mail/em-folder-view.c 28 Jul 2004 14:38:50 -0000 1.85
+++ mail/em-folder-view.c 16 Aug 2004 12:11:32 -0000
@@ -29,6 +29,9 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <netdb.h> /* define MAXHOSTNAMELEN on Solaris */
+#include <sys/param.h> /* define MAXHOSTNAMELEN elsewhere */
+
#include <gtk/gtkvbox.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkvpaned.h>
@@ -63,6 +66,7 @@
#include <bonobo/bonobo-ui-util.h>
#include "widgets/misc/e-charset-picker.h"
+#include "widgets/misc/e-error.h"
#include <e-util/e-dialog-utils.h>
#include <e-util/e-icon-factory.h>
@@ -120,6 +124,8 @@
static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv);
static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri);
+static void emfv_set_seen (EMFolderView *emfv, const char *uid);
+
static const EMFolderViewEnable emfv_enable_map[];
struct _EMFolderViewPrivate {
@@ -381,6 +387,8 @@
em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri);
em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[i], FALSE);
gtk_widget_show(emmb->window);
+
+ em_utils_handle_receipt (emfv->folder, uids->pdata[i]);
}
message_list_free_uids(emfv->list, uids);
@@ -1933,7 +1941,7 @@
MessageList *list = emfv->list;
if (mst->uid && list->cursor_uid && !strcmp (mst->uid, list->cursor_uid))
- camel_folder_set_message_flags (emfv->folder, mst->uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ emfv_set_seen (emfv, mst->uid);
return FALSE;
}
@@ -1949,7 +1957,7 @@
emfv_enable_menus(emfv);
return;
}
-
+
em_format_format((EMFormat *)emfv->preview, folder, uid, msg);
if (emfv->priv->seen_id)
@@ -1966,7 +1974,7 @@
emfv->priv->seen_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, emfv->mark_seen_timeout,
(GSourceFunc)do_mark_seen, mst, (GDestroyNotify)mst_free);
} else {
- camel_folder_set_message_flags(emfv->folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ emfv_set_seen (emfv, uid);
}
}
@@ -2190,6 +2198,19 @@
{
g_object_ref(emfv);
mail_async_event_emit(emfv->async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfv_gui_folder_changed, folder, NULL, emfv);
+}
+
+static void
+emfv_set_seen(EMFolderView *emfv, const char *uid)
+{
+ guint32 old_flags = camel_folder_get_message_flags(emfv->folder, uid);
+
+ /* If we're setting the SEEN flag on a message, handle receipt
+ * requests */
+ if (!(old_flags & CAMEL_MESSAGE_SEEN))
+ em_utils_handle_receipt(emfv->folder, uid);
+
+ camel_folder_set_message_flags(emfv->folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
}
/* keep these two tables in sync */
Index: mail/mail-account-gui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v
retrieving revision 1.171
diff -u -u -r1.171 mail-account-gui.c
--- mail/mail-account-gui.c 18 Jun 2004 04:43:59 -0000 1.171
+++ mail/mail-account-gui.c 16 Aug 2004 12:11:38 -0000
@@ -939,7 +939,7 @@
mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
{
CamelURL *url;
- GtkWidget *mailcheck_frame, *mailcheck_hbox;
+ GtkWidget *mailcheck_frame, *mailcheck_hbox, *receipt_frame;
GtkWidget *hostname_label, *username_label, *path_label;
GtkWidget *hostname, *username, *path;
GtkTable *main_table, *cur_table;
@@ -966,17 +966,19 @@
path = glade_xml_get_widget (gui->xml, "source_path");
/* Remove the contents of the extra_table except for the
- * mailcheck_frame.
+ * mailcheck_frame and the receipt_frame.
*/
main_table = (GtkTable *) glade_xml_get_widget (gui->xml, "extra_table");
gtk_container_set_border_width ((GtkContainer *) main_table, 12);
gtk_table_set_row_spacings (main_table, 6);
gtk_table_set_col_spacings (main_table, 8);
mailcheck_frame = glade_xml_get_widget (gui->xml, "extra_mailcheck_frame");
+ receipt_frame = glade_xml_get_widget (gui->xml, "extra_receipt_frame");
child = gtk_container_get_children (GTK_CONTAINER (main_table));
while (child != NULL) {
next = child->next;
- if (child->data != (gpointer) mailcheck_frame)
+ if (child->data != (gpointer) mailcheck_frame &&
+ child->data != (gpointer) receipt_frame)
gtk_container_remove (GTK_CONTAINER (main_table), child->data);
g_list_free_1 (child);
child = next;
@@ -1817,6 +1819,7 @@
G_CALLBACK (service_check_supported), &gui->source);
gui->source_auto_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check"));
gui->source_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check_min"));
+ gui->extra_receipt_omenu = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "extra_receipt_omenu"));
/* Transport */
gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT;
@@ -2121,6 +2124,8 @@
g_free (transport_proto);
}
+ gtk_option_menu_set_history (gui->extra_receipt_omenu, gui->account->source->receipt_policy);
+
/* FIXME: drive by table?? */
if (!e_account_writable (gui->account, E_ACCOUNT_SOURCE_URL)) {
gtk_widget_set_sensitive (gui->source.container, FALSE);
@@ -2169,6 +2174,7 @@
"/apps/evolution/mail/signatures", NULL));
gtk_widget_set_sensitive((GtkWidget *)gui->source_auto_check, e_account_writable(gui->account, E_ACCOUNT_SOURCE_AUTO_CHECK));
gtk_widget_set_sensitive((GtkWidget *)gui->source_auto_check_min, e_account_writable(gui->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME));
+ gtk_widget_set_sensitive((GtkWidget *)gui->extra_receipt_omenu, e_account_writable(gui->account, E_ACCOUNT_SOURCE_RECEIPT_POLICY));
}
static void
@@ -2312,6 +2318,8 @@
new->source->auto_check = gtk_toggle_button_get_active (gui->source_auto_check);
if (new->source->auto_check)
new->source->auto_check_time = gtk_spin_button_get_value_as_int (gui->source_auto_check_min);
+
+ new->source->receipt_policy = gtk_option_menu_get_history (gui->extra_receipt_omenu);
/* transport */
if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider)) {
Index: mail/mail-account-gui.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.h,v
retrieving revision 1.31
diff -u -u -r1.31 mail-account-gui.h
--- mail/mail-account-gui.h 1 Apr 2004 19:47:06 -0000 1.31
+++ mail/mail-account-gui.h 16 Aug 2004 12:11:38 -0000
@@ -82,6 +82,7 @@
/* extra incoming config */
GHashTable *extra_config;
+ struct _GtkOptionMenu *extra_receipt_omenu;
/* outgoing mail */
MailAccountGuiService transport;
Index: mail/mail-config.glade
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.glade,v
retrieving revision 1.148
diff -u -u -r1.148 mail-config.glade
--- mail/mail-config.glade 12 Aug 2004 20:40:11 -0000 1.148
+++ mail/mail-config.glade 16 Aug 2004 12:12:00 -0000
@@ -1701,7 +1701,7 @@
<child>
<widget class="GtkTable" id="extra_table">
<property name="visible">True</property>
- <property name="n_rows">1</property>
+ <property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">18</property>
@@ -1711,148 +1711,101 @@
<widget class="GtkVBox" id="extra_mailcheck_frame">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="lblMailCheck">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Checking for New Mail</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
<child>
<widget class="GtkTable" id="extra_mailcheck_table">
+ <property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">1</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
<child>
- <widget class="GtkTable" id="extra_table">
+ <widget class="GtkHBox" id="extra_mailcheck_hbox">
<property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">0</property>
+ <property name="spacing">4</property>
<child>
- <widget class="GtkVBox" id="extra_mailcheck_frame">
+ <widget class="GtkCheckButton" id="extra_auto_check">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Automatically check for _new mail every</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="lblMailCheck">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><span weight="bold">Checking for New Mail</span></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkSpinButton" id="extra_auto_check_min">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">10 1 1440 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkTable" id="extra_mailcheck_table">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="extra_mailcheck_hbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkCheckButton" id="extra_auto_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Automatically check for _new mail every</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkSpinButton" id="extra_auto_check_min">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">True</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">10 1 1440 1 10 10</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblMinutes">
- <property name="visible">True</property>
- <property name="label" translatable="yes">minutes</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="lblMinutes">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minutes</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
@@ -1866,8 +1819,8 @@
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
@@ -1876,6 +1829,119 @@
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="extra_receipt_frame">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label576">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Message Receipts</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox229">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label577">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Send Message Receipts:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="extra_receipt_omenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+
+ <child>
+ <widget class="GtkMenu" id="menu1">
+
+ <child>
+ <widget class="GtkMenuItem" id="never1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Never</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="ask_each_time1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Ask each time</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="always1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Always</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
</packing>
</child>
</widget>
Index: mail/mail-errors.xml
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-errors.xml,v
retrieving revision 1.4
diff -u -u -r1.4 mail-errors.xml
--- mail/mail-errors.xml 29 Jul 2004 06:47:31 -0000 1.4
+++ mail/mail-errors.xml 16 Aug 2004 12:12:01 -0000
@@ -315,5 +315,13 @@
<primary>Could not connect to {0}. Groupwise account setup is incomplete. You may need to setup the account again</primary>
</error>
+ <error id="ask-receipt" type="question" default="GTK_RESPONSE_NO">
+ <primary>Receipt requested</primary>
+ <secondary>Send message receipt to {0} about message "{1}"?</secondary>
+ <button stock="gtk-no" response="GTK_RESPONSE_NO"/>
+ <button stock="gtk-yes" response="GTK_RESPONSE_YES"/>
+ </error>
+
</error-list>
Index: ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.398
diff -u -u -r1.398 ChangeLog
--- ui/ChangeLog 23 Jun 2004 03:59:03 -0000 1.398
+++ ui/ChangeLog 16 Aug 2004 12:12:04 -0000
@@ -1,3 +1,8 @@
+2004-08-16 ERDI Gergo <cactus cactus rulez org>
+
+ * evolution-message-composer.xml: Added new menu item for
+ requesting message receipts when composing a new message
+
2004-06-22 V Ravi Kumar Raju <vravikr yahoo co uk>
* evolution-addressbook.xml: Remove the Menu Seperator in View
Index: ui/evolution-message-composer.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution-message-composer.xml,v
retrieving revision 1.43
diff -u -u -r1.43 evolution-message-composer.xml
--- ui/evolution-message-composer.xml 25 May 2004 20:54:01 -0000 1.43
+++ ui/evolution-message-composer.xml 16 Aug 2004 12:12:04 -0000
@@ -31,6 +31,10 @@
pixtype="stock" pixname="gtk-delete"
_tip="Delete all but signature"/>
+ <cmd name="RequestReceipt" _label="Request Receipt"
+ _tip="Check to get delivery notification when your message is read"
+ type="toggle" state="0"/>
+
<cmd name="FormatHtml" _label="HT_ML" _tip="Send the mail in HTML format"
type="toggle" state="0"/>
@@ -132,6 +136,8 @@
<menuitem name="FileAttach" verb=""
_label="_Attachment..." pixtype="pixbuf"/>
<placeholder name="Component"/>
+ <separator f="" name="emailcomposer"/>
+ <menuitem name="RequestReceipt" verb=""/>
</submenu>
<submenu name="Security" _label="_Security">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]