aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog26
-rw-r--r--calendar/cal-client/cal-client.c33
-rw-r--r--calendar/cal-client/cal-client.h1
-rw-r--r--calendar/gui/e-meeting-model.c76
-rw-r--r--calendar/idl/evolution-calendar.idl3
-rw-r--r--calendar/pcs/cal-backend-file.c8
-rw-r--r--calendar/pcs/cal-backend.c10
-rw-r--r--calendar/pcs/cal-backend.h2
-rw-r--r--calendar/pcs/cal.c25
9 files changed, 164 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c9282317ba..fc3b43ab14 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,4 +1,30 @@
2003-03-04 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (impl_Cal_get_ldap_attribute): implement
+
+ * pcs/cal-backend.h: add virtual method
+
+ * pcs/cal-backend.c (cal_backend_get_ldap_attribute): call
+ get_ldap_attribute_method
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): overrid
+ get_ldap_attribute method
+
+ * idl/evolution-calendar.idl: add getLdapAttribute method
+
+ * gui/e-meeting-model.c (process_section): take simple card list
+ as arg and try to use the ldap attribute (if any) as the attendee,
+ else use the email address
+ (select_names_ok_cb): get the simple card list
+
+ * cal-client/cal-client.h: add proto
+
+ * cal-client/cal-client.c (cal_client_init): init ldap_attribute
+ to NULL
+ (cal_client_destroy): free ldap_attribute
+ (cal_client_get_ldap_attribute): accessor
+
+2003-03-04 JP Rosevear <jpr@ximian.com>
* gui/itip-utils.c (itip_organizer_is_user): call
cal_client_get_cal_address instead of cal_client_get_email_address
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 1f76b5e210..371e6c06e0 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -50,6 +50,7 @@ struct _CalClientPrivate {
/* Email address associated with this calendar, or NULL */
char *cal_address;
char *alarm_email_address;
+ char *ldap_attribute;
/* Scheduling info */
char *capabilities;
@@ -314,6 +315,7 @@ cal_client_init (CalClient *client, CalClientClass *klass)
priv->uri = NULL;
priv->cal_address = NULL;
priv->alarm_email_address = NULL;
+ priv->ldap_attribute = NULL;
priv->capabilities = FALSE;
priv->factories = NULL;
priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
@@ -457,6 +459,10 @@ cal_client_finalize (GObject *object)
g_free (priv->alarm_email_address);
priv->alarm_email_address = NULL;
}
+ if (priv->ldap_attribute) {
+ g_free (priv->ldap_attribute);
+ priv->ldap_attribute = NULL;
+ }
if (priv->capabilities) {
g_free (priv->capabilities);
priv->capabilities = NULL;
@@ -1219,6 +1225,33 @@ cal_client_get_alarm_email_address (CalClient *client)
return priv->alarm_email_address;
}
+const char *
+cal_client_get_ldap_attribute (CalClient *client)
+{
+ CalClientPrivate *priv;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+
+ priv = client->priv;
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL);
+
+ if (priv->ldap_attribute == NULL) {
+ CORBA_Environment ev;
+ CORBA_char *ldap_attribute;
+
+ CORBA_exception_init (&ev);
+ ldap_attribute = GNOME_Evolution_Calendar_Cal_getLdapAttribute (priv->cal, &ev);
+ if (!BONOBO_EX (&ev)) {
+ priv->ldap_attribute = g_strdup (ldap_attribute);
+ CORBA_free (ldap_attribute);
+ }
+ CORBA_exception_free (&ev);
+ }
+
+ return priv->ldap_attribute;
+}
+
static void
load_static_capabilities (CalClient *client)
{
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index a9d8d379b2..e44014b9be 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -156,6 +156,7 @@ gboolean cal_client_is_read_only (CalClient *client);
const char *cal_client_get_cal_address (CalClient *client);
const char *cal_client_get_alarm_email_address (CalClient *client);
+const char *cal_client_get_ldap_attribute (CalClient *client);
gboolean cal_client_get_one_alarm_only (CalClient *client);
gboolean cal_client_get_organizer_must_attend (CalClient *client);
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index 2ab28a1fe4..d8dff221db 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -40,7 +40,6 @@
#include <ebook/e-card-cursor.h>
#include <ebook/e-card.h>
#include <ebook/e-card-simple.h>
-#include <ebook/e-destination.h>
#include <cal-util/cal-component.h>
#include <cal-util/cal-util.h>
#include <cal-util/timeutil.h>
@@ -1696,24 +1695,57 @@ e_meeting_model_invite_others_dialog (EMeetingModel *im)
}
static void
-process_section (EMeetingModel *im, EDestination **destv, icalparameter_role role)
+process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList *cards, icalparameter_role role)
{
+ EMeetingModelPrivate *priv;
int i;
-
- for (i = 0; destv[i] != NULL; i++) {
+
+ priv = im->priv;
+ for (i = 0; i < cards->_length; i++) {
EMeetingAttendee *ia;
- const char *name, *address;
-
- name = e_destination_get_name (destv[i]);
- address = e_destination_get_email (destv[i]);
+ const char *name, *attendee = NULL, *attr;
+ GNOME_Evolution_Addressbook_SimpleCard card;
+ CORBA_Environment ev;
+
+ card = cards->_buffer[i];
+
+ CORBA_exception_init (&ev);
+
+ /* Get the CN */
+ name = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_FullName, &ev);
+ if (BONOBO_EX (&ev)) {
+ CORBA_exception_free (&ev);
+ continue;
+ }
+
+ /* Get the field as attendee from the backend */
+ attr = cal_client_get_ldap_attribute (priv->client);
+ if (attr) {
+ /* FIXME this should be more general */
+ if (!strcmp (attr, "icscalendar"))
+ attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Icscalendar, &ev);
+ }
+
+ CORBA_exception_init (&ev);
+
+ /* If we couldn't get the attendee prior, get the email address as the default */
+ if (attendee == NULL) {
+ attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Email, &ev);
+ if (BONOBO_EX (&ev)) {
+ CORBA_exception_free (&ev);
+ continue;
+ }
+ }
- if (address == NULL || *address == '\0')
+ CORBA_exception_free (&ev);
+
+ if (attendee == NULL || *attendee == '\0')
continue;
- if (e_meeting_model_find_attendee (im, address, NULL) == NULL) {
+ if (e_meeting_model_find_attendee (im, attendee, NULL) == NULL) {
ia = e_meeting_model_add_attendee_with_defaults (im);
- e_meeting_attendee_set_address (ia, g_strdup_printf ("MAILTO:%s", address));
+ e_meeting_attendee_set_address (ia, g_strdup_printf ("MAILTO:%s", attendee));
e_meeting_attendee_set_role (ia, role);
if (role == ICAL_ROLE_NONPARTICIPANT)
e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
@@ -1733,8 +1765,10 @@ select_names_ok_cb (BonoboListener *listener,
EMeetingModelPrivate *priv;
Bonobo_Control corba_control;
GtkWidget *control_widget;
- EDestination **destv;
- char *string = NULL;
+ BonoboControlFrame *control_frame;
+ Bonobo_PropertyBag pb;
+ BonoboArg *card_arg;
+ GNOME_Evolution_Addressbook_SimpleCardList cards;
int i;
priv = im->priv;
@@ -1744,13 +1778,15 @@ select_names_ok_cb (BonoboListener *listener,
(priv->corba_select_names, sections[i], ev);
control_widget = bonobo_widget_new_control_from_objref
(corba_control, CORBA_OBJECT_NIL);
-
- bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations", TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
- if (destv != NULL) {
- process_section (im, destv, roles[i]);
- e_destination_freev (destv);
- }
+
+ control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget));
+ pb = bonobo_control_frame_get_control_property_bag (control_frame, NULL);
+ card_arg = bonobo_property_bag_client_get_value_any (pb, "simple_card_list", NULL);
+ if (card_arg != NULL) {
+ cards = BONOBO_ARG_GET_GENERAL (card_arg, TC_GNOME_Evolution_Addressbook_SimpleCardList, GNOME_Evolution_Addressbook_SimpleCardList, NULL);
+ process_section (im, &cards, roles[i]);
+ bonobo_arg_release (card_arg);
+ }
}
}
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 5feb0082ec..20fd822d93 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -158,6 +158,9 @@ module Calendar {
string getAlarmEmailAddress ()
raises (NotFound);
+ /* Returns the LDAP attribute to get attendees from */
+ string getLdapAttribute ();
+
/* For going online/offline */
void setMode (in CalMode mode);
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 91081d77f0..7ab6506aa9 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -80,6 +80,7 @@ static const char *cal_backend_file_get_uri (CalBackend *backend);
static gboolean cal_backend_file_is_read_only (CalBackend *backend);
static const char *cal_backend_file_get_cal_address (CalBackend *backend);
static const char *cal_backend_file_get_alarm_email_address (CalBackend *backend);
+static const char *cal_backend_file_get_ldap_attribute (CalBackend *backend);
static const char *cal_backend_file_get_static_capabilities (CalBackend *backend);
static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend,
const char *uristr,
@@ -180,6 +181,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->is_read_only = cal_backend_file_is_read_only;
backend_class->get_cal_address = cal_backend_file_get_cal_address;
backend_class->get_alarm_email_address = cal_backend_file_get_alarm_email_address;
+ backend_class->get_ldap_attribute = cal_backend_file_get_ldap_attribute;
backend_class->get_static_capabilities = cal_backend_file_get_static_capabilities;
backend_class->open = cal_backend_file_open;
backend_class->is_loaded = cal_backend_file_is_loaded;
@@ -441,6 +443,12 @@ cal_backend_file_get_cal_address (CalBackend *backend)
}
static const char *
+cal_backend_file_get_ldap_attribute (CalBackend *backend)
+{
+ return NULL;
+}
+
+static const char *
cal_backend_file_get_alarm_email_address (CalBackend *backend)
{
/* A file backend has no particular email address associated
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 536501ce47..765d873f79 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -294,6 +294,16 @@ cal_backend_get_alarm_email_address (CalBackend *backend)
}
const char *
+cal_backend_get_ldap_attribute (CalBackend *backend)
+{
+ g_return_val_if_fail (backend != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
+
+ g_assert (CLASS (backend)->get_ldap_attribute != NULL);
+ return (* CLASS (backend)->get_ldap_attribute) (backend);
+}
+
+const char *
cal_backend_get_static_capabilities (CalBackend *backend)
{
g_return_val_if_fail (backend != NULL, NULL);
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index ba73886bbd..962b468fc3 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -97,6 +97,7 @@ struct _CalBackendClass {
const char *(* get_cal_address) (CalBackend *backend);
const char *(* get_alarm_email_address) (CalBackend *backend);
+ const char *(* get_ldap_attribute) (CalBackend *backend);
const char *(* get_static_capabilities) (CalBackend *backend);
@@ -157,6 +158,7 @@ const char *cal_backend_get_uri (CalBackend *backend);
const char *cal_backend_get_cal_address (CalBackend *backend);
const char *cal_backend_get_alarm_email_address (CalBackend *backend);
+const char *cal_backend_get_ldap_attribute (CalBackend *backend);
const char *cal_backend_get_static_capabilities (CalBackend *backend);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 9040534940..bd6ffb4b38 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -125,6 +125,30 @@ impl_Cal_getAlarmEmailAddress (PortableServer_Servant servant,
return str_email_address_copy;
}
+
+/* Cal::get_ldap_attribute method */
+static CORBA_char *
+impl_Cal_getLdapAttribute (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ Cal *cal;
+ CalPrivate *priv;
+ const char *str_ldap_attr;
+ CORBA_char *str_ldap_attr_copy;
+
+ cal = CAL (bonobo_object_from_servant (servant));
+ priv = cal->priv;
+
+ str_ldap_attr = cal_backend_get_ldap_attribute (priv->backend);
+ if (str_ldap_attr == NULL) {
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound);
+ return CORBA_OBJECT_NIL;
+ }
+
+ str_ldap_attr_copy = CORBA_string_dup (str_ldap_attr);
+
+ return str_ldap_attr_copy;
+}
/* Cal::getSchedulingInformation method */
static CORBA_char *
@@ -817,6 +841,7 @@ cal_class_init (CalClass *klass)
epv->isReadOnly = impl_Cal_isReadOnly;
epv->getCalAddress = impl_Cal_getCalAddress;
epv->getAlarmEmailAddress = impl_Cal_getAlarmEmailAddress;
+ epv->getLdapAttribute = impl_Cal_getLdapAttribute;
epv->getStaticCapabilities = impl_Cal_getStaticCapabilities;
epv->setMode = impl_Cal_setMode;
epv->countObjects = impl_Cal_countObjects;