Fix up some glib precondition stuff. Try to set the URL in

* camel-service.c (camel_service_new): Fix up some glib
	precondition stuff. Try to set the URL in camel_service_new before
	checking whether or not it's "empty" so that you can successfully
	set "sendmail:" as a URL.

svn path=/trunk/; revision=3266
This commit is contained in:
Dan Winship
2000-05-29 19:32:29 +00:00
parent ccb665a026
commit 9f804702d5
2 changed files with 20 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2000-05-29 Dan Winship <danw@helixcode.com>
* camel-service.c (camel_service_new): Fix up some glib
precondition stuff. Try to set the URL in camel_service_new before
checking whether or not it's "empty" so that you can successfully
set "sendmail:" as a URL.
2000-05-28 Dan Winship <danw@helixcode.com>
* camel-provider.h: Add a domain field to CamelProvider, to say

View File

@ -25,6 +25,7 @@
*/
#include <config.h>
#include "camel-service.h"
#include "camel-session.h"
#include "camel-exception.h"
#include <ctype.h>
@ -124,15 +125,13 @@ camel_service_new (GtkType type, CamelSession *session, CamelURL *url,
{
CamelService *service;
g_assert(session);
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
service = CAMEL_SERVICE (gtk_object_new (type, NULL));
service->session = session;
gtk_object_ref (GTK_OBJECT (session));
if (!url->empty) {
if (!_set_url (service, url, ex))
return NULL;
}
if (!_set_url (service, url, ex) && !url->empty)
return NULL;
return service;
}
@ -150,13 +149,6 @@ camel_service_new (GtkType type, CamelSession *session, CamelURL *url,
static gboolean
_connect (CamelService *service, CamelException *ex)
{
g_assert (service->session);
/* XXX it's possible that this should be an exception
* rather than an assertion... I'm not sure how the code
* is supposed to be used.
*/
g_assert (service->url);
service->connected = TRUE;
return TRUE;
}
@ -176,6 +168,10 @@ _connect (CamelService *service, CamelException *ex)
gboolean
camel_service_connect (CamelService *service, CamelException *ex)
{
g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
g_return_val_if_fail (service->session != NULL, FALSE);
g_return_val_if_fail (service->url != NULL, FALSE);
return CSERV_CLASS(service)->connect(service, ex);
}
@ -195,8 +191,6 @@ camel_service_connect (CamelService *service, CamelException *ex)
static gboolean
_connect_with_url (CamelService *service, CamelURL *url, CamelException *ex)
{
g_assert (service->session);
if (!_set_url (service, url, ex))
return FALSE;
@ -218,8 +212,12 @@ gboolean
camel_service_connect_with_url (CamelService *service, char *url_string,
CamelException *ex)
{
CamelURL *url = camel_url_new (url_string, ex);
CamelURL *url;
g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
g_return_val_if_fail (service->session != NULL, FALSE);
url = camel_url_new (url_string, ex);
if (!url)
return FALSE;
return CSERV_CLASS(service)->connect_with_url (service, url, ex);