* [PATCH] Support vcal format timezones
@ 2014-10-11 23:56 Sylvain Chouleur
2014-10-13 11:14 ` Magnus Henoch
2014-10-14 19:46 ` Ted Zlatanov
0 siblings, 2 replies; 5+ messages in thread
From: Sylvain Chouleur @ 2014-10-11 23:56 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Hi all,
here is a patch proposal in order to support icalendar timezones using
the RFC 5545 definition.
The code just reuse the icalendar.el functions
Cheers,
--
Sylvain
[-- Attachment #2: 0001-Support-vcal-format-timezones.patch --]
[-- Type: text/x-patch, Size: 2625 bytes --]
From c6a28512523defaad43e7a6367c5dc86255e3d8b Mon Sep 17 00:00:00 2001
From: Sylvain Chouleur <sylvain.chouleur@gmail.com>
Date: Thu, 9 Oct 2014 19:08:04 +0200
Subject: [PATCH] Support vcal format timezones
Old version only supported emacs known timezone.
Here we reuse icalendar code to extract timezone definition from
vcalendar format
Signed-off-by: Sylvain Chouleur <sylvain.chouleur@gmail.com>
---
lisp/gnus-icalendar.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 3362cc878110..a9e4a24c93b0 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)
--
2.1.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Support vcal format timezones
2014-10-11 23:56 [PATCH] Support vcal format timezones Sylvain Chouleur
@ 2014-10-13 11:14 ` Magnus Henoch
2014-10-14 19:46 ` Ted Zlatanov
1 sibling, 0 replies; 5+ messages in thread
From: Magnus Henoch @ 2014-10-13 11:14 UTC (permalink / raw)
To: Sylvain Chouleur; +Cc: ding
Sylvain Chouleur <sylvain.chouleur@gmail.com> writes:
> Hi all,
>
> here is a patch proposal in order to support icalendar timezones using
> the RFC 5545 definition.
> The code just reuse the icalendar.el functions
By a strange coincidence, just today I got an icalendar event invite
that would export to Org incorrectly because gnus-icalendar wouldn't
interpret the timezone definition. With your patch, it gets the time
right. Thanks!
Regards,
Magnus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Support vcal format timezones
2014-10-11 23:56 [PATCH] Support vcal format timezones Sylvain Chouleur
2014-10-13 11:14 ` Magnus Henoch
@ 2014-10-14 19:46 ` Ted Zlatanov
2014-10-15 19:50 ` Sylvain Chouleur
1 sibling, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2014-10-14 19:46 UTC (permalink / raw)
To: ding
On Sun, 12 Oct 2014 01:56:00 +0200 Sylvain Chouleur <sylvain.chouleur@gmail.com> wrote:
SC> here is a patch proposal in order to support icalendar timezones using
SC> the RFC 5545 definition.
SC> The code just reuse the icalendar.el functions
Cool. It's just above the tiny change threshold of 10 lines! I can try
to squeeze it into 10 lines if you don't have the copyright assignment
papers?
Also if you could provide a proper ChangeLog entry, it would be helpful.
Thanks
Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Support vcal format timezones
2014-10-14 19:46 ` Ted Zlatanov
@ 2014-10-15 19:50 ` Sylvain Chouleur
2014-10-16 12:42 ` Ted Zlatanov
0 siblings, 1 reply; 5+ messages in thread
From: Sylvain Chouleur @ 2014-10-15 19:50 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
Hi, my FSF assignment is in process.
here is the updated patch with Changelog entry
--
Sylvain
2014-10-14 21:46 GMT+02:00 Ted Zlatanov <tzz@lifelogs.com>:
> On Sun, 12 Oct 2014 01:56:00 +0200 Sylvain Chouleur <sylvain.chouleur@gmail.com> wrote:
>
> SC> here is a patch proposal in order to support icalendar timezones using
> SC> the RFC 5545 definition.
> SC> The code just reuse the icalendar.el functions
>
> Cool. It's just above the tiny change threshold of 10 lines! I can try
> to squeeze it into 10 lines if you don't have the copyright assignment
> papers?
>
> Also if you could provide a proper ChangeLog entry, it would be helpful.
>
> Thanks
> Ted
>
>
[-- Attachment #2: 0001-Support-vcal-format-timezones.patch --]
[-- Type: text/x-patch, Size: 3218 bytes --]
From 9a697b41cb2ad5dc7bf39553274638b346cdb894 Mon Sep 17 00:00:00 2001
From: Sylvain Chouleur <sylvain.chouleur@gmail.com>
Date: Thu, 9 Oct 2014 19:08:04 +0200
Subject: [PATCH] Support vcal format timezones
Old version only supported emacs known timezone.
Here we reuse icalendar code to extract timezone definition from
vcalendar format
Signed-off-by: Sylvain Chouleur <sylvain.chouleur@gmail.com>
---
lisp/ChangeLog | 7 +++++++
lisp/gnus-icalendar.el | 18 ++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 214a8bf3eb4c..b872ca665595 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-15 Sylvain Chouleur <sylvain.chouleur@gmail.com>
+
+ * 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 <tzz@lifelogs.com>
* 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 3362cc878110..a9e4a24c93b0 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)
--
2.1.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Support vcal format timezones
2014-10-15 19:50 ` Sylvain Chouleur
@ 2014-10-16 12:42 ` Ted Zlatanov
0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2014-10-16 12:42 UTC (permalink / raw)
To: ding
On Wed, 15 Oct 2014 21:50:51 +0200 Sylvain Chouleur <sylvain.chouleur@gmail.com> wrote:
SC> Hi, my FSF assignment is in process.
SC> here is the updated patch with Changelog entry
Cool, thanks. Applied.
Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-16 12:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11 23:56 [PATCH] Support vcal format timezones Sylvain Chouleur
2014-10-13 11:14 ` Magnus Henoch
2014-10-14 19:46 ` Ted Zlatanov
2014-10-15 19:50 ` Sylvain Chouleur
2014-10-16 12:42 ` Ted Zlatanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).