aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-25 00:47:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-25 00:47:08 +0800
commit177b57f1b63e27a124d7b1dce2f3a0718bdd2600 (patch)
treee5bc5a253a22d419ffbc3142b5cf714fd2ca70d6 /camel/camel-store.c
parent377deb017693a02fea68b7555ccd1e2ccda01610 (diff)
downloadgsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.gz
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.bz2
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.lz
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.xz
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.zst
gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.zip
New function to do what camel_store_uri_cmp() was supposed to do.
2004-02-24 Jeffrey Stedfast <fejj@ximian.com> * camel-store.c (camel_store_folder_uri_equal): New function to do what camel_store_uri_cmp() was supposed to do. svn path=/trunk/; revision=24846
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r--camel/camel-store.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c
index c2e6a1ff4d..ddd92d9022 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1184,3 +1184,54 @@ camel_store_noop (CamelStore *store, CamelException *ex)
{
CS_CLASS (store)->noop (store, ex);
}
+
+
+/**
+ * camel_store_folder_uri_equal:
+ * @store: CamelStore
+ * @uri0: a uri
+ * @uri1: another uri
+ *
+ * Compares 2 folder uris to check that they are equal.
+ *
+ * Returns %TRUE if they are equal or %FALSE otherwise.
+ **/
+int
+camel_store_folder_uri_equal (CamelStore *store, const char *uri0, const char *uri1)
+{
+ CamelProvider *provider;
+ CamelURL *url0, *url1;
+ int equal;
+
+ g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
+ g_return_val_if_fail (uri0 == NULL || uri1 == NULL, FALSE);
+
+ provider = ((CamelService *) store)->provider;
+
+ if (!(url0 = camel_url_new (uri0, NULL)))
+ return FALSE;
+
+ if (!(url1 = camel_url_new (uri1, NULL))) {
+ camel_url_free (url0);
+ return FALSE;
+ }
+
+ if ((equal = provider->url_equal (url0, url1))) {
+ const char *name0, *name1;
+
+ if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) {
+ name0 = url0->fragment;
+ name1 = url1->fragment;
+ } else {
+ name0 = url0->path[0] == '/' ? url0->path + 1 : url0->path;
+ name1 = url1->path[0] == '/' ? url1->path + 1 : url1->path;
+ }
+
+ equal = CS_CLASS (store)->compare_folder_name (name0, name1);
+ }
+
+ camel_url_free (url0);
+ camel_url_free (url1);
+
+ return equal;
+}