Gnus development mailing list
 help / color / mirror / Atom feed
From: Jan Tatarik <jan.tatarik@gmail.com>
To: ding@gnus.org
Subject: Re: PATCH: bugfix and improvements for gnus-icalendar
Date: Thu, 28 Nov 2013 22:45:35 +0100	[thread overview]
Message-ID: <87bo142oao.fsf@nb-jtatarik2.xing.hh> (raw)
In-Reply-To: <87txeww82d.fsf@topper.koldfront.dk> ("Adam \=\?utf-8\?Q\?Sj\?\= \=\?utf-8\?Q\?\=C3\=B8gren\=22's\?\= message of "Thu, 28 Nov 2013 22:05:46 +0100")

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

On Thu, Nov 28 2013, Adam Sjøgren wrote:

> Jan Tatarik <jan.tatarik@gmail.com> writes:

>> the first patch [...]

>> The second patch [...]

> Regardless of what order I apply them in, I always get a conflict in
> gnus-icalendar.el when handling the last patch.

> Could you perhaps make the patches so they don't collide?

> Maybe I'm just dense when applying them...

Sorry, haven't tried myself before submitting them.

Here you go, all in one.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: opt_reply.patch --]
[-- Type: text/x-diff, Size: 5401 bytes --]

diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 56c56f3dd466975da7b23edd257058ff63fb8bfd..5f152921b663850918be8bfcb3a76f5e69bc1d6d 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,15 +196,18 @@
          (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")
-                     :req-participants (cdar attendee-names)
+                     :rsvp (string= (plist-get (cadr attendee) 'RSVP) "TRUE")
+                     :participation-type participation-type
+                     :req-participants (car attendee-names)
                      :opt-participants (cadr attendee-names)))
          (event-class (cond
                        ((string= method "REQUEST") 'gnus-icalendar-event-request)
@@ -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)
+                                         "You are not listed as an attendee"
+                                       (capitalize (symbol-name participation-type))))
                       ("Method" ,method))))
 
        (when (and (not (gnus-icalendar-event-reply-p event)) rsvp)

[-- Attachment #3: Type: text/plain, Size: 379 bytes --]


The Changelog entry:

2013-11-25	Jan Tatarik	 <jan.tatarik@gmail.com>

	* 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. Fix bug causing
	the first required event participant to be omitted.


  reply	other threads:[~2013-11-28 21:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 22:52 Jan Tatarik
2013-11-28 21:05 ` Adam Sjøgren
2013-11-28 21:45   ` Jan Tatarik [this message]
2013-11-28 22:46     ` Adam Sjøgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bo142oao.fsf@nb-jtatarik2.xing.hh \
    --to=jan.tatarik@gmail.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).