- Add patch for GNOME bug #552583 (fix account URI comparisons).

This commit is contained in:
Matthew Barnes 2008-12-09 17:30:20 +00:00
parent e877bca4f9
commit 42aa128ab8
2 changed files with 163 additions and 1 deletions

View File

@ -0,0 +1,155 @@
diff -up evolution-2.25.2/mail/mail-config.c.broken-account-uris evolution-2.25.2/mail/mail-config.c
--- evolution-2.25.2/mail/mail-config.c.broken-account-uris 2008-11-27 04:41:49.000000000 -0500
+++ evolution-2.25.2/mail/mail-config.c 2008-12-09 11:28:35.000000000 -0500
@@ -800,53 +800,64 @@ mail_config_get_account_by_uid (const ch
return (EAccount *) e_account_list_find (config->accounts, E_ACCOUNT_FIND_UID, uid);
}
+static gboolean
+mail_config_account_url_equal (const CamelURL *u1,
+ const CamelURL *u2)
+{
+ /* For the purpose of matching a URL to an EAccount, only compare
+ * the protocol, user, host and port and disregard the rest. */
+
+ if (g_strcmp0 (u1->protocol, u2->protocol) != 0)
+ return FALSE;
+
+ if (g_strcmp0 (u1->user, u2->user) != 0)
+ return FALSE;
+
+ if (g_strcmp0 (u1->host, u2->host) != 0)
+ return FALSE;
+
+ return (u1->port == u2->port);
+}
+
EAccount *
mail_config_get_account_by_source_url (const char *source_url)
{
EAccount *account = NULL;
EIterator *iter;
+ CamelURL *url;
g_return_val_if_fail (source_url != NULL, NULL);
+ url = camel_url_new (source_url, NULL);
+ g_return_val_if_fail (url != NULL, NULL);
+
iter = e_list_get_iterator ((EList *) config->accounts);
- while (e_iterator_is_valid (iter)) {
- CamelURL *url;
- gchar *string;
+ while (account == NULL && e_iterator_is_valid (iter)) {
+ CamelURL *account_url;
account = (EAccount *) e_iterator_get (iter);
e_iterator_next (iter);
- if (account->source == NULL)
- continue;
-
- else if (account->source->url == NULL)
- continue;
-
- else if (*account->source->url == '\0')
+ if ( !account || (account->source == NULL) ||
+ (account->source->url == NULL) || (*account->source->url == '\0')) {
+ account = NULL;
continue;
+ }
- url = camel_url_new (account->source->url, NULL);
- if (url == NULL)
+ account_url = camel_url_new (account->source->url, NULL);
+ if (account_url == NULL)
continue;
- /* Simplify the account URL for comparison. */
- string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- if (string == NULL || strcmp (string, source_url) != 0)
+ if (!mail_config_account_url_equal (url, account_url))
account = NULL; /* not a match */
- camel_url_free (url);
- g_free (string);
-
- if (account != NULL) {
- g_object_unref (iter);
- return account;
- }
+ camel_url_free (account_url);
}
g_object_unref (iter);
- return NULL;
+ return account;
}
EAccount *
@@ -854,48 +865,40 @@ mail_config_get_account_by_transport_url
{
EAccount *account = NULL;
EIterator *iter;
+ CamelURL *url;
g_return_val_if_fail (transport_url != NULL, NULL);
+ url = camel_url_new (transport_url, NULL);
+ g_return_val_if_fail (url != NULL, NULL);
+
iter = e_list_get_iterator ((EList *) config->accounts);
- while (e_iterator_is_valid (iter)) {
- CamelURL *url;
- gchar *string;
+ while (account == NULL && e_iterator_is_valid (iter)) {
+ CamelURL *account_url;
account = (EAccount *) e_iterator_get (iter);
e_iterator_next (iter);
- if (account->transport == NULL)
- continue;
-
- else if (account->transport->url == NULL)
- continue;
-
- else if (*account->transport->url == '\0')
- continue;
+ if ( !account || (account->transport == NULL) ||
+ (account->transport->url == NULL) || (*account->transport->url == '\0')) {
+ account = NULL;
+ continue;
+ }
- url = camel_url_new (account->transport->url, NULL);
- if (url == NULL)
+ account_url = camel_url_new (account->transport->url, NULL);
+ if (account_url == NULL)
continue;
- /* Simplify the account URL for comparison. */
- string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
- if (string == NULL || strcmp (string, transport_url) != 0)
+ if (!mail_config_account_url_equal (url, account_url))
account = NULL; /* not a match */
camel_url_free (url);
- g_free (string);
-
- if (account != NULL) {
- g_object_unref (iter);
- return account;
- }
}
g_object_unref (iter);
- return NULL;
+ return account;
}
int

View File

@ -45,7 +45,7 @@
Name: evolution Name: evolution
Version: 2.25.2 Version: 2.25.2
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2 and GFDL License: GPLv2 and GFDL
Group: Applications/Productivity Group: Applications/Productivity
Summary: Mail and calendar client for GNOME Summary: Mail and calendar client for GNOME
@ -77,6 +77,9 @@ Patch13: evolution-2.7.1-no-gnome-common.patch
# RH bug #176400 # RH bug #176400
Patch14: evolution-2.9.1-im-context-reset.patch Patch14: evolution-2.9.1-im-context-reset.patch
# GNOME bug #552583
Patch15: evolution-2.25.2-broken-account-uris.patch
## Dependencies ### ## Dependencies ###
Requires(post): GConf2 Requires(post): GConf2
@ -230,6 +233,7 @@ This package contains supplemental utilities for %{name} that require Perl.
%patch12 -p1 -b .fix-conduit-dir %patch12 -p1 -b .fix-conduit-dir
%patch13 -p1 -b .no-gnome-common %patch13 -p1 -b .no-gnome-common
%patch14 -p1 -b .im-context-reset %patch14 -p1 -b .im-context-reset
%patch15 -p1 -b .broken-account-uris
mkdir -p krb5-fakeprefix/include mkdir -p krb5-fakeprefix/include
mkdir -p krb5-fakeprefix/lib mkdir -p krb5-fakeprefix/lib
@ -696,6 +700,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libexecdir}/evolution/%{evo_major}/evolution-addressbook-clean %{_libexecdir}/evolution/%{evo_major}/evolution-addressbook-clean
%changelog %changelog
* Tue Dec 09 2008 Matthew Barnes <mbarnes@redhat.com> - 2.25.2-2.fc11
- Add patch for GNOME bug #552583 (fix account URI comparisons).
* Mon Dec 01 2008 Matthew Barnes <mbarnes@redhat.com> - 2.25.2-1.fc11 * Mon Dec 01 2008 Matthew Barnes <mbarnes@redhat.com> - 2.25.2-1.fc11
- Update to 2.25.2 - Update to 2.25.2
- Bump eds_version to 2.25.2. - Bump eds_version to 2.25.2.