[gnus git] branch master updated: m0-11-57-gc409b87 =1= gnus-icalendar.el: Support vcal format timezones

Ted <[email protected]> Thu, 16 Oct 2014 14:42:28 +0200
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  c409b875b5d89126b60090822ce350f67e3e7fad (commit)
      from  3b44d0724366741786a96801d29ddd1c5b949a38 (commit)


- Log -----------------------------------------------------------------
commit c409b875b5d89126b60090822ce350f67e3e7fad
Author: Sylvain Chouleur <[email protected]>
Date:   Thu Oct 16 08:40:58 2014 -0400

    gnus-icalendar.el: Support vcal format timezones
    
    Old version only supported emacs known timezone.
    Here we reuse icalendar code to extract timezone definition from
    vcalendar format.
    
    * gnus-icalendar.el: Support vcal format timezones
    (gnus-icalendar-event--decode-datefield): use icalendar functions to
    compute dates with associated timezone
    (gnus-icalendar-event-from-ical): compute all timezones

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 214a8bf..b872ca6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-15  Sylvain Chouleur  <[email protected]>
+
+	* gnus-icalendar.el: Support vcal format timezones
+	(gnus-icalendar-event--decode-datefield): use icalendar functions to
+	compute dates with associated timezone
+	(gnus-icalendar-event-from-ical): compute all timezones
+
 2014-10-14  Teodor Zlatanov  <[email protected]>
 
 	* gnus-start.el (gnus-save-newsrc-file-check-timestamp): New option to
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 3362cc8..a9e4a24 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -141,12 +141,13 @@
 (defmethod gnus-icalendar-event:start ((event gnus-icalendar-event))
   (format-time-string "%Y-%m-%d %H:%M" (gnus-icalendar-event:start-time event)))
 
-(defun gnus-icalendar-event--decode-datefield (ical field)
-  (let* ((date (icalendar--get-event-property ical field))
-         (date-props (icalendar--get-event-property-attributes ical field))
-         (tz (plist-get date-props 'TZID)))
-
-    (date-to-time (timezone-make-date-arpa-standard date nil tz))))
+(defun gnus-icalendar-event--decode-datefield (event field zone-map)
+  (let* ((dtdate (icalendar--get-event-property event field))
+         (dtdate-zone (icalendar--find-time-zone
+                       (icalendar--get-event-property-attributes
+                        event field) zone-map))
+         (dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone)))
+    (apply 'encode-time dtdate-dec)))
 
 (defun gnus-icalendar-event--find-attendee (ical name-or-email)
   (let* ((event (car (icalendar--all-events ical)))
@@ -204,10 +205,11 @@
                               ("REQ-PARTICIPANT" 'required)
                               ("OPT-PARTICIPANT" 'optional)
                               (_                 'non-participant)))
+         (zone-map (icalendar--convert-all-timezones ical))
          (args (list :method method
                      :organizer organizer
-                     :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART)
-                     :end-time (gnus-icalendar-event--decode-datefield event 'DTEND)
+                     :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART zone-map)
+                     :end-time (gnus-icalendar-event--decode-datefield event 'DTEND zone-map)
                      :rsvp (string= (plist-get (cadr attendee) 'RSVP) "TRUE")
                      :participation-type participation-type
                      :req-participants (car attendee-names)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog         |    7 +++++++
 lisp/gnus-icalendar.el |   18 ++++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project