Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-icalendar - RSVP handling
@ 2013-11-19 11:15 Adam Sjøgren
  2013-11-19 13:15 ` Jan Tatarik
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2013-11-19 11:15 UTC (permalink / raw)
  To: ding

  Hi.

gnus-icalendar gives you Accept, Tentative, Decline-buttons if you are
an attendee and RSVP is true.

I just got an invitation addressed to a mailinglist.

So, no buttons, but an expectation from the sender that I Accept (or
Decline).

Maybe I should get the buttons by default if I am not in the list of
attendees?

Like so:

diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index a827763..0a5c380 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -200,8 +200,9 @@
                      :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")
+                     :rsvp (if attendee
+                               (string= (plist-get (cadr attendee) 'RSVP) "TRUE")
+                             t)
                      :participation-required (string= (plist-get (cadr
                      attendee) 'ROLE)
                                                       "REQ-PARTICIPANT")
                      :req-participants (cdar attendee-names)


This could perhaps be improved by falling back to checking if _any_
attendee has RSVP true, and if so show buttons to press (we can't know
which of the invited mailing lists I was in, but at least one of the
mailing lists was asked to answer, so be safe and assume I am on that
list).

What do you think?


  Best regards,

    Adam

-- 
 "I hope you're not going to ask me                           Adam Sjøgren
  To explain a title."                                   asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-11-19 11:15 gnus-icalendar - RSVP handling Adam Sjøgren
@ 2013-11-19 13:15 ` Jan Tatarik
  2013-11-19 21:33   ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Tatarik @ 2013-11-19 13:15 UTC (permalink / raw)
  To: ding

On Tue, Nov 19 2013, Adam Sjøgren wrote:

>   Hi.

> gnus-icalendar gives you Accept, Tentative, Decline-buttons if you are
> an attendee and RSVP is true.

> I just got an invitation addressed to a mailinglist.

> So, no buttons, but an expectation from the sender that I Accept (or
> Decline).

> Maybe I should get the buttons by default if I am not in the list of
> attendees?

Not sure about this one. Imagine receiving a forwarded invitation, sent
to you FYI. You will not be on the participant list, and definitely
should not be able to respond to it.

I would go with extending the gnus-icalendar-identities variable, which
is used to identify you on the participant list. Currently it looks at
your mail addresses only:

#+BEGIN_SRC elisp
  (defvar gnus-icalendar-identities
    (apply #'append
           (mapcar (lambda (x) (if (listp x) x (list x)))
                   (list user-full-name (regexp-quote user-mail-address)
                         ; NOTE: this one can be a list
                         gnus-ignored-from-addresses))))
#+END_SRC

If we let the user specify a list of mailing lists he's subscribed to
(or suck this info directly from gnus groups), we could add it to
gnus-icalendar-identities and any RSVP sent to your mailing list will
produce answer buttons for you.

Is it OK?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-11-19 13:15 ` Jan Tatarik
@ 2013-11-19 21:33   ` Adam Sjøgren
  2013-11-19 23:00     ` Jan Tatarik
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2013-11-19 21:33 UTC (permalink / raw)
  To: ding

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

> Not sure about this one. Imagine receiving a forwarded invitation, sent
> to you FYI. You will not be on the participant list, and definitely
> should not be able to respond to it.

As far as I remember, I have done just that in Outlook (not that that
necessarily is a good mold to follow.)

[...]

> If we let the user specify a list of mailing lists he's subscribed to
> (or suck this info directly from gnus groups), we could add it to
> gnus-icalendar-identities and any RSVP sent to your mailing list will
> produce answer buttons for you.

> Is it OK?

I see your point.

In my use-case it is far from ideal - the company has many wide
mailinglists that I am on without knowing it (everybody in a logical
part of the company, everybody in a building, everybody in a country,
etc. etc.).

But I can add them as I go along, so it should be workable.


  Best regards,

    Adam

-- 
 "I don't care about issues! I've got better things to        Adam Sjøgren
  do than argue with every wrong-headed crackpot with    asjo@koldfront.dk
  an ignorant opinion. I'm a busy man!"




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-11-19 21:33   ` Adam Sjøgren
@ 2013-11-19 23:00     ` Jan Tatarik
  2013-11-21 22:43       ` Adam Sjøgren
  2013-12-02 15:52       ` Adam Sjøgren
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Tatarik @ 2013-11-19 23:00 UTC (permalink / raw)
  To: ding

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

On Tue, Nov 19 2013, Adam Sjøgren wrote:

>> If we let the user specify a list of mailing lists he's subscribed to
>> (or suck this info directly from gnus groups), we could add it to
>> gnus-icalendar-identities and any RSVP sent to your mailing list will
>> produce answer buttons for you.

>> Is it OK?

> I see your point.

> In my use-case it is far from ideal - the company has many wide
> mailinglists that I am on without knowing it (everybody in a logical
> part of the company, everybody in a building, everybody in a country,
> etc. etc.).

> But I can add them as I go along, so it should be workable.

Does this work for you?


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

diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index a8277635f3e1571722a01cb4b0fe4452ca7d2434..64ed556c7a5ecd40827b7eddfbfd01122fa05b21 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -617,6 +617,22 @@ is searched."
   :type '(string)
   :group 'gnus-icalendar)
 
+(defcustom gnus-icalendar-additional-identities nil
+  "We need to know your identity to make replies to calendar requests work.
+
+Gnus will only offer you the Accept/Tentative/Decline buttons for
+calendar events if any of your identities matches at least one
+RSVP participant.
+
+Your identity is guessed automatically from the variables `user-full-name',
+`user-mail-address', and `gnus-ignored-from-addresses'.
+
+If you need even more aliases you can define them here.  It really
+only makes sense to define names or email addresses."
+
+  :type '(repeat string)
+  :group 'gnus-icalendar)
+
 (make-variable-buffer-local
  (defvar gnus-icalendar-reply-status nil))
 
@@ -630,8 +646,9 @@ is searched."
   (apply #'append
          (mapcar (lambda (x) (if (listp x) x (list x)))
                  (list user-full-name (regexp-quote user-mail-address)
-                       ; NOTE: this one can be a list
-                       gnus-ignored-from-addresses))))
+                       ; NOTE: these can be lists
+                       gnus-ignored-from-addresses ; already regexp-quoted
+                       (mapcar #'regexp-quote gnus-icalendar-additional-identities)))))
 
 ;; TODO: make the template customizable
 (defmethod gnus-icalendar-event->gnus-calendar ((event gnus-icalendar-event) &optional reply-status)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-11-19 23:00     ` Jan Tatarik
@ 2013-11-21 22:43       ` Adam Sjøgren
  2013-12-02 15:52       ` Adam Sjøgren
  1 sibling, 0 replies; 8+ messages in thread
From: Adam Sjøgren @ 2013-11-21 22:43 UTC (permalink / raw)
  To: ding

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

> Does this work for you?

Applied; will try it at work tomorrow - thanks!

 * http://git.gnus.org/cgit/gnus.git/commit/?id=cf9036b65fbe4cadd057d7449381b54292772caf


  Best regards,

    Adam

-- 
 "I don't care about issues! I've got better things to        Adam Sjøgren
  do than argue with every wrong-headed crackpot with    asjo@koldfront.dk
  an ignorant opinion. I'm a busy man!"




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-11-19 23:00     ` Jan Tatarik
  2013-11-21 22:43       ` Adam Sjøgren
@ 2013-12-02 15:52       ` Adam Sjøgren
  2013-12-02 21:19         ` Jan Tatarik
  1 sibling, 1 reply; 8+ messages in thread
From: Adam Sjøgren @ 2013-12-02 15:52 UTC (permalink / raw)
  To: ding

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

> Does this work for you?

Setting gnus-icalendar-additional-identities works as expected!

One catch is that if I change it, I seem to have to restart Emacs for
the changes to be taken into account. Just changing the value of
gnus-icalendar-additional-identities isn't sufficient. Shouldn't it be?


  Best regards,

   Adam

-- 
 "Lines do not converge toward any point on the               Adam Sjøgren
  horizon! All spatial relationships are lost!"          asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-12-02 15:52       ` Adam Sjøgren
@ 2013-12-02 21:19         ` Jan Tatarik
  2013-12-18 21:11           ` Adam Sjøgren
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Tatarik @ 2013-12-02 21:19 UTC (permalink / raw)
  To: ding

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

On Mon, Dec 02 2013, Adam Sjøgren wrote:

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

>> Does this work for you?

> Setting gnus-icalendar-additional-identities works as expected!

> One catch is that if I change it, I seem to have to restart Emacs for
> the changes to be taken into account. Just changing the value of
> gnus-icalendar-additional-identities isn't sufficient. Shouldn't it be?

How about this?


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

diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 5f152921b663850918be8bfcb3a76f5e69bc1d6d..1abcb6e27e4b40f504de1544f8ff2b1320648e82 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -677,7 +677,10 @@ only makes sense to define names or email addresses."
 (make-variable-buffer-local
  (defvar gnus-icalendar-handle nil))
 
-(defvar gnus-icalendar-identities
+(defun gnus-icalendar-identities ()
+  "Return list of regexp-quoted names and email addresses belonging to the user.
+
+These will be used to retrieve the RSVP information from ical events."
   (apply #'append
          (mapcar (lambda (x) (if (listp x) x (list x)))
                  (list user-full-name (regexp-quote user-mail-address)
@@ -766,7 +769,7 @@ only makes sense to define names or email addresses."
          (event (caddr data))
          (reply (gnus-icalendar-with-decoded-handle handle
                   (gnus-icalendar-event-reply-from-buffer
-                   (current-buffer) status gnus-icalendar-identities))))
+                   (current-buffer) status (gnus-icalendar-identities)))))
 
     (when reply
       (gmm-labels ((fold-icalendar-buffer ()
@@ -838,7 +841,7 @@ only makes sense to define names or email addresses."
 
 
 (defun gnus-icalendar-mm-inline (handle)
-  (let ((event (gnus-icalendar-event-from-handle handle gnus-icalendar-identities)))
+  (let ((event (gnus-icalendar-event-from-handle handle (gnus-icalendar-identities))))
 
     (setq gnus-icalendar-reply-status nil)
 
@@ -867,7 +870,7 @@ only makes sense to define names or email addresses."
 (defun gnus-icalendar-save-part (handle)
   (let (event)
     (when (and (equal (car (mm-handle-type handle)) "text/calendar")
-               (setq event (gnus-icalendar-event-from-handle handle gnus-icalendar-identities)))
+               (setq event (gnus-icalendar-event-from-handle handle (gnus-icalendar-identities))))
 
       (gnus-icalendar-event:sync-to-org event))))
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gnus-icalendar - RSVP handling
  2013-12-02 21:19         ` Jan Tatarik
@ 2013-12-18 21:11           ` Adam Sjøgren
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Sjøgren @ 2013-12-18 21:11 UTC (permalink / raw)
  To: ding

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

> How about this?

Thanks, applied to the git repository.


  Best regards,

    Adam

-- 
 "Although it is against my will, I think it is               Adam Sjøgren
  needed."                                               asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-12-18 21:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 11:15 gnus-icalendar - RSVP handling Adam Sjøgren
2013-11-19 13:15 ` Jan Tatarik
2013-11-19 21:33   ` Adam Sjøgren
2013-11-19 23:00     ` Jan Tatarik
2013-11-21 22:43       ` Adam Sjøgren
2013-12-02 15:52       ` Adam Sjøgren
2013-12-02 21:19         ` Jan Tatarik
2013-12-18 21:11           ` Adam Sjøgren

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).