aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-09-08 00:31:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-09-08 07:08:54 +0800
commit3da4948c0fc1f2c21b163f0ec456b2d99c881258 (patch)
tree479d6153d31e03cb7a65990683b5271402e5ec29 /libemail-engine
parent2e5031cb4538b4819e5fce5d717668c3445df80a (diff)
downloadgsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.gz
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.bz2
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.lz
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.xz
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.tar.zst
gsoc2013-evolution-3da4948c0fc1f2c21b163f0ec456b2d99c881258.zip
Miscellaneous cleanups.
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-session-utils.c6
-rw-r--r--libemail-engine/e-mail-session.c40
-rw-r--r--libemail-engine/mail-folder-cache.c5
-rw-r--r--libemail-engine/mail-tools.c18
4 files changed, 45 insertions, 24 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 1c9dcbb544..6402e26a65 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -625,6 +625,8 @@ skip_send:
/* Run filters on the outgoing message. */
if (context->driver != NULL) {
+ CamelMessageFlags message_flags;
+
camel_filter_driver_filter_message (
context->driver, context->message, context->info,
NULL, NULL, NULL, "", cancellable, &error);
@@ -640,7 +642,9 @@ skip_send:
g_clear_error (&error);
}
- if ((camel_message_info_flags (context->info) & CAMEL_MESSAGE_DELETED) != 0)
+ message_flags = camel_message_info_flags (context->info);
+
+ if (message_flags & CAMEL_MESSAGE_DELETED)
copy_to_sent = FALSE;
}
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index e8da91544b..58d217d9c2 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -175,10 +175,13 @@ user_message_response_cb (GObject *source,
struct _user_message_msg *m = user_data;
GError *local_error = NULL;
- m->result = e_user_prompter_prompt_finish (E_USER_PROMPTER (source), result, &local_error);
+ m->result = e_user_prompter_prompt_finish (
+ E_USER_PROMPTER (source), result, &local_error);
- if (local_error) {
- g_print ("%s: Failed to prompt user: %s\n", G_STRFUNC, local_error->message);
+ if (local_error != NULL) {
+ g_warning (
+ "%s: Failed to prompt user: %s",
+ G_STRFUNC, local_error->message);
g_clear_error (&local_error);
}
@@ -1412,6 +1415,7 @@ mail_session_trust_prompt (CamelSession *session,
CamelCertTrust response;
gchar *errors_code;
GList *iter;
+ gint button_index;
gint ii;
prompter = e_user_prompter_new ();
@@ -1433,19 +1437,23 @@ mail_session_trust_prompt (CamelSession *session,
g_free (name);
}
- switch (e_user_prompter_extension_prompt_sync (prompter, "ETrustPrompt::trust-prompt", parameters, NULL, cancellable, NULL)) {
- case 0:
- response = CAMEL_CERT_TRUST_NEVER;
- break;
- case 1:
- response = CAMEL_CERT_TRUST_FULLY;
- break;
- case 2:
- response = CAMEL_CERT_TRUST_TEMPORARY;
- break;
- default:
- response = CAMEL_CERT_TRUST_UNKNOWN;
- break;
+ button_index = e_user_prompter_extension_prompt_sync (
+ prompter, "ETrustPrompt::trust-prompt",
+ parameters, NULL, cancellable, NULL);
+
+ switch (button_index) {
+ case 0:
+ response = CAMEL_CERT_TRUST_NEVER;
+ break;
+ case 1:
+ response = CAMEL_CERT_TRUST_FULLY;
+ break;
+ case 2:
+ response = CAMEL_CERT_TRUST_TEMPORARY;
+ break;
+ default:
+ response = CAMEL_CERT_TRUST_UNKNOWN;
+ break;
}
g_free (errors_code);
diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c
index a48a92c61f..edffb9a593 100644
--- a/libemail-engine/mail-folder-cache.c
+++ b/libemail-engine/mail-folder-cache.c
@@ -895,8 +895,9 @@ folder_changed_cb (CamelFolder *folder,
parent_store = camel_folder_get_parent_store (folder);
session = camel_service_ref_session (CAMEL_SERVICE (parent_store));
- if (!last_newmail_per_folder)
- last_newmail_per_folder = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if (last_newmail_per_folder == NULL)
+ last_newmail_per_folder = g_hash_table_new (
+ g_direct_hash, g_direct_equal);
/* it's fine to hash them by folder pointer here */
latest_received = GPOINTER_TO_INT (
diff --git a/libemail-engine/mail-tools.c b/libemail-engine/mail-tools.c
index 00cd653509..5961de67f6 100644
--- a/libemail-engine/mail-tools.c
+++ b/libemail-engine/mail-tools.c
@@ -192,14 +192,22 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
struct _camel_header_raw *
mail_tool_remove_xevolution_headers (CamelMimeMessage *message)
{
+ struct _camel_header_raw *headers;
struct _camel_header_raw *scan, *list = NULL;
- for (scan = ((CamelMimePart *) message)->headers; scan; scan = scan->next)
- if (!strncmp (scan->name, "X-Evolution", 11))
- camel_header_raw_append (&list, scan->name, scan->value, scan->offset);
+ headers = CAMEL_MIME_PART (message)->headers;
- for (scan = list; scan; scan = scan->next)
- camel_medium_remove_header ((CamelMedium *) message, scan->name);
+ for (scan = headers; scan != NULL; scan = scan->next) {
+ if (strncmp (scan->name, "X-Evolution", 11) == 0)
+ camel_header_raw_append (
+ &list, scan->name,
+ scan->value, scan->offset);
+ }
+
+ for (scan = list; scan; scan = scan->next) {
+ camel_medium_remove_header (
+ CAMEL_MEDIUM (message), scan->name);
+ }
return list;
}