aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-composer-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-31 09:54:16 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-31 09:54:16 +0800
commitb9acd9446511a8989a752e114e32a3494cbdc9ef (patch)
tree50c4cdd085e9919f7bb7df53a5ddc2e388a4c3aa /mail/em-composer-utils.c
parent6709cd6e5879adf9505bf25306b34932ceb6b5a6 (diff)
downloadgsoc2013-evolution-b9acd9446511a8989a752e114e32a3494cbdc9ef.tar.gz
gsoc2013-evolution-b9acd9446511a8989a752e114e32a3494cbdc9ef.tar.zst
gsoc2013-evolution-b9acd9446511a8989a752e114e32a3494cbdc9ef.zip
Require a CamelMimeMessage in em_utils_handle_receipt().
Eliminates one of the two remaining calls to mail_get_messagex().
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r--mail/em-composer-utils.c73
1 files changed, 38 insertions, 35 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 91480a38eb..6aebe52dc7 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1607,61 +1607,44 @@ em_utils_redirect_message_by_uid (EShell *shell,
g_object_ref (shell), mail_msg_unordered_push);
}
-static void
-emu_handle_receipt_message (CamelFolder *folder,
- const gchar *uid,
- CamelMimeMessage *msg,
- gpointer data,
- GError **error)
-{
- EMailSession *session = E_MAIL_SESSION (data);
-
- if (msg)
- em_utils_handle_receipt (session, folder, uid, msg);
-
- /* we dont care really if we can't get the message */
- g_clear_error (error);
-}
-
/* Message disposition notifications, rfc 2298 */
void
em_utils_handle_receipt (EMailSession *session,
CamelFolder *folder,
- const gchar *uid,
- CamelMimeMessage *msg)
+ const gchar *message_uid,
+ CamelMimeMessage *message)
{
EAccount *account;
const gchar *addr;
CamelMessageInfo *info;
- info = camel_folder_get_message_info (folder, uid);
- if (info == NULL)
- return;
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
- if (camel_message_info_user_flag(info, "receipt-handled")) {
- camel_folder_free_message_info (folder, info);
+ info = camel_folder_get_message_info (folder, message_uid);
+ if (info == NULL)
return;
- }
- if (msg == NULL) {
- mail_get_messagex (
- folder, uid, emu_handle_receipt_message,
- session, mail_msg_unordered_push);
+ if (camel_message_info_user_flag (info, "receipt-handled")) {
camel_folder_free_message_info (folder, info);
return;
}
- if ((addr = camel_medium_get_header((CamelMedium *)msg, "Disposition-Notification-To")) == NULL) {
+ addr = camel_medium_get_header (
+ CAMEL_MEDIUM (message), "Disposition-Notification-To");
+ if (addr == NULL) {
camel_folder_free_message_info (folder, info);
return;
}
- camel_message_info_set_user_flag(info, "receipt-handled", TRUE);
+ camel_message_info_set_user_flag (info, "receipt-handled", TRUE);
camel_folder_free_message_info (folder, info);
- account = em_utils_guess_account_with_recipients (msg, folder);
+ account = em_utils_guess_account_with_recipients (message, folder);
- /* TODO: should probably decode/format the address, it could be in rfc2047 format */
+ /* TODO Should probably decode/format the address,
+ * since it could be in rfc2047 format. */
if (addr == NULL) {
addr = "";
} else {
@@ -1669,9 +1652,29 @@ em_utils_handle_receipt (EMailSession *session,
addr++;
}
- if (account && (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS || account->receipt_policy == E_ACCOUNT_RECEIPT_ASK)
- && e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES)
- em_utils_send_receipt (session, folder, msg);
+ if (account == NULL)
+ return;
+
+ if (account->receipt_policy == E_ACCOUNT_RECEIPT_NEVER)
+ return;
+
+ if (account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) {
+ GtkWindow *window;
+ const gchar *subject;
+ gint response;
+
+ /* FIXME Parent window should be passed in. */
+ window = e_shell_get_active_window (NULL);
+ subject = camel_mime_message_get_subject (message);
+
+ response = e_alert_run_dialog_for_args (
+ window, "mail:ask-receipt", addr, subject, NULL);
+
+ if (response != GTK_RESPONSE_YES)
+ return;
+ }
+
+ em_utils_send_receipt (session, folder, message);
}
static void