[balsa] iTIP calendar reply compatibility improvement



commit 2030fa72b7d06ac2b381f33f62aafd76e6dfc027
Author: Albrecht Dreß <albrecht dress arcor de>
Date:   Sat Jun 13 12:02:52 2020 +0200

    iTIP calendar reply compatibility improvement
    
    Although not being required by RFC 5546, it appears that some
    applications (inter alia M$ Exchange) have less problems dealing with
    well-formed iTIP replies when the CN parameters of the "ORGINIZER" and
    "ATTENDEE" items are set properly.
    
    Details:
    - libbalsa/rfc2445.[ch]: pass the InternetAddress of the sender to
    libbalsa_vevent_reply(), add CN parameters if applicable
    - src/balsa-mime-widget-vcalendar.c: use new api as above
    
    Signed-off-by: Albrecht Dreß <albrecht dress arcor de>

 libbalsa/rfc2445.c                | 15 ++++++++-------
 libbalsa/rfc2445.h                |  2 +-
 src/balsa-mime-widget-vcalendar.c |  2 +-
 3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/libbalsa/rfc2445.c b/libbalsa/rfc2445.c
index 5ba3e3c23..947e10cc5 100644
--- a/libbalsa/rfc2445.c
+++ b/libbalsa/rfc2445.c
@@ -866,7 +866,7 @@ libbalsa_vevent_recurrence_str(LibBalsaVEvent *event, const gchar *format_str)
  */
 gchar *
 libbalsa_vevent_reply(const LibBalsaVEvent   *event,
-                                         const gchar            *sender,
+                                         InternetAddress        *sender,
                                          icalparameter_partstat  new_stat)
 {
        icalcomponent *reply;
@@ -892,9 +892,10 @@ libbalsa_vevent_reply(const LibBalsaVEvent   *event,
     icalcomponent_add_component(reply, ev_data);
 
     /* add ATTENDEE */
-    buf = g_strconcat("mailto:";, sender, NULL);
+    buf = g_strconcat("mailto:";, internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(sender)), NULL);
     prop = icalproperty_new_attendee(buf);
     g_free(buf);
+    icalproperty_add_parameter(prop, icalparameter_new_cn(internet_address_get_name(sender)));
     icalproperty_add_parameter(prop, icalparameter_new_partstat(new_stat));
     icalcomponent_add_property(ev_data, prop);
 
@@ -902,12 +903,12 @@ libbalsa_vevent_reply(const LibBalsaVEvent   *event,
     icalcomponent_add_property(ev_data, icalproperty_new_dtstamp(icaltime_current_time_with_zone(NULL)));
 
     /* add ORGANIZER - /should/ be present */
-    if (event->organizer != NULL) {
-        const gchar *addr = libbalsa_address_get_addr(event->organizer);
-
-        if (addr != NULL) {
-               icalcomponent_add_property(ev_data, icalproperty_new_organizer(addr));
+    if ((event->organizer != NULL) && (libbalsa_address_get_addr(event->organizer) != NULL)) {
+       prop = icalproperty_new_organizer(libbalsa_address_get_addr(event->organizer));
+       if (libbalsa_address_get_full_name(event->organizer) != NULL) {
+               icalproperty_add_parameter(prop, 
icalparameter_new_cn(libbalsa_address_get_full_name(event->organizer)));
         }
+       icalcomponent_add_property(ev_data, prop);
     }
 
     /* add RECURRENCE-ID (if present) */
diff --git a/libbalsa/rfc2445.h b/libbalsa/rfc2445.h
index 8a0ccc72a..01f18853f 100644
--- a/libbalsa/rfc2445.h
+++ b/libbalsa/rfc2445.h
@@ -51,7 +51,7 @@ typedef enum {
 LibBalsaVCal *libbalsa_vcal_new_from_body(LibBalsaMessageBody * body);
 
 gchar *libbalsa_vevent_reply(const LibBalsaVEvent   *event,
-                                                const gchar            *sender,
+                                                        InternetAddress        *sender,
                                                         icalparameter_partstat  new_stat);
 
 gchar *libbalsa_vcal_attendee_to_str(LibBalsaAddress *person);
diff --git a/src/balsa-mime-widget-vcalendar.c b/src/balsa-mime-widget-vcalendar.c
index 44d7120d2..2e8201bd0 100644
--- a/src/balsa-mime-widget-vcalendar.c
+++ b/src/balsa-mime-widget-vcalendar.c
@@ -386,7 +386,7 @@ vevent_reply(GObject * button, GtkWidget * box)
 
     /* the next message part is the calendar object */
     body = libbalsa_message_body_new(message);
-    body->buffer = libbalsa_vevent_reply(event, INTERNET_ADDRESS_MAILBOX(ia)->addr, pstat);
+    body->buffer = libbalsa_vevent_reply(event, ia, pstat);
     if (body->buffer == NULL) {
        g_object_unref(message);
        return;


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