aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-meeting-store.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-26 22:26:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-04-26 22:26:55 +0800
commit67c0ce8617f12ee0a937ffe14fb40f390e4df86d (patch)
treef6f056c082811a29876978dc32f71b522214056a /calendar/gui/e-meeting-store.c
parent8cd20682159f0e683cdd81af54611b9511f873a1 (diff)
downloadgsoc2013-evolution-67c0ce8617f12ee0a937ffe14fb40f390e4df86d.tar.gz
gsoc2013-evolution-67c0ce8617f12ee0a937ffe14fb40f390e4df86d.tar.zst
gsoc2013-evolution-67c0ce8617f12ee0a937ffe14fb40f390e4df86d.zip
Add e_meeting_store_find_self().
Convenience function that uses registered mail identities to find the user among meeting attendees.
Diffstat (limited to 'calendar/gui/e-meeting-store.c')
-rw-r--r--calendar/gui/e-meeting-store.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index c89bd44e2a..b0c658215c 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -35,6 +35,7 @@
#include <libedataserver/e-proxy.h>
#include <libedataserverui/e-passwords.h>
#include <e-util/e-extensible.h>
+#include <e-util/e-account-utils.h>
#include <e-util/e-util-enumtypes.h>
#include "itip-utils.h"
#include "e-meeting-utils.h"
@@ -1086,6 +1087,52 @@ e_meeting_store_remove_all_attendees (EMeetingStore *store)
}
}
+/**
+ * e_meeting_store_find_self:
+ * @store: an #EMeetingStore
+ * @row: return location for the matching row number, or %NULL
+ *
+ * Looks for the user in @store by comparing attendee email addresses to
+ * registered mail identities. If a matching email address is found and
+ * @row is not %NULL, @row will be set to the #EMeetingStore row number
+ * with the matching email address.
+ *
+ * Returns: an #EMeetingAttendee, or %NULL
+ **/
+EMeetingAttendee *
+e_meeting_store_find_self (EMeetingStore *store,
+ gint *row)
+{
+ EMeetingAttendee *attendee = NULL;
+ EAccountList *account_list;
+ EIterator *iterator;
+
+ g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
+
+ account_list = e_get_account_list ();
+
+ iterator = e_list_get_iterator (E_LIST (account_list));
+
+ while (e_iterator_is_valid (iterator)) {
+ EAccount *account;
+
+ /* XXX EIterator misuses const. */
+ account = (EAccount *) e_iterator_get (iterator);
+
+ attendee = e_meeting_store_find_attendee (
+ store, account->id->address, row);
+
+ if (attendee != NULL)
+ break;
+
+ e_iterator_next (iterator);
+ }
+
+ g_object_unref (iterator);
+
+ return attendee;
+}
+
EMeetingAttendee *
e_meeting_store_find_attendee (EMeetingStore *store,
const gchar *address,