diff options
| author | Jan Tatarik | 2013-11-28 23:33:52 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-11-28 23:33:52 +0000 |
| commit | 42e510608fd1192226fc9737162905b4abc62167 (patch) | |
| tree | 8e6fed51106cd78f4ebd00668d3ad0ea2c1c4833 | |
| parent | 655ab9a380068143cfb9a31d01488e83676d81c1 (diff) | |
| download | emacs-42e510608fd1192226fc9737162905b4abc62167.tar.gz emacs-42e510608fd1192226fc9737162905b4abc62167.zip | |
lisp/gnus/gnus-icalendar.el: bugfix and improvements
| -rw-r--r-- | lisp/gnus/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/gnus/gnus-icalendar.el | 33 |
2 files changed, 28 insertions, 14 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index bea916187bf..668a4eb3af6 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2013-11-28 Jan Tatarik <jan.tatarik@gmail.com> | ||
| 2 | |||
| 3 | * gnus-icalendar.el (gnus-icalendar-event-from-ical) | ||
| 4 | (gnus-icalendar-event->org-entry) | ||
| 5 | (gnus-icalendar--update-org-event) | ||
| 6 | (gnus-icalendar-event->gnus-calendar): Distinguish between | ||
| 7 | required/optional/non-participant attendee status. Fix bug causing | ||
| 8 | the first required event participant to be omitted. | ||
| 9 | |||
| 1 | 2013-11-27 Katsumi Yamaoka <yamaoka@jpl.org> | 10 | 2013-11-27 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 11 | ||
| 3 | * gnus-art.el (article-de-quoted-unreadable) | 12 | * gnus-art.el (article-de-quoted-unreadable) |
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 56c56f3dd46..5f152921b66 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el | |||
| @@ -92,10 +92,10 @@ | |||
| 92 | :accessor gnus-icalendar-event:rsvp | 92 | :accessor gnus-icalendar-event:rsvp |
| 93 | :initform nil | 93 | :initform nil |
| 94 | :type (or null boolean)) | 94 | :type (or null boolean)) |
| 95 | (participation-required :initarg :participation-required | 95 | (participation-type :initarg :participation-type |
| 96 | :accessor gnus-icalendar-event:participation-required | 96 | :accessor gnus-icalendar-event:participation-type |
| 97 | :initform t | 97 | :initform 'non-participant |
| 98 | :type (or null boolean)) | 98 | :type (or null t)) |
| 99 | (req-participants :initarg :req-participants | 99 | (req-participants :initarg :req-participants |
| 100 | :accessor gnus-icalendar-event:req-participants | 100 | :accessor gnus-icalendar-event:req-participants |
| 101 | :initform nil | 101 | :initform nil |
| @@ -196,15 +196,18 @@ | |||
| 196 | (attendee (when attendee-name-or-email | 196 | (attendee (when attendee-name-or-email |
| 197 | (gnus-icalendar-event--find-attendee ical attendee-name-or-email))) | 197 | (gnus-icalendar-event--find-attendee ical attendee-name-or-email))) |
| 198 | (attendee-names (gnus-icalendar-event--get-attendee-names ical)) | 198 | (attendee-names (gnus-icalendar-event--get-attendee-names ical)) |
| 199 | (role (plist-get (cadr attendee) 'ROLE)) | ||
| 200 | (participation-type (pcase role | ||
| 201 | ("REQ-PARTICIPANT" 'required) | ||
| 202 | ("OPT-PARTICIPANT" 'optional) | ||
| 203 | (_ 'non-participant))) | ||
| 199 | (args (list :method method | 204 | (args (list :method method |
| 200 | :organizer organizer | 205 | :organizer organizer |
| 201 | :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART) | 206 | :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART) |
| 202 | :end-time (gnus-icalendar-event--decode-datefield event 'DTEND) | 207 | :end-time (gnus-icalendar-event--decode-datefield event 'DTEND) |
| 203 | :rsvp (string= (plist-get (cadr attendee) 'RSVP) | 208 | :rsvp (string= (plist-get (cadr attendee) 'RSVP) "TRUE") |
| 204 | "TRUE") | 209 | :participation-type participation-type |
| 205 | :participation-required (string= (plist-get (cadr attendee) 'ROLE) | 210 | :req-participants (car attendee-names) |
| 206 | "REQ-PARTICIPANT") | ||
| 207 | :req-participants (cdar attendee-names) | ||
| 208 | :opt-participants (cadr attendee-names))) | 211 | :opt-participants (cadr attendee-names))) |
| 209 | (event-class (cond | 212 | (event-class (cond |
| 210 | ((string= method "REQUEST") 'gnus-icalendar-event-request) | 213 | ((string= method "REQUEST") 'gnus-icalendar-event-request) |
| @@ -451,7 +454,7 @@ Return nil for non-recurring EVENT." | |||
| 451 | ("DT" . ,(gnus-icalendar-event:org-timestamp event)) | 454 | ("DT" . ,(gnus-icalendar-event:org-timestamp event)) |
| 452 | ("ORGANIZER" . ,(gnus-icalendar-event:organizer event)) | 455 | ("ORGANIZER" . ,(gnus-icalendar-event:organizer event)) |
| 453 | ("LOCATION" . ,(gnus-icalendar-event:location event)) | 456 | ("LOCATION" . ,(gnus-icalendar-event:location event)) |
| 454 | ("PARTICIPATION_REQUIRED" . ,(when (gnus-icalendar-event:participation-required event) "t")) | 457 | ("PARTICIPATION_TYPE" . ,(symbol-name (gnus-icalendar-event:participation-type event))) |
| 455 | ("REQ_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:req-participants event))) | 458 | ("REQ_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:req-participants event))) |
| 456 | ("OPT_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:opt-participants event))) | 459 | ("OPT_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:opt-participants event))) |
| 457 | ("RRULE" . ,(gnus-icalendar-event:recur event)) | 460 | ("RRULE" . ,(gnus-icalendar-event:recur event)) |
| @@ -513,7 +516,7 @@ is searched." | |||
| 513 | (when file | 516 | (when file |
| 514 | (with-current-buffer (find-file-noselect file) | 517 | (with-current-buffer (find-file-noselect file) |
| 515 | (with-slots (uid summary description organizer location recur | 518 | (with-slots (uid summary description organizer location recur |
| 516 | participation-required req-participants opt-participants) event | 519 | participation-type req-participants opt-participants) event |
| 517 | (let ((event-pos (org-find-entry-with-id uid))) | 520 | (let ((event-pos (org-find-entry-with-id uid))) |
| 518 | (when event-pos | 521 | (when event-pos |
| 519 | (goto-char event-pos) | 522 | (goto-char event-pos) |
| @@ -555,7 +558,7 @@ is searched." | |||
| 555 | (org-entry-put event-pos "DT" (gnus-icalendar-event:org-timestamp event)) | 558 | (org-entry-put event-pos "DT" (gnus-icalendar-event:org-timestamp event)) |
| 556 | (org-entry-put event-pos "ORGANIZER" organizer) | 559 | (org-entry-put event-pos "ORGANIZER" organizer) |
| 557 | (org-entry-put event-pos "LOCATION" location) | 560 | (org-entry-put event-pos "LOCATION" location) |
| 558 | (org-entry-put event-pos "PARTICIPATION_REQUIRED" (when participation-required "t")) | 561 | (org-entry-put event-pos "PARTICIPATION_TYPE" (symbol-name participation-type)) |
| 559 | (org-entry-put event-pos "REQ_PARTICIPANTS" (gnus-icalendar--format-participant-list req-participants)) | 562 | (org-entry-put event-pos "REQ_PARTICIPANTS" (gnus-icalendar--format-participant-list req-participants)) |
| 560 | (org-entry-put event-pos "OPT_PARTICIPANTS" (gnus-icalendar--format-participant-list opt-participants)) | 563 | (org-entry-put event-pos "OPT_PARTICIPANTS" (gnus-icalendar--format-participant-list opt-participants)) |
| 561 | (org-entry-put event-pos "RRULE" recur) | 564 | (org-entry-put event-pos "RRULE" recur) |
| @@ -691,12 +694,14 @@ only makes sense to define names or email addresses." | |||
| 691 | (cadr x)))) | 694 | (cadr x)))) |
| 692 | 695 | ||
| 693 | (with-slots (organizer summary description location recur uid | 696 | (with-slots (organizer summary description location recur uid |
| 694 | method rsvp participation-required) event | 697 | method rsvp participation-type) event |
| 695 | (let ((headers `(("Summary" ,summary) | 698 | (let ((headers `(("Summary" ,summary) |
| 696 | ("Location" ,(or location "")) | 699 | ("Location" ,(or location "")) |
| 697 | ("Time" ,(gnus-icalendar-event:org-timestamp event)) | 700 | ("Time" ,(gnus-icalendar-event:org-timestamp event)) |
| 698 | ("Organizer" ,organizer) | 701 | ("Organizer" ,organizer) |
| 699 | ("Attendance" ,(if participation-required "Required" "Optional")) | 702 | ("Attendance" ,(if (eq participation-type 'non-participant) |
| 703 | "You are not listed as an attendee" | ||
| 704 | (capitalize (symbol-name participation-type)))) | ||
| 700 | ("Method" ,method)))) | 705 | ("Method" ,method)))) |
| 701 | 706 | ||
| 702 | (when (and (not (gnus-icalendar-event-reply-p event)) rsvp) | 707 | (when (and (not (gnus-icalendar-event-reply-p event)) rsvp) |