diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-02-25 00:47:08 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-02-25 00:47:08 +0800 |
commit | 177b57f1b63e27a124d7b1dce2f3a0718bdd2600 (patch) | |
tree | e5bc5a253a22d419ffbc3142b5cf714fd2ca70d6 /camel | |
parent | 377deb017693a02fea68b7555ccd1e2ccda01610 (diff) | |
download | gsoc2013-evolution-177b57f1b63e27a124d7b1dce2f3a0718bdd2600.tar.gz 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')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-store.c | 51 | ||||
-rw-r--r-- | camel/camel-store.h | 4 |
3 files changed, 60 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3197349085..b02f569277 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +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. + 2004-02-23 Rodney Dawes <dobey@ximian.com> * providers/local/camel-mbox-store.c (scan_dir): If our folder has 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; +} diff --git a/camel/camel-store.h b/camel/camel-store.h index bf736cc4a4..955f4c891a 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -231,6 +231,10 @@ void camel_store_unsubscribe_folder (CamelStore *store, void camel_store_noop (CamelStore *store, CamelException *ex); +int camel_store_folder_uri_equal (CamelStore *store, + const char *uri0, + const char *uri1); + #ifdef __cplusplus } #endif /* __cplusplus */ |