From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83917 Path: news.gmane.org!not-for-mail From: Jan Tatarik Newsgroups: gmane.emacs.gnus.general Subject: PATCH: bugfix and improvements for gnus-icalendar Date: Mon, 25 Nov 2013 23:52:16 +0100 Message-ID: <87mwksgkm7.fsf@nb-jtatarik2.xing.hh> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1385419995 6213 80.91.229.3 (25 Nov 2013 22:53:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Nov 2013 22:53:15 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32172@lists.math.uh.edu Mon Nov 25 23:53:19 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vl51r-00008h-0U for ding-account@gmane.org; Mon, 25 Nov 2013 23:53:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Vl517-0003i6-1i; Mon, 25 Nov 2013 16:52:33 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Vl515-0003hx-Je for ding@lists.math.uh.edu; Mon, 25 Nov 2013 16:52:31 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1Vl513-00085o-Hl for ding@lists.math.uh.edu; Mon, 25 Nov 2013 16:52:31 -0600 Original-Received: from mail-bk0-f47.google.com ([209.85.214.47]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl512-0006rh-5G for ding@gnus.org; Mon, 25 Nov 2013 23:52:28 +0100 Original-Received: by mail-bk0-f47.google.com with SMTP id mx12so2263745bkb.34 for ; Mon, 25 Nov 2013 14:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=eC96GIbtV22K+EC4liMaWWM1Gqn+XCzDUR5/zQej2k0=; b=H9JRKiq0nEGsa75YSJ3P0WQqhN+5Af5w1t+60y2Z3I7uuZ1bi3HvuhigWutsUUaSBR LCc+CjUgKBitP2eDgKeBvpmRxAjbs3x3glZKDfVpOYG3N0mmn8Jvf0JfFXVSgNGd85Aq Z9xhogmkQQAzqk38H/OciDrZazoIzrTEwT/2fu1j5SgU5yq+mzJAgn/NCbziw9nuROOM H8y47tV50gXx5ta2NdC53vcTet21171MUOOilrcQfXZJQbaN0obru4l8q1UE9ehOXwQV OujYgglGllFkDeJn127jDdDBKpupI4BB50F/b2dl4ZQsZV6EodIgXjri10zGq/uY+iE3 KwKw== X-Received: by 10.205.76.133 with SMTP id ze5mr3208823bkb.37.1385419942030; Mon, 25 Nov 2013 14:52:22 -0800 (PST) Original-Received: from nb-jtatarik2.xing.hh (g224021199.adsl.alicedsl.de. [92.224.21.199]) by mx.google.com with ESMTPSA id z6sm48393755bkn.8.2013.11.25.14.52.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 25 Nov 2013 14:52:21 -0800 (PST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83917 Archived-At: --=-=-= Content-Type: text/plain Hi, the first patch fixes an issue with the list of required event participants that gets exported to org. The first required participant's name was being omitted by mistake. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=fix_req_participants.patch diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ac8fc5b5d3a905a73f07e8fe07e29eca6a76f24a..2d0a96cc7755bd70b9db952fece2744f9db05fa0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-11-25 Jan Tatarik + + * gnus-icalendar.el (gnus-icalendar-event-from-ical): Fix bug causing + the first required event participant to be omitted. + 2013-11-21 Jan Tatarik * gnus-icalendar.el (gnus-icalendar-additional-identities): New. diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el index 56c56f3dd466975da7b23edd257058ff63fb8bfd..ef7bdb890dd531b6f88d5fda7b2bd09eb7c8c3e7 100644 --- a/lisp/gnus-icalendar.el +++ b/lisp/gnus-icalendar.el @@ -204,7 +204,7 @@ "TRUE") :participation-required (string= (plist-get (cadr attendee) 'ROLE) "REQ-PARTICIPANT") - :req-participants (cdar attendee-names) + :req-participants (car attendee-names) :opt-participants (cadr attendee-names))) (event-class (cond ((string= method "REQUEST") 'gnus-icalendar-event-request) --=-=-= Content-Type: text/plain The second patch fixes an issue with calendar events for which the user is neither required nor optional participant. Both the article buffer and the org entry will now show the proper attendance status (required/optional/non-participant). --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=opt_reply.patch diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ac8fc5b5d3a905a73f07e8fe07e29eca6a76f24a..a81a5c73f4470e27c318fc3f3ddb3931b24a2f9a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-11-25 Jan Tatarik + + * gnus-icalendar.el (gnus-icalendar-event-from-ical) + (gnus-icalendar-event->org-entry) + (gnus-icalendar--update-org-event) + (gnus-icalendar-event->gnus-calendar): Distinguish between + required/optional/non-participant attendee status. + 2013-11-21 Jan Tatarik * gnus-icalendar.el (gnus-icalendar-additional-identities): New. diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el index 56c56f3dd466975da7b23edd257058ff63fb8bfd..35097f28a4edac83b13e4c167dcbd4ce6c090a2b 100644 --- a/lisp/gnus-icalendar.el +++ b/lisp/gnus-icalendar.el @@ -92,10 +92,10 @@ :accessor gnus-icalendar-event:rsvp :initform nil :type (or null boolean)) - (participation-required :initarg :participation-required - :accessor gnus-icalendar-event:participation-required - :initform t - :type (or null boolean)) + (participation-type :initarg :participation-type + :accessor gnus-icalendar-event:participation-type + :initform 'non-participant + :type (or null t)) (req-participants :initarg :req-participants :accessor gnus-icalendar-event:req-participants :initform nil @@ -196,14 +196,17 @@ (attendee (when attendee-name-or-email (gnus-icalendar-event--find-attendee ical attendee-name-or-email))) (attendee-names (gnus-icalendar-event--get-attendee-names ical)) + (role (plist-get (cadr attendee) 'ROLE)) + (participation-type (pcase role + ("REQ-PARTICIPANT" 'required) + ("OPT-PARTICIPANT" 'optional) + (_ 'non-participant))) (args (list :method method :organizer organizer :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART) :end-time (gnus-icalendar-event--decode-datefield event 'DTEND) - :rsvp (string= (plist-get (cadr attendee) 'RSVP) - "TRUE") - :participation-required (string= (plist-get (cadr attendee) 'ROLE) - "REQ-PARTICIPANT") + :rsvp (string= (plist-get (cadr attendee) 'RSVP) "TRUE") + :participation-type participation-type :req-participants (cdar attendee-names) :opt-participants (cadr attendee-names))) (event-class (cond @@ -451,7 +454,7 @@ Return nil for non-recurring EVENT." ("DT" . ,(gnus-icalendar-event:org-timestamp event)) ("ORGANIZER" . ,(gnus-icalendar-event:organizer event)) ("LOCATION" . ,(gnus-icalendar-event:location event)) - ("PARTICIPATION_REQUIRED" . ,(when (gnus-icalendar-event:participation-required event) "t")) + ("PARTICIPATION_TYPE" . ,(symbol-name (gnus-icalendar-event:participation-type event))) ("REQ_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:req-participants event))) ("OPT_PARTICIPANTS" . ,(gnus-icalendar--format-participant-list (gnus-icalendar-event:opt-participants event))) ("RRULE" . ,(gnus-icalendar-event:recur event)) @@ -513,7 +516,7 @@ is searched." (when file (with-current-buffer (find-file-noselect file) (with-slots (uid summary description organizer location recur - participation-required req-participants opt-participants) event + participation-type req-participants opt-participants) event (let ((event-pos (org-find-entry-with-id uid))) (when event-pos (goto-char event-pos) @@ -555,7 +558,7 @@ is searched." (org-entry-put event-pos "DT" (gnus-icalendar-event:org-timestamp event)) (org-entry-put event-pos "ORGANIZER" organizer) (org-entry-put event-pos "LOCATION" location) - (org-entry-put event-pos "PARTICIPATION_REQUIRED" (when participation-required "t")) + (org-entry-put event-pos "PARTICIPATION_TYPE" (symbol-name participation-type)) (org-entry-put event-pos "REQ_PARTICIPANTS" (gnus-icalendar--format-participant-list req-participants)) (org-entry-put event-pos "OPT_PARTICIPANTS" (gnus-icalendar--format-participant-list opt-participants)) (org-entry-put event-pos "RRULE" recur) @@ -691,12 +694,14 @@ only makes sense to define names or email addresses." (cadr x)))) (with-slots (organizer summary description location recur uid - method rsvp participation-required) event + method rsvp participation-type) event (let ((headers `(("Summary" ,summary) ("Location" ,(or location "")) ("Time" ,(gnus-icalendar-event:org-timestamp event)) ("Organizer" ,organizer) - ("Attendance" ,(if participation-required "Required" "Optional")) + ("Attendance" ,(if (eq participation-type 'non-participant) + "Your are not listed as an attendee" + (capitalize (symbol-name participation-type)))) ("Method" ,method)))) (when (and (not (gnus-icalendar-event-reply-p event)) rsvp) --=-=-=--