aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/e-cal-model.c2
-rw-r--r--calendar/gui/itip-utils.c52
-rw-r--r--calendar/gui/itip-utils.h1
-rw-r--r--plugins/groupwise-features/gw-ui.c2
-rw-r--r--plugins/groupwise-features/proxy-login.c3
5 files changed, 40 insertions, 20 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index ef3c0624df..34408b0151 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -976,7 +976,7 @@ ecm_value_at (ETableModel *etm, gint col, gint row)
const gchar *text;
text = itip_strip_mailto (ca->value);
- if (e_account_list_find (priv->accounts, E_ACCOUNT_FIND_ID_ADDRESS, text) != NULL) {
+ if (itip_address_is_user (text)) {
if (ca->delto != NULL)
retval = 3;
else
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 1ce299e18b..d6b7893694 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -61,6 +61,30 @@ static icalproperty_method itip_methods_enum[] = {
ICAL_METHOD_DECLINECOUNTER,
};
+/**
+ * itip_address_is_user:
+ * @address: an email address
+ *
+ * Looks for a registered mail identity with a matching email address.
+ *
+ * Returns: %TRUE if a match was found, %FALSE if not
+ **/
+gboolean
+itip_address_is_user (const gchar *address)
+{
+ EAccountList *account_list;
+ EAccount *account;
+
+ g_return_val_if_fail (address != NULL, FALSE);
+
+ account_list = e_get_account_list ();
+
+ account = e_account_list_find (
+ account_list, E_ACCOUNT_FIND_ID_ADDRESS, address);
+
+ return (account != NULL);
+}
+
gboolean
itip_organizer_is_user (ECalComponent *comp,
ECal *client)
@@ -102,9 +126,7 @@ itip_organizer_is_user_ex (ECalComponent *comp,
return FALSE;
}
- user_org = e_account_list_find (
- e_get_account_list (),
- E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
+ user_org = itip_address_is_user (strip);
}
return user_org;
@@ -126,9 +148,7 @@ itip_sentby_is_user (ECalComponent *comp,
e_cal_component_get_organizer (comp, &organizer);
if (organizer.sentby != NULL) {
strip = itip_strip_mailto (organizer.sentby);
- user_sentby = e_account_list_find (
- e_get_account_list (),
- E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
+ user_sentby = itip_address_is_user (strip);
}
return user_sentby;
@@ -918,21 +938,19 @@ comp_limit_attendees (ECalComponent *comp)
attendee_text = g_strdup (itip_strip_mailto (attendee));
g_free (attendee);
attendee_text = g_strstrip (attendee_text);
- found = match = e_account_list_find (
- e_get_account_list (),
- E_ACCOUNT_FIND_ID_ADDRESS,
- attendee_text) != NULL;
+ found = match = itip_address_is_user (attendee_text);
if (!found) {
param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
if (param) {
- attendee_sentby = icalparameter_get_sentby (param);
- attendee_sentby_text = g_strdup (itip_strip_mailto (attendee_sentby));
- attendee_sentby_text = g_strstrip (attendee_sentby_text);
- found = match = e_account_list_find (
- e_get_account_list (),
- E_ACCOUNT_FIND_ID_ADDRESS,
- attendee_sentby_text) != NULL;
+ attendee_sentby =
+ icalparameter_get_sentby (param);
+ attendee_sentby =
+ itip_strip_mailto (attendee_sentby);
+ attendee_sentby_text =
+ g_strstrip (g_strdup (attendee_sentby));
+ found = match = itip_address_is_user (
+ attendee_sentby_text);
}
}
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 0362cb0314..bf9f5417c8 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -50,6 +50,7 @@ struct CalMimeAttach {
guint length;
};
+gboolean itip_address_is_user (const gchar *address);
gboolean itip_organizer_is_user (ECalComponent *comp,
ECal *client);
gboolean itip_organizer_is_user_ex (ECalComponent *comp,
diff --git a/plugins/groupwise-features/gw-ui.c b/plugins/groupwise-features/gw-ui.c
index 0d64bd9d3c..08b9382838 100644
--- a/plugins/groupwise-features/gw-ui.c
+++ b/plugins/groupwise-features/gw-ui.c
@@ -321,7 +321,7 @@ is_meeting_owner (ECalComponent *comp, ECal *client)
}
if (!ret_val)
- ret_val = e_account_list_find (e_get_account_list (), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
+ ret_val = itip_address_is_user (strip);
g_free (email);
return ret_val;
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index 2559dc2079..3f80ac9500 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -42,6 +42,7 @@
#include <e-util/e-util-private.h>
#include <e-util/e-account-utils.h>
#include <shell/e-shell-view.h>
+#include <calendar/gui/itip-utils.h>
#include <e-gw-container.h>
#include <e-gw-connection.h>
@@ -335,7 +336,7 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent)
/* README: There should not be the weird scenario of the proxy itself configured as an account.
If so, it is violating the (li)unix philosophy of User creation. So dont care about that scenario*/
- if (e_account_list_find (accounts, E_ACCOUNT_FIND_ID_ADDRESS, email) != NULL) {
+ if (itip_address_is_user (email)) {
e_alert_run_dialog_for_args (error_parent,
"org.gnome.evolution.proxy-login:already-loggedin",
email, NULL);