diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-05-31 06:35:40 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-05-31 06:35:40 +0800 |
commit | 631dda8ae0829b1fb7b503348de541e3fe2027c5 (patch) | |
tree | b809428b7c6e01cf6bce0513b7ab20f436b0352a /camel/camel-url.c | |
parent | a9ddc24118d91139784cb0ce99789a739fdc5978 (diff) | |
download | gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar.gz gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar.bz2 gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar.lz gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar.xz gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.tar.zst gsoc2013-evolution-631dda8ae0829b1fb7b503348de541e3fe2027c5.zip |
Init filter_from to NULL, for exception case. (mbox_get_message_by_uid):
2000-05-30 Not Zed <NotZed@HelixCode.com>
* providers/mbox/camel-mbox-folder.c (mbox_append_message): Init
filter_from to NULL, for exception case.
(mbox_get_message_by_uid): Cast off_t to long int for diagnostics.
* camel-url.c (camel_url_hash): Hash funciton for using camel
url's as hash keys.
(camel_url_equal): equal function for same.
* camel-session.c (camel_session_finalise): Free cached services.
(camel_session_init): Init service cache.
(service_cache_remove): destroy callback to remove a service from
the cache.
* camel-store.c (get_folder_internal): Remove the extra ref of the
folder. That seems the right behaviour ...?
(camel_store_get_type): Doh, actually call store init, so the
cache works.
(cache_folder): strdup the folder name! no wonder it never found
it again.
svn path=/trunk/; revision=3298
Diffstat (limited to 'camel/camel-url.c')
-rw-r--r-- | camel/camel-url.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/camel/camel-url.c b/camel/camel-url.c index 96721bda24..c0707dcbb1 100644 --- a/camel/camel-url.c +++ b/camel/camel-url.c @@ -43,8 +43,7 @@ * * protocol://user;AUTH=mech:password@host:port/path * - * The protocol, followed by a ":" is required. If it is followed by - * "//", there must be an "authority" containing at least a host, + * The protocol, followed by a ":" is required. If it is followed by * "//", there must be an "authority" containing at least a host, * which ends at the end of the string or at the next "/". If there * is an "@" in the authority, there must be a username before it, * and the host comes after it. The authmech, password, and port are @@ -292,3 +291,56 @@ camel_url_decode (char *part) } *d = '\0'; } + +static void +add_hash(guint *hash, char *s) +{ + if (s) + *hash ^= g_str_hash(s); +} + +guint camel_url_hash (const void *v) +{ + const CamelURL *u = v; + guint hash = 0; + + add_hash(&hash, u->protocol); + add_hash(&hash, u->user); + add_hash(&hash, u->authmech); + add_hash(&hash, u->passwd); + add_hash(&hash, u->host); + add_hash(&hash, u->path); + hash ^= u->port; + return hash; +} + +static int +check_equal(char *s1, char *s2) +{ + if (s1 == NULL) { + if (s2 == NULL) + return TRUE; + else + return FALSE; + } + if (s2 == NULL) { + if (s1 == NULL) + return TRUE; + else + return FALSE; + } + return strcmp(s1, s2) == 0; +} + +int camel_url_equal(const void *v, const void *v2) +{ + const CamelURL *u1 = v, *u2 = v2; + + return check_equal(u1->protocol, u2->protocol) + && check_equal(u1->user, u2->user) + && check_equal(u1->authmech, u2->authmech) + && check_equal(u1->passwd, u2->passwd) + && check_equal(u1->host, u2->host) + && check_equal(u1->path, u2->path) + && u1->port == u2->port; +} |