[evolution/email-factory-3-4: 41/47] commit 987fb91d5ec4b61d1283acdb9cf02960cc47b74d Author: Matthew Barnes <mbarnes redhat com> Date:



commit 027bee0419accb42d0aefe947bfd83bf126fcffe
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Tue Jan 3 12:53:46 2012 +0530

    commit 987fb91d5ec4b61d1283acdb9cf02960cc47b74d
    Author: Matthew Barnes <mbarnes redhat com>
    Date:   Mon Dec 19 22:27:39 2011 -0500
    
        Reduce diff noise with account-mgmt branch.

 libemail-engine/e-mail-session.c |   17 +++++++++++++----
 libemail-engine/e-mail-utils.c   |   33 +++++++++++++++++----------------
 libemail-engine/mail-ops.c       |    4 ++--
 3 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 9df4695..10aedf2 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -1104,6 +1104,8 @@ mail_session_forward_to (CamelSession *session,
 	CamelFolder *out_folder;
 	CamelMessageInfo *info;
 	CamelMedium *medium;
+	const gchar *from_address;
+	const gchar *from_name;	
 	const gchar *header_name;
 	struct _camel_header_raw *xev;
 	gchar *subject;
@@ -1129,6 +1131,9 @@ mail_session_forward_to (CamelSession *session,
 		return FALSE;
 	}
 
+	from_address = account->id->address;
+	from_name = account->id->name;
+
 	forward = camel_mime_message_new ();
 
 	/* make copy of the message, because we are going to modify it */
@@ -1171,8 +1176,7 @@ mail_session_forward_to (CamelSession *session,
 
 	/* from */
 	addr = camel_internet_address_new ();
-	camel_internet_address_add (
-		addr, account->id->name, account->id->address);
+	camel_internet_address_add (addr, from_name, from_address);
 	camel_mime_message_set_from (forward, addr);
 	g_object_unref (addr);
 
@@ -1487,10 +1491,15 @@ static void
 e_mail_session_init (EMailSession *session)
 {
 	GSettings *settings;
+	GHashTable *junk_filters;
+
+	junk_filters = g_hash_table_new (
+		(GHashFunc) g_str_hash,
+		(GEqualFunc) g_str_equal);
 
 	session->priv = E_MAIL_SESSION_GET_PRIVATE (session);
-	session->priv->junk_filters = g_hash_table_new (
-		(GHashFunc) g_str_hash, (GEqualFunc) g_str_equal);
+	session->priv->junk_filters = junk_filters;
+
 	session->priv->proxy = e_proxy_new ();
 
 	session->priv->local_folders =
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index 5e935ec..88345e1 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -468,13 +468,17 @@ search_address_in_addressbooks (const gchar *address,
 		EBookClient *book_client = NULL;
 		GHook *hook_stop;
 		gboolean cached_book = FALSE;
+		const gchar *display_name;
+		const gchar *uid;
 		GError *err = NULL;
 
+		uid = e_source_peek_uid (source);
+		display_name = e_source_peek_name (source);
+
 		/* failed to load this book last time, skip it now */
-		if (g_hash_table_lookup (emu_broken_books_hash,
-				e_source_peek_uid (source)) != NULL) {
+		if (g_hash_table_lookup (emu_broken_books_hash, uid) != NULL) {
 			d(printf ("%s: skipping broken book '%s'\n",
-				G_STRFUNC, e_source_peek_name (source)));
+				G_STRFUNC, display_name));
 			continue;
 		}
 
@@ -482,7 +486,7 @@ search_address_in_addressbooks (const gchar *address,
 
 		hook_stop = mail_cancel_hook_add (emu_addr_cancel_stop, &stop);
 
-		book_client = g_hash_table_lookup (emu_books_hash, e_source_peek_uid (source));
+		book_client = g_hash_table_lookup (emu_books_hash, uid);
 		if (!book_client) {
 			book_client = e_book_client_new (source, &err);
 
@@ -493,8 +497,7 @@ search_address_in_addressbooks (const gchar *address,
 				} else if (err) {
 					gchar *source_uid;
 
-					source_uid = g_strdup (
-						e_source_peek_uid (source));
+					source_uid = g_strdup (uid);
 
 					g_hash_table_insert (
 						emu_broken_books_hash,
@@ -503,7 +506,7 @@ search_address_in_addressbooks (const gchar *address,
 					g_warning (
 						"%s: Unable to create addressbook '%s': %s",
 						G_STRFUNC,
-						e_source_peek_name (source),
+						display_name,
 						err->message);
 				}
 				g_clear_error (&err);
@@ -517,8 +520,7 @@ search_address_in_addressbooks (const gchar *address,
 				} else if (err) {
 					gchar *source_uid;
 
-					source_uid = g_strdup (
-						e_source_peek_uid (source));
+					source_uid = g_strdup (uid);
 
 					g_hash_table_insert (
 						emu_broken_books_hash,
@@ -527,7 +529,7 @@ search_address_in_addressbooks (const gchar *address,
 					g_warning (
 						"%s: Unable to open addressbook '%s': %s",
 						G_STRFUNC,
-						e_source_peek_name (source),
+						display_name,
 						err->message);
 				}
 				g_clear_error (&err);
@@ -563,13 +565,14 @@ search_address_in_addressbooks (const gchar *address,
 			    (g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
 			     g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)));
 			if (err && !stop) {
-				gchar *source_uid = g_strdup (e_source_peek_uid (source));
+				gchar *source_uid = g_strdup (uid);
 
 				g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid);
 
 				g_warning (
 					"%s: Can't get contacts from '%s': %s",
-					G_STRFUNC, e_source_peek_name (source),
+					G_STRFUNC,
+					display_name,
 					err->message);
 			}
 			g_clear_error (&err);
@@ -581,16 +584,14 @@ search_address_in_addressbooks (const gchar *address,
 			g_object_unref (book_client);
 		} else if (!stop && book_client && !cached_book) {
 			g_hash_table_insert (
-				emu_books_hash, g_strdup (
-				e_source_peek_uid (source)), book_client);
+				emu_books_hash, g_strdup (uid), book_client);
 		}
 	}
 
 	mail_cancel_hook_remove (hook_cancellable);
 	g_object_unref (cancellable);
 
-	g_slist_foreach (addr_sources, (GFunc) g_object_unref, NULL);
-	g_slist_free (addr_sources);
+	g_slist_free_full (addr_sources, (GDestroyNotify) g_object_unref);
 
 	g_free (query);
 
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index d97165d..7d4e8ba 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -223,7 +223,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
 		E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_LOCAL_INBOX);
 
 	if (fm->destination == NULL)
-		goto fail;
+		goto exit;
 	g_object_ref (fm->destination);
 
 	url = camel_service_new_camel_url (service);
@@ -333,7 +333,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
 		fm->source_folder = NULL;
 	}
 
-fail:
+exit:
 	/* we unref this here as it may have more work to do (syncing
 	 * folders and whatnot) before we are really done */
 	/* should this be cancellable too? (i.e. above unregister above) */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]