about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--varuga.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/varuga.el b/varuga.el
index 16c3f6e..2b6776d 100644
--- a/varuga.el
+++ b/varuga.el
@@ -75,9 +75,10 @@
 (defvar varuga-time-format
   world-clock-time-format)
 
-(defun varuga-insert-calendar-line (key value)
+(defun varuga-insert-calendar-line (key value &optional params)
   "Insert ical calendar line.
-KEY is the name of the ical property and VALUE is its value."
+KEY is the name of the ical property and VALUE is its value.
+PARAMS is an alist of ical property parameters and their values."
   ;; Limit content line length to 75 octets as required by RFC 5545.
   (let ((maximum-octets-per-line 75)
         (octets-so-far 0))
@@ -95,8 +96,14 @@ KEY is the name of the ical property and VALUE is its value."
                   ;; the folding space.
                   (setq octets-so-far (1+ (string-bytes str))))
                 (insert str)))
-            (format "%s:%s"
+            (format "%s%s:%s"
                     (upcase (symbol-name key))
+                    (seq-mapcat (pcase-lambda (`(,key . ,value))
+                                  (format ";%s=%s"
+                                          (upcase (symbol-name key))
+                                          value))
+                                params
+                                'string)
                     value)))
   (insert "\n"))
 
@@ -111,9 +118,9 @@ KEY is the name of the ical property and VALUE is its value."
   (varuga-insert-calendar-line 'dtstamp
                                (varuga-format-time-string (current-time)))
   (varuga-insert-calendar-line 'organizer
-                               (format "CN=%s:MAILTO:%s"
-                                       (varuga-calendar-event-organizer event)
-                                       (varuga-calendar-event-organizer-email-address event)))
+                               (format "MAILTO:%s"
+                                       (varuga-calendar-event-organizer-email-address event))
+                               `((cn . ,(varuga-calendar-event-organizer event))))
   (varuga-insert-calendar-line 'dtstart
                                (varuga-format-time-string
                                 (varuga-calendar-event-time-start event)))