+2009-04-24 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #552583
+
+ * camel-pop3-provider.c: (pop3_url_hash), (pop3_url_equal),
+ (camel_provider_module_init), (add_hash), (check_equal):
+ Compare URLs only on protocol, user, host and port.
+
2008-12-09 Milan Crha <mcrha@redhat.com>
** Fix for bug #552986
#include "camel-session.h"
#include "camel-url.h"
+static guint pop3_url_hash (gconstpointer key);
+static gint pop3_url_equal (gconstpointer a, gconstpointer b);
static CamelProviderConfEntry pop3_conf_entries[] = {
{ CAMEL_PROVIDER_CONF_SECTION_START, "storage", NULL,
CamelServiceAuthType *auth;
pop3_provider.object_types[CAMEL_PROVIDER_STORE] = camel_pop3_store_get_type();
- pop3_provider.url_hash = camel_url_hash;
- pop3_provider.url_equal = camel_url_equal;
+ pop3_provider.url_hash = pop3_url_hash;
+ pop3_provider.url_equal = pop3_url_equal;
pop3_provider.authtypes = camel_sasl_authtype_list (FALSE);
auth = camel_sasl_authtype("LOGIN");
camel_provider_register(&pop3_provider);
}
+
+static void
+add_hash (guint *hash, char *s)
+{
+ if (s)
+ *hash ^= g_str_hash(s);
+}
+
+static guint
+pop3_url_hash (gconstpointer key)
+{
+ const CamelURL *u = (CamelURL *)key;
+ guint hash = 0;
+
+ add_hash (&hash, u->user);
+ add_hash (&hash, u->host);
+ hash ^= u->port;
+
+ return hash;
+}
+
+static gint
+check_equal (char *s1, char *s2)
+{
+ if (s1 == NULL) {
+ if (s2 == NULL)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ if (s2 == NULL)
+ return FALSE;
+
+ return strcmp (s1, s2) == 0;
+}
+
+static gint
+pop3_url_equal (gconstpointer a, gconstpointer b)
+{
+ const CamelURL *u1 = a, *u2 = b;
+
+ return check_equal (u1->protocol, u2->protocol)
+ && check_equal (u1->user, u2->user)
+ && check_equal (u1->host, u2->host)
+ && u1->port == u2->port;
+}
+2009-04-24 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #552583
+
+ * camel-smtp-provider.c: (smtp_url_hash), (smtp_url_equal),
+ (camel_provider_module_init), (add_hash), (check_equal):
+ Compare URLs only on protocol, user, host and port.
+
2008-09-26 Milan Crha <mcrha@redhat.com>
** Part of fix for bug #553301
#include "camel-smtp-transport.h"
#include "camel-url.h"
+static guint smtp_url_hash (gconstpointer key);
+static gint smtp_url_equal (gconstpointer a, gconstpointer b);
+
static CamelProvider smtp_provider = {
"smtp",
N_("SMTP"),
smtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_smtp_transport_get_type ();
smtp_provider.authtypes = g_list_append (camel_sasl_authtype_list (TRUE), camel_sasl_authtype ("LOGIN"));
smtp_provider.authtypes = g_list_append (smtp_provider.authtypes, camel_sasl_authtype ("POPB4SMTP"));
- smtp_provider.url_hash = camel_url_hash;
- smtp_provider.url_equal = camel_url_equal;
+ smtp_provider.url_hash = smtp_url_hash;
+ smtp_provider.url_equal = smtp_url_equal;
smtp_provider.translation_domain = GETTEXT_PACKAGE;
camel_provider_register(&smtp_provider);
}
+static void
+add_hash (guint *hash, char *s)
+{
+ if (s)
+ *hash ^= g_str_hash(s);
+}
+
+static guint
+smtp_url_hash (gconstpointer key)
+{
+ const CamelURL *u = (CamelURL *)key;
+ guint hash = 0;
+ add_hash (&hash, u->user);
+ add_hash (&hash, u->host);
+ hash ^= u->port;
+
+ return hash;
+}
+static gint
+check_equal (char *s1, char *s2)
+{
+ if (s1 == NULL) {
+ if (s2 == NULL)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ if (s2 == NULL)
+ return FALSE;
+
+ return strcmp (s1, s2) == 0;
+}
+
+static gint
+smtp_url_equal (gconstpointer a, gconstpointer b)
+{
+ const CamelURL *u1 = a, *u2 = b;
+
+ return check_equal (u1->protocol, u2->protocol)
+ && check_equal (u1->user, u2->user)
+ && check_equal (u1->host, u2->host)
+ && u1->port == u2->port;
+}