[evolution-data-server/email-factory] Revert "Bug #645783 - Return safe paths from CamelService::get_path()"
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/email-factory] Revert "Bug #645783 - Return safe paths from CamelService::get_path()"
- Date: Tue, 10 May 2011 10:44:12 +0000 (UTC)
commit 75106d95523364c8b8d408bea72efd682504c208
Author: David Woodhouse <David Woodhouse intel com>
Date: Tue Apr 19 17:37:33 2011 +0100
Revert "Bug #645783 - Return safe paths from CamelService::get_path()"
This reverts commit c25eab6d039c4594a529ce24bbfdb344deb031ff, which was
unmerged, didn't build, and didn't correctly reference the upstream commit
that it was based on.
Bad Fridrich; no biscuit
camel/camel-service.c | 75 ++++++------------------------------------------
1 files changed, 10 insertions(+), 65 deletions(-)
---
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 9eb389d..3ccd95d 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -34,8 +34,6 @@
#include <glib/gi18n-lib.h>
-#include <libedataserver/e-data-server-util.h>
-
#include "camel-debug.h"
#include "camel-operation.h"
#include "camel-service.h"
@@ -164,97 +162,44 @@ service_get_name (CamelService *service,
static gchar *
service_get_path (CamelService *service)
{
-<<<<<<< HEAD
CamelProvider *prov = service->provider;
CamelURL *url = service->url;
GString *gpath;
gchar *path;
-=======
- CamelProvider *prov = service->priv->provider;
- CamelURL *url = service->priv->url;
- GString *use_path1 = NULL, *use_path2 = NULL;
- gchar *ret_path = NULL;
->>>>>>> de8f0fc... Bug #645783 - Return safe paths from CamelService::get_path()
/* A sort of ad-hoc default implementation that works for our
* current set of services.
*/
-<<<<<<< HEAD
gpath = g_string_new (service->provider->protocol);
-=======
->>>>>>> de8f0fc... Bug #645783 - Return safe paths from CamelService::get_path()
if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_USER)) {
- use_path1 = g_string_new ("");
-
if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) {
- g_string_append_printf (use_path1, "%s %s",
+ g_string_append_printf (gpath, "/%s %s",
url->user ? url->user : "",
url->host ? url->host : "");
if (url->port)
- g_string_append_printf (use_path1, ":%d", url->port);
+ g_string_append_printf (gpath, ":%d", url->port);
} else {
- g_string_append_printf (use_path1, "%s%s", url->user ? url->user : "",
+ g_string_append_printf (gpath, "/%s%s", url->user ? url->user : "",
CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER) ? "" : "@");
}
-
- e_filename_make_safe (use_path1->str);
} else if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) {
- use_path1 = g_string_new ("");
-
- g_string_append_printf (use_path1, "%s%s",
+ g_string_append_printf (gpath, "/%s%s",
CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST) ? "" : "@",
url->host ? url->host : "");
if (url->port)
- g_string_append_printf (use_path1, ":%d", url->port);
-
- e_filename_make_safe (use_path1->str);
- }
-
- if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH) && url->path && *url->path) {
- use_path2 = g_string_new (*url->path == '/' ? url->path + 1 : url->path);
-
- /* fix directory separators, if needed */
- if (G_DIR_SEPARATOR != '/') {
- gchar **elems = g_strsplit (use_path2->str, "/", -1);
-
- if (elems) {
- gint ii;
-
- g_string_truncate (use_path2, 0);
-
- for (ii = 0; elems[ii]; ii++) {
- gchar *elem = elems[ii];
-
- if (*elem) {
- e_filename_make_safe (elem);
-
- if (use_path2->len)
- g_string_append_c (use_path2, G_DIR_SEPARATOR);
- g_string_append (use_path2, elem);
- }
- }
-
- g_strfreev (elems);
- }
- }
- }
-
- if (!use_path1 && use_path2) {
- use_path1 = use_path2;
- use_path2 = NULL;
+ g_string_append_printf (gpath, ":%d", url->port);
}
- ret_path = g_build_filename (service->priv->provider->protocol, use_path1 ? use_path1->str : NULL, use_path2 ? use_path2->str : NULL, NULL);
+ if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH))
+ g_string_append_printf (gpath, "%s%s", *url->path == '/' ? "" : "/", url->path);
- if (use_path1)
- g_string_free (use_path1, TRUE);
- if (use_path2)
- g_string_free (use_path2, TRUE);
+ path = gpath->str;
+ g_string_free (gpath, FALSE);
- return ret_path;
+ return path;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]