[evolution] I#492 - [Calendar] Preserve the organizer/attendee SCHEDULE-STATUS parameter
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#492 - [Calendar] Preserve the organizer/attendee SCHEDULE-STATUS parameter
- Date: Tue, 18 Jun 2019 10:04:13 +0000 (UTC)
commit e6455398dec86d670976e8293899e5114ff27519
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 18 12:05:33 2019 +0200
I#492 - [Calendar] Preserve the organizer/attendee SCHEDULE-STATUS parameter
Closes https://gitlab.gnome.org/GNOME/evolution/issues/492
src/calendar/gui/e-comp-editor-page-general.c | 71 ++++-----------------------
src/calendar/gui/e-meeting-attendee.c | 25 +++++++++-
src/calendar/gui/e-meeting-attendee.h | 3 ++
src/calendar/gui/itip-utils.c | 29 +++++++++++
4 files changed, 65 insertions(+), 63 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-page-general.c b/src/calendar/gui/e-comp-editor-page-general.c
index e481fd8c78..250ef24307 100644
--- a/src/calendar/gui/e-comp-editor-page-general.c
+++ b/src/calendar/gui/e-comp-editor-page-general.c
@@ -1008,72 +1008,17 @@ ecep_general_fill_widgets (ECompEditorPage *page,
address = itip_strip_mailto (i_cal_property_get_attendee (prop));
if (address) {
EMeetingAttendee *attendee;
- ICalParameter *param;
-
- attendee = E_MEETING_ATTENDEE (e_meeting_attendee_new ());
-
- /* It is supposed to be together with the "mailto:" protocol */
- e_meeting_attendee_set_address (attendee, i_cal_property_get_attendee (prop));
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_MEMBER_PARAMETER);
- if (param) {
- e_meeting_attendee_set_member (attendee, i_cal_parameter_get_member (param));
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_CUTYPE_PARAMETER);
- if (param) {
- e_meeting_attendee_set_cutype (attendee, i_cal_parameter_get_cutype (param));
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_ROLE_PARAMETER);
- if (param) {
- e_meeting_attendee_set_role (attendee, i_cal_parameter_get_role (param));
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_RSVP_PARAMETER);
- if (param) {
- e_meeting_attendee_set_rsvp (attendee, i_cal_parameter_get_rsvp (param) ==
I_CAL_RSVP_TRUE);
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDTO_PARAMETER);
- if (param) {
- e_meeting_attendee_set_delto (attendee, i_cal_parameter_get_delegatedto
(param));
- g_object_unref (param);
- }
+ ECalComponentAttendee *comp_attendee;
- param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDFROM_PARAMETER);
- if (param) {
- e_meeting_attendee_set_delfrom (attendee, i_cal_parameter_get_delegatedfrom
(param));
- g_object_unref (param);
+ comp_attendee = e_cal_component_attendee_new_from_property (prop);
+ if (!comp_attendee) {
+ g_warn_if_reached ();
+ continue;
}
- param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
- if (param) {
- e_meeting_attendee_set_partstat (attendee, i_cal_parameter_get_partstat
(param));
- g_object_unref (param);
- }
+ attendee = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee
(comp_attendee));
- param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
- if (param) {
- e_meeting_attendee_set_sentby (attendee, i_cal_parameter_get_sentby (param));
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
- if (param) {
- e_meeting_attendee_set_cn (attendee, i_cal_parameter_get_cn (param));
- g_object_unref (param);
- }
-
- param = i_cal_property_get_first_parameter (prop, I_CAL_LANGUAGE_PARAMETER);
- if (param) {
- e_meeting_attendee_set_language (attendee, i_cal_parameter_get_language
(param));
- g_object_unref (param);
- }
+ e_cal_component_attendee_free (comp_attendee);
e_meeting_store_add_attendee (page_general->priv->meeting_store, attendee);
e_meeting_list_view_add_attendee_to_name_selector (attendees_list_view, attendee);
@@ -1251,6 +1196,8 @@ ecep_general_fill_component (ECompEditorPage *page,
i_cal_property_take_parameter (prop, param);
}
+ e_cal_component_parameter_bag_fill_property
(e_meeting_attendee_get_parameter_bag (attendee), prop);
+
i_cal_component_take_property (component, prop);
}
}
diff --git a/src/calendar/gui/e-meeting-attendee.c b/src/calendar/gui/e-meeting-attendee.c
index 133a0197c5..02a62d09f0 100644
--- a/src/calendar/gui/e-meeting-attendee.c
+++ b/src/calendar/gui/e-meeting-attendee.c
@@ -49,6 +49,8 @@ struct _EMeetingAttendeePrivate {
gchar *cn;
gchar *language;
+ ECalComponentParameterBag *parameter_bag;
+
EMeetingAttendeeEditLevel edit_level;
gboolean show_address;
@@ -145,6 +147,8 @@ e_meeting_attendee_finalize (GObject *object)
g_free (ia->priv->cn);
g_free (ia->priv->language);
+ e_cal_component_parameter_bag_free (ia->priv->parameter_bag);
+
g_array_free (ia->priv->busy_periods, TRUE);
/* Chain up to parent's finalize() method. */
@@ -193,6 +197,8 @@ e_meeting_attendee_init (EMeetingAttendee *ia)
ia->priv->cn = string_test (NULL);
ia->priv->language = string_test (NULL);
+ ia->priv->parameter_bag = e_cal_component_parameter_bag_new ();
+
ia->priv->edit_level = E_MEETING_ATTENDEE_EDIT_FULL;
ia->priv->show_address = FALSE;
ia->priv->has_calendar_info = FALSE;
@@ -241,6 +247,8 @@ e_meeting_attendee_new_from_e_cal_component_attendee (const ECalComponentAttende
e_meeting_attendee_set_sentby (ia, e_cal_component_attendee_get_sentby (ca));
e_meeting_attendee_set_cn (ia, e_cal_component_attendee_get_cn (ca));
e_meeting_attendee_set_language (ia, e_cal_component_attendee_get_language (ca));
+ e_cal_component_parameter_bag_assign (ia->priv->parameter_bag,
+ e_cal_component_attendee_get_parameter_bag (ca));
return G_OBJECT (ia);
}
@@ -248,9 +256,11 @@ e_meeting_attendee_new_from_e_cal_component_attendee (const ECalComponentAttende
ECalComponentAttendee *
e_meeting_attendee_as_e_cal_component_attendee (const EMeetingAttendee *ia)
{
+ ECalComponentAttendee *attendee;
+
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- return e_cal_component_attendee_new_full (
+ attendee = e_cal_component_attendee_new_full (
ia->priv->address,
string_is_set (ia->priv->member) ? ia->priv->member : NULL,
ia->priv->cutype,
@@ -262,6 +272,11 @@ e_meeting_attendee_as_e_cal_component_attendee (const EMeetingAttendee *ia)
string_is_set (ia->priv->sentby) ? ia->priv->sentby : NULL,
string_is_set (ia->priv->cn) ? ia->priv->cn : NULL,
string_is_set (ia->priv->language) ? ia->priv->language : NULL);
+
+ e_cal_component_parameter_bag_assign (e_cal_component_attendee_get_parameter_bag (attendee),
+ ia->priv->parameter_bag);
+
+ return attendee;
}
const gchar *
@@ -536,6 +551,14 @@ e_meeting_attendee_is_set_language (const EMeetingAttendee *ia)
return string_is_set (ia->priv->language);
}
+ECalComponentParameterBag *
+e_meeting_attendee_get_parameter_bag (const EMeetingAttendee *ia)
+{
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
+
+ return ia->priv->parameter_bag;
+}
+
EMeetingAttendeeType
e_meeting_attendee_get_atype (const EMeetingAttendee *ia)
{
diff --git a/src/calendar/gui/e-meeting-attendee.h b/src/calendar/gui/e-meeting-attendee.h
index 1e6bd839b6..d72af8a013 100644
--- a/src/calendar/gui/e-meeting-attendee.h
+++ b/src/calendar/gui/e-meeting-attendee.h
@@ -125,6 +125,9 @@ void e_meeting_attendee_set_language (EMeetingAttendee *ia,
const gchar *language);
gboolean e_meeting_attendee_is_set_language
(const EMeetingAttendee *ia);
+ECalComponentParameterBag *
+ e_meeting_attendee_get_parameter_bag
+ (const EMeetingAttendee *ia);
EMeetingAttendeeType
e_meeting_attendee_get_atype (const EMeetingAttendee *ia);
EMeetingAttendeeEditLevel
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index 172342640e..cba4c2e499 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -1613,6 +1613,33 @@ strip_x_microsoft_props (ECalComponent *comp)
g_slist_free_full (lst, g_object_unref);
}
+/* https://tools.ietf.org/html/rfc6638#section-7.3 */
+static void
+remove_schedule_status_parameters (ECalComponent *comp)
+{
+ ICalComponent *icomp;
+ ICalProperty *prop;
+
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
+
+ icomp = e_cal_component_get_icalcomponent (comp);
+
+ if (!icomp)
+ return;
+
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ORGANIZER_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_ORGANIZER_PROPERTY)) {
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_SCHEDULESTATUS_PARAMETER);
+ }
+
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_ATTENDEE_PROPERTY)) {
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_SCHEDULESTATUS_PARAMETER);
+ }
+}
+
static ECalComponent *
comp_compliant_one (ESourceRegistry *registry,
ECalComponentItipMethod method,
@@ -1751,6 +1778,8 @@ comp_compliant_one (ESourceRegistry *registry,
break;
}
+ remove_schedule_status_parameters (clone);
+
return clone;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]