aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-07-12 07:46:52 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-07-12 07:46:52 +0800
commit188ec0d0254b5f1e6fa1f98e70f5ad0990184490 (patch)
tree2edc3f1928a6f3ab37474763791e9ca11516270b /calendar
parente118c5cdbc09918fc648dd63d6f3c02cdcdfcdc2 (diff)
downloadgsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar.gz
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar.bz2
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar.lz
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar.xz
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.tar.zst
gsoc2013-evolution-188ec0d0254b5f1e6fa1f98e70f5ad0990184490.zip
be careful about adding and stripping MAILTO:'s properly
2001-07-11 JP Rosevear <jpr@ximian.com> * gui/dialogs/meeting-page.c: be careful about adding and stripping MAILTO:'s properly * gui/dialogs/meeting-page.etspec: add missing columns * gui/itip-utils.c (itip_strip_mailto): point to the real start of the email address * gui/itip-utils.h: add proto * gui/itip-control-factory.c: get rid of the my address property * gui/e-itip-control.c: use the users real identity to figure out which attendee they are (find_my_address): figure out who the user is among the attendees * gui/e-itip-control.h: remove protos * gui/dialogs/Makefile.am: extra dist etspecs * gui/Makefile.am: ditto svn path=/trunk/; revision=11020
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog24
-rw-r--r--calendar/gui/Makefile.am1
-rw-r--r--calendar/gui/dialogs/Makefile.am3
-rw-r--r--calendar/gui/dialogs/meeting-page.c23
-rw-r--r--calendar/gui/dialogs/meeting-page.etspec12
-rw-r--r--calendar/gui/e-itip-control.c78
-rw-r--r--calendar/gui/e-itip-control.h4
-rw-r--r--calendar/gui/itip-bonobo-control.c9
-rw-r--r--calendar/gui/itip-control-factory.c9
-rw-r--r--calendar/gui/itip-utils.c29
-rw-r--r--calendar/gui/itip-utils.h2
11 files changed, 117 insertions, 77 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 957298ab51..2cbf26c8d1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,27 @@
+2001-07-11 JP Rosevear <jpr@ximian.com>
+
+ * gui/dialogs/meeting-page.c: be careful about adding and
+ stripping MAILTO:'s properly
+
+ * gui/dialogs/meeting-page.etspec: add missing columns
+
+ * gui/itip-utils.c (itip_strip_mailto): point to the real start of
+ the email address
+
+ * gui/itip-utils.h: add proto
+
+ * gui/itip-control-factory.c: get rid of the my address property
+
+ * gui/e-itip-control.c: use the users real identity to figure out
+ which attendee they are
+ (find_my_address): figure out who the user is among the attendees
+
+ * gui/e-itip-control.h: remove protos
+
+ * gui/dialogs/Makefile.am: extra dist etspecs
+
+ * gui/Makefile.am: ditto
+
2001-07-11 Kjartan Maraas <kmaraas@gnome.org>
* gui/e-calendar-table.c: Added a hack to get the last
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index e21fe3737f..b7d2d73a6d 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -165,6 +165,7 @@ oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
EXTRA_DIST = \
$(glade_DATA) \
+ $(etspec_DATA) \
$(oaf_in_files)
install-data-local:
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index cee0600243..bb0778162b 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -75,4 +75,5 @@ etspecdir = $(datadir)/evolution/etspec/
etspec_DATA = meeting-page.etspec
EXTRA_DIST = \
- $(glade_DATA)
+ $(glade_DATA) \
+ $(etspec_DATA)
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 1504c48968..b4e5732e11 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -305,7 +305,7 @@ clear_widgets (MeetingPage *mpage)
priv->other = FALSE;
}
-/* fill_widgets handler for the task page */
+/* fill_widgets handler for the meeting page */
static void
meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
{
@@ -335,8 +335,9 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
}
gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings);
- if (organizer.value != NULL) {
- gchar *s = e_utf8_to_gtk_string (priv->existing_organizer, organizer.value);
+ if (organizer.value != NULL) {
+ const gchar *strip = itip_strip_mailto (organizer.value);
+ gchar *s = e_utf8_to_gtk_string (priv->existing_organizer, strip);
gtk_widget_hide (priv->organizer_table);
gtk_widget_show (priv->existing_organizer_table);
@@ -344,7 +345,7 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s);
g_free (s);
-
+
priv->existing = TRUE;
} else {
gtk_widget_hide (priv->other_organizer_lbl);
@@ -387,7 +388,7 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
priv->updating = FALSE;
}
-/* fill_component handler for the task page */
+/* fill_component handler for the meeting page */
static void
meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
{
@@ -448,8 +449,8 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
att->role = attendee->role;
att->status = attendee->status;
att->rsvp = attendee->rsvp;
- att->delto = attendee->delto;
- att->delfrom = attendee->delfrom;
+ att->delto = (attendee->delto && *attendee->delto) ? attendee->delto : NULL;
+ att->delfrom = (attendee->delfrom && *attendee->delfrom) ? attendee->delfrom : NULL;
att->sentby = attendee->sentby;
att->cn = (attendee->cn && *attendee->cn) ? attendee->cn : NULL;
att->language = (attendee->language && *attendee->language) ? attendee->language : NULL;
@@ -844,7 +845,7 @@ append_row (ETableModel *etm, ETableModel *model, int row, void *data)
attendee = g_new0 (struct attendee, 1);
- attendee->address = g_strdup (e_table_model_value_at (model, MEETING_ATTENDEE_COL, row));
+ attendee->address = g_strdup_printf ("MAILTO:%s", e_table_model_value_at (model, MEETING_ATTENDEE_COL, row));
attendee->member = g_strdup (e_table_model_value_at (model, MEETING_MEMBER_COL, row));
attendee->cutype = text_to_type (e_table_model_value_at (model, MEETING_TYPE_COL, row));
attendee->role = text_to_role (e_table_model_value_at (model, MEETING_ROLE_COL, row));
@@ -878,7 +879,7 @@ value_at (ETableModel *etm, int col, int row, void *data)
switch (col) {
case MEETING_ATTENDEE_COL:
- return attendee->address;
+ return itip_strip_mailto (attendee->address);
case MEETING_MEMBER_COL:
return attendee->member;
case MEETING_TYPE_COL:
@@ -918,7 +919,7 @@ set_value_at (ETableModel *etm, int col, int row, const void *val, void *data)
case MEETING_ATTENDEE_COL:
if (attendee->address)
g_free (attendee->address);
- attendee->address = g_strdup (val);
+ attendee->address = g_strdup_printf ("MAILTO:%s", val);
break;
case MEETING_MEMBER_COL:
if (attendee->member)
@@ -1014,7 +1015,7 @@ init_value (ETableModel *etm, int col, void *data)
case MEETING_CN_COL:
return g_strdup ("");
case MEETING_LANG_COL:
- return g_strdup ("English");
+ return g_strdup ("en");
}
return g_strdup ("");
diff --git a/calendar/gui/dialogs/meeting-page.etspec b/calendar/gui/dialogs/meeting-page.etspec
index 7ab7d8995c..da49873e61 100644
--- a/calendar/gui/dialogs/meeting-page.etspec
+++ b/calendar/gui/dialogs/meeting-page.etspec
@@ -4,16 +4,18 @@
<ETableColumn model_col= "2" _title="Type" expansion="1.0" minimum_width="10" resizable="true" cell="typeedit" compare="string"/>
<ETableColumn model_col= "3" _title="Role" expansion="1.0" minimum_width="10" resizable="true" cell="roleedit" compare="string"/>
<ETableColumn model_col= "4" _title="RSVP" expansion="1.0" minimum_width="10" resizable="true" cell="rsvpedit" compare="string"/>
- <ETableColumn model_col= "5" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="statusedit" compare="string"/>
- <ETableColumn model_col= "6" _title="Common Name" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "7" _title="Language" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "5" _title="Delegated To" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "6" _title="Delegated From" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "7" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="statusedit" compare="string"/>
+ <ETableColumn model_col= "8" _title="Common Name" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "9" _title="Language" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
<ETableState>
<column source="0"/>
<column source="2"/>
<column source="3"/>
<column source="4"/>
- <column source="5"/>
+ <column source="7"/>
<grouping></grouping>
</ETableState>
-</ETableSpecification> \ No newline at end of file
+</ETableSpecification>
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 3d82632adc..8a919cb97c 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -66,6 +66,7 @@ struct _EItipControlPrivate {
int current;
int total;
+ GList *addresses;
gchar *from_address;
gchar *my_address;
};
@@ -254,6 +255,9 @@ init (EItipControl *itip)
itip->priv = priv;
+ /* Addresses */
+ priv->addresses = itip_addresses_get ();
+
/* Header */
priv->count = gtk_label_new ("0 of 0");
gtk_widget_show (priv->count);
@@ -341,6 +345,8 @@ destroy (GtkObject *obj)
priv = itip->priv;
+ itip_addresses_free (priv->addresses);
+
g_free (priv);
}
@@ -350,6 +356,42 @@ e_itip_control_new (void)
return gtk_type_new (E_TYPE_ITIP_CONTROL);
}
+static void
+find_my_address (EItipControl *itip, icalcomponent *ical_comp)
+{
+ EItipControlPrivate *priv;
+ icalproperty *prop;
+ const char *attendee, *text;
+ icalvalue *value;
+
+ priv = itip->priv;
+
+ for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
+ prop != NULL;
+ prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY))
+ {
+ GList *l;
+
+ value = icalproperty_get_value (prop);
+ if (!value)
+ continue;
+
+ attendee = icalvalue_get_string (value);
+
+ attendee = icalvalue_get_string (value);
+
+ text = itip_strip_mailto (attendee);
+ for (l = priv->addresses; l != NULL; l = l->next) {
+ ItipAddress *a = l->data;
+
+ if (strcmp (a->address, text)) {
+ priv->my_address = a->address;
+ return;
+ }
+ }
+ }
+}
+
static icalproperty *
find_attendee (icalcomponent *ical_comp, char *address)
{
@@ -369,13 +411,7 @@ find_attendee (icalcomponent *ical_comp, char *address)
attendee = icalvalue_get_string (value);
- /* Here I strip off the "MAILTO:" if it is present. */
- text = strchr (attendee, ':');
- if (text != NULL)
- text++;
- else
- text = attendee;
-
+ text = itip_strip_mailto (attendee);
if (!strstr (text, address))
break;
}
@@ -630,6 +666,7 @@ show_current_event (EItipControl *itip)
default:
set_message (itip, _("The message is not understandable."), TRUE);
}
+
}
static void
@@ -736,6 +773,8 @@ show_current (EItipControl *itip)
default:
set_message (itip, _("The message contains only unsupported requests."), TRUE);
}
+
+ find_my_address (itip, priv->ical_comp);
}
void
@@ -823,31 +862,6 @@ e_itip_control_get_from_address (EItipControl *itip)
return priv->from_address;
}
-
-void
-e_itip_control_set_my_address (EItipControl *itip, const gchar *address)
-{
- EItipControlPrivate *priv;
-
- priv = itip->priv;
-
- if (priv->my_address)
- g_free (priv->my_address);
-
- priv->my_address = g_strdup (address);
-}
-
-const gchar *
-e_itip_control_get_my_address (EItipControl *itip)
-{
- EItipControlPrivate *priv;
-
- priv = itip->priv;
-
- return priv->my_address;
-}
-
-
static void
update_item (EItipControl *itip)
{
diff --git a/calendar/gui/e-itip-control.h b/calendar/gui/e-itip-control.h
index afad2b744d..a195161f17 100644
--- a/calendar/gui/e-itip-control.h
+++ b/calendar/gui/e-itip-control.h
@@ -67,10 +67,6 @@ gint e_itip_control_get_data_size (EItipControl *itip);
void e_itip_control_set_from_address (EItipControl *itip,
const gchar *address);
const gchar *e_itip_control_get_from_address (EItipControl *itip);
-void e_itip_control_set_my_address (EItipControl *itip,
- const gchar *address);
-const gchar *e_itip_control_get_my_address (EItipControl *itip);
-
#ifdef __cplusplus
}
diff --git a/calendar/gui/itip-bonobo-control.c b/calendar/gui/itip-bonobo-control.c
index b76e07bfb7..9c8068bde0 100644
--- a/calendar/gui/itip-bonobo-control.c
+++ b/calendar/gui/itip-bonobo-control.c
@@ -40,7 +40,6 @@ extern gchar *evolution_dir;
enum E_ITIP_BONOBO_ARGS {
FROM_ADDRESS_ARG_ID,
- MY_ADDRESS_ARG_ID
};
/*
@@ -182,9 +181,6 @@ get_prop (BonoboPropertyBag *bag,
case FROM_ADDRESS_ARG_ID:
BONOBO_ARG_SET_STRING (arg, e_itip_control_get_from_address (itip));
break;
- case MY_ADDRESS_ARG_ID:
- BONOBO_ARG_SET_STRING (arg, e_itip_control_get_my_address (itip));
- break;
}
}
@@ -201,9 +197,6 @@ set_prop ( BonoboPropertyBag *bag,
case FROM_ADDRESS_ARG_ID:
e_itip_control_set_from_address (itip, BONOBO_ARG_GET_STRING (arg));
break;
- case MY_ADDRESS_ARG_ID:
- e_itip_control_set_my_address (itip, BONOBO_ARG_GET_STRING (arg));
- break;
}
}
@@ -224,8 +217,6 @@ itip_control_factory (BonoboGenericFactory *Factory, void *closure)
prop_bag = bonobo_property_bag_new (get_prop, set_prop, itip);
bonobo_property_bag_add (prop_bag, "from_address", FROM_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
"from_address", 0 );
- bonobo_property_bag_add (prop_bag, "my_address", MY_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
- "my_address", 0 );
bonobo_control_set_properties (control, prop_bag);
bonobo_object_unref (BONOBO_OBJECT (prop_bag));
diff --git a/calendar/gui/itip-control-factory.c b/calendar/gui/itip-control-factory.c
index b76e07bfb7..9c8068bde0 100644
--- a/calendar/gui/itip-control-factory.c
+++ b/calendar/gui/itip-control-factory.c
@@ -40,7 +40,6 @@ extern gchar *evolution_dir;
enum E_ITIP_BONOBO_ARGS {
FROM_ADDRESS_ARG_ID,
- MY_ADDRESS_ARG_ID
};
/*
@@ -182,9 +181,6 @@ get_prop (BonoboPropertyBag *bag,
case FROM_ADDRESS_ARG_ID:
BONOBO_ARG_SET_STRING (arg, e_itip_control_get_from_address (itip));
break;
- case MY_ADDRESS_ARG_ID:
- BONOBO_ARG_SET_STRING (arg, e_itip_control_get_my_address (itip));
- break;
}
}
@@ -201,9 +197,6 @@ set_prop ( BonoboPropertyBag *bag,
case FROM_ADDRESS_ARG_ID:
e_itip_control_set_from_address (itip, BONOBO_ARG_GET_STRING (arg));
break;
- case MY_ADDRESS_ARG_ID:
- e_itip_control_set_my_address (itip, BONOBO_ARG_GET_STRING (arg));
- break;
}
}
@@ -224,8 +217,6 @@ itip_control_factory (BonoboGenericFactory *Factory, void *closure)
prop_bag = bonobo_property_bag_new (get_prop, set_prop, itip);
bonobo_property_bag_add (prop_bag, "from_address", FROM_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
"from_address", 0 );
- bonobo_property_bag_add (prop_bag, "my_address", MY_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
- "my_address", 0 );
bonobo_control_set_properties (control, prop_bag);
bonobo_object_unref (BONOBO_OBJECT (prop_bag));
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 5c0f040812..3108264163 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -31,6 +31,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <gtk/gtkwidget.h>
+#include <gal/util/e-util.h>
#include <ical.h>
#include <Evolution-Composer.h>
#include "itip-utils.h"
@@ -146,6 +147,21 @@ itip_addresses_free (GList *addresses)
g_list_free (addresses);
}
+const gchar *
+itip_strip_mailto (const gchar *address)
+{
+ const gchar *text;
+
+ if (address == NULL)
+ return NULL;
+
+ text = e_strstrcase (address, "mailto:");
+ if (text != NULL && strlen (address) > 7)
+ address += 7;
+
+ return address;
+}
+
void
itip_send_comp (CalComponentItipMethod method, CalComponent *comp)
{
@@ -174,11 +190,6 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp)
composer_server = BONOBO_OBJREF (bonobo_server);
switch (method) {
- case CAL_COMPONENT_METHOD_PUBLISH:
- to_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- to_list->_maximum = to_list->_length = 0;
- break;
-
case CAL_COMPONENT_METHOD_REQUEST:
case CAL_COMPONENT_METHOD_CANCEL:
cal_component_get_attendee_list (comp, &attendees);
@@ -191,13 +202,14 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp)
for (cntr = 0, l = attendees; cntr < len; cntr++, l = l->next) {
CalComponentAttendee *att = l->data;
+ gchar *real;
recipient = &(to_list->_buffer[cntr]);
if (att->cn)
recipient->name = CORBA_string_dup (att->cn);
else
recipient->name = CORBA_string_dup ("");
- recipient->address = CORBA_string_dup (att->value);
+ recipient->address = CORBA_string_dup (itip_strip_mailto (att->value));
}
break;
@@ -226,6 +238,11 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp)
recipient->name = CORBA_string_dup ("");
recipient->address = CORBA_string_dup (organizer.value);
break;
+
+ default:
+ to_list = GNOME_Evolution_Composer_RecipientList__alloc ();
+ to_list->_maximum = to_list->_length = 0;
+ break;
}
cc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index fcf53aada6..9a8fe330b6 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -30,6 +30,8 @@ typedef struct {
GList *itip_addresses_get (void);
void itip_addresses_free (GList *addresses);
+const gchar *itip_strip_mailto (const gchar *address);
+
void itip_send_comp (CalComponentItipMethod method, CalComponent *comp);