[evolution] [itip-view] Do not duplicate X-MICROSOFT-CDO-REPLYTIME in replies



commit da0a7804639534fd2ccf1b87e2cabe473abc1ea1
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 26 12:43:00 2018 +0100

    [itip-view] Do not duplicate X-MICROSOFT-CDO-REPLYTIME in replies
    
    It could happen, in some cases, that the component had already set
    X-MICROSOFT-CDO-REPLYTIME property, in which case itip-view added
    a new property of the same name at the end. Rather than have there
    the duplicates (with different times), remove all existing first.

 src/modules/itip-formatter/itip-view.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 190b1fa56a..fa255a992d 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -4870,7 +4870,6 @@ update_item (ItipView *view,
              ItipViewResponse response)
 {
        struct icaltimetype stamp;
-       icalproperty *prop;
        icalcomponent *toplevel_clone, *clone;
        gboolean remove_alarms;
        ECalComponent *clone_comp;
@@ -4878,6 +4877,10 @@ update_item (ItipView *view,
 
        update_item_progress_info (view, _("Saving changes to the calendar. Please wait..."));
 
+       while (e_cal_util_remove_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME")) {
+               /* Delete all existing X-MICROSOFT-CDO-REPLYTIME properties first */
+       }
+
        /* Set X-MICROSOFT-CDO-REPLYTIME to record the time at which
         * the user accepted/declined the request. (Outlook ignores
         * SEQUENCE in REPLY reponses and instead requires that each
@@ -4889,10 +4892,8 @@ update_item (ItipView *view,
         */
        stamp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
        str = icaltime_as_ical_string_r (stamp);
-       prop = icalproperty_new_x (str);
+       e_cal_util_set_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME", str);
        g_free (str);
-       icalproperty_set_x_name (prop, "X-MICROSOFT-CDO-REPLYTIME");
-       icalcomponent_add_property (view->priv->ical_comp, prop);
 
        toplevel_clone = icalcomponent_new_clone (view->priv->top_level);
        clone = icalcomponent_new_clone (view->priv->ical_comp);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]