Re: Patch: pop3_get_message works without setting an exception



El jue, 21-02-2008 a las 15:38 +0100, Philip Van Hoof escribió:
> I don't see a patch attached.
> 
> 
> On Thu, 2008-02-21 at 15:34 +0100, Jose Dapena Paz wrote:
> > 	Hi,
> > 
> > 	This is for making pop3_get_message work better if no exception has
> > been set.
> > 
> > Changelog entry:
> > * libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c:
> >   (pop3_get_message). Now it works even if no exception parameter is 
> >   passed.

	Sorry, usual "forgot to attach".

	Hope this time...

> 
-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3426)
+++ ChangeLog	(working copy)
@@ -13,6 +13,9 @@
 	Added a missing else that could cause freeing some summary info entries
 	when they shouldn't
 
+	* libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c:
+	(pop3_get_message). Now it works even if no exception parameter is passed.
+
 2008-02-20  Philip Van Hoof <pvanhoof gnome org>
 
 	* Improvement for cancel's their reconnection
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(revision 3426)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(working copy)
@@ -927,9 +927,15 @@
 	CamelMessageInfoBase *mi; gboolean im_certain=FALSE;
 	gint retry = 0;
 	gboolean had_attachment = FALSE;
+	gboolean free_ex = FALSE;
 
+	if (!ex) {
+		free_ex = TRUE;
+		ex = camel_exception_new ();
+	}		
+
 	if (!uid)
-		return;
+		goto do_free_ex;
 
 	pop3_debug ("%s requested\n", uid);
 
@@ -951,14 +957,14 @@
 
 		camel_object_unref (CAMEL_OBJECT (stream));
 
-		return message;
+		goto do_free_ex;
 	}
 
 
 	if (camel_disco_store_status (CAMEL_DISCO_STORE (pop3_store)) == CAMEL_DISCO_STORE_OFFLINE) {
 		camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_UID_NOT_AVAILABLE,
 			     _("This message is not currently available"));
-		return NULL;
+		goto do_free_ex;
 	}
 
 	g_static_rec_mutex_lock (pop3_store->uidl_lock);
@@ -1027,7 +1033,7 @@
 			  uid);
 
 			g_static_rec_mutex_unlock (pop3_store->uidl_lock);
-			return NULL;
+			goto do_free_ex;
 		}
 	}
 
@@ -1040,7 +1046,7 @@
 		  "Message with UID %s is not currently available", uid);
 
 		g_static_rec_mutex_unlock (pop3_store->uidl_lock);
-		return NULL;
+		goto do_free_ex;
 	}
 
    while (retry < 2)
@@ -1053,7 +1059,7 @@
 		if (camel_exception_is_set (ex)) {
 			g_static_rec_mutex_unlock (pop3_store->eng_lock);
 			g_static_rec_mutex_unlock (pop3_store->uidl_lock);
-			return NULL;
+			goto do_free_ex;
 		}
 	}
 	g_static_rec_mutex_unlock (pop3_store->eng_lock);
@@ -1133,7 +1139,7 @@
 		if (pop3_store->cache == NULL
 		    || (stream = camel_data_cache_add(pop3_store->cache, "cache", fi->uid, ex)) == NULL) {
 			/* stream = camel_stream_mem_new(); */
-			return NULL;
+			goto do_free_ex;
 		}
 
 		/* ref it, the cache storage routine unref's when done */
@@ -1260,6 +1266,9 @@
 
 	g_static_rec_mutex_unlock (pop3_store->uidl_lock);
 
+ do_free_ex:
+	if (free_ex)
+		camel_exception_free (ex);
 	return message;
 }
 


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