aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-service.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-29 16:24:16 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-29 16:24:16 +0800
commita96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4 (patch)
treee66755a8e11a5f6612fe0d4dabe5b7675731f9da /camel/camel-service.c
parentaadeb422d2dca792606159a24de45ce074170e0d (diff)
downloadgsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.gz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.bz2
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.lz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.xz
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.tar.zst
gsoc2013-evolution-a96a5b74204b32b147e2cfacfec6c9d9e9ee2bf4.zip
added a doc comment.
2004-01-29 Not Zed <NotZed@Ximian.com> * camel-object.c (camel_object_bag_rekey): added a doc comment. ** See bug #53520. * camel-session.c (get_service): free the url once done, it now gets copied by the service. * camel-service.c (construct): copy the url that comes in, don't just '0Wn34z' it. clena up exception handling too. svn path=/trunk/; revision=24513
Diffstat (limited to 'camel/camel-service.c')
-rw-r--r--camel/camel-service.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/camel/camel-service.c b/camel/camel-service.c
index cd66bb9cb1..b5f5b4bc4c 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -266,43 +266,37 @@ service_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
}
static void
-construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, CamelURL *url, CamelException *ex)
+construct (CamelService *service, CamelSession *session, CamelProvider *provider, CamelURL *url, CamelException *ex)
{
- char *url_string;
+ char *err, *url_string;
if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_USER) &&
(url->user == NULL || url->user[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a username component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a username component");
+ goto fail;
} else if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_HOST) &&
(url->host == NULL || url->host[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a host component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a host component");
+ goto fail;
} else if (CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_PATH) &&
(url->path == NULL || url->path[0] == '\0')) {
- url_string = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("URL '%s' needs a path component"),
- url_string);
- g_free (url_string);
- return;
+ err = _("URL '%s' needs a path component");
+ goto fail;
}
service->provider = provider;
- service->url = url;
+ service->url = camel_url_copy(url);
service->session = session;
camel_object_ref (session);
service->status = CAMEL_SERVICE_DISCONNECTED;
+
+ return;
+
+fail:
+ url_string = camel_url_to_string(url, CAMEL_URL_HIDE_PASSWORD);
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, err, url_string);
+ g_free(url_string);
}
/**