[gnus git] branch master updated: m0-7-255-gcf9036b =2= RSVP handling. ; Fix org-timestamp for events ending at midnight.

Adam Sj??gren <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  cf9036b65fbe4cadd057d7449381b54292772caf (commit)
       via  8dce88ccd2f52661a97d50c4f62226ded8dfe46f (commit)
      from  852d65fb565743a193d30838cc8e5dde64bbbb3c (commit)


- Log -----------------------------------------------------------------
commit cf9036b65fbe4cadd057d7449381b54292772caf
Author: Jan Tatarik <[email protected]>
Date:   Wed Nov 20 00:00:31 2013 +0100

    RSVP handling.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b77fec6..b03f04a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2013-11-21  Jan Tatarik <[email protected]>
 
+	* gnus-icalendar.el (gnus-icalendar-additional-identities): New.
+	(gnus-icalendar-identities): Support additional-identities.
+
+2013-11-21  Jan Tatarik <[email protected]>
+
 	* gnus-icalendar.el (gnus-icalendar-event:org-timestamp): Fix
 	org-timestamp for events ending at midnight.
 
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 5fbb6e7..56c56f3 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -649,6 +649,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))
 
@@ -662,8 +678,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)

commit 8dce88ccd2f52661a97d50c4f62226ded8dfe46f
Author: Jan Tatarik <[email protected]>
Date:   Tue Nov 19 23:25:54 2013 +0100

    Fix org-timestamp for events ending at midnight.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b8d3c93..b77fec6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-21  Jan Tatarik <[email protected]>
+
+	* gnus-icalendar.el (gnus-icalendar-event:org-timestamp): Fix
+	org-timestamp for events ending at midnight.
+
 2013-11-21  Ivan Shmakov <[email protected]>  (tiny change)
 
 	* nndoc.el (nndoc-type-alist, nndoc-debbugs-db-type-p): Support debbugs
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index a827763..5fbb6e7 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -387,14 +387,46 @@ Return nil for non-recurring EVENT."
          (end (gnus-icalendar-event:end-time event))
          (start-date (format-time-string "%Y-%m-%d %a" start))
          (start-time (format-time-string "%H:%M" start))
+         (start-at-midnight (string= start-time "00:00"))
          (end-date (format-time-string "%Y-%m-%d %a" end))
          (end-time (format-time-string "%H:%M" end))
+         (end-at-midnight (string= end-time "00:00"))
+         (start-end-date-diff (/ (float-time (time-subtract
+                                        (date-to-time end-date)
+                                        (date-to-time start-date)))
+                                 86400))
          (org-repeat (gnus-icalendar-event:org-repeat event))
-         (repeat (if org-repeat (concat " " org-repeat) "")))
+         (repeat (if org-repeat (concat " " org-repeat) ""))
+         (time-1-day '(0 86400)))
 
-    (if (equal start-date end-date)
-        (format "<%s %s-%s%s>" start-date start-time end-time repeat)
-      (format "<%s %s>--<%s %s>" start-date start-time end-date end-time))))
+    ;; NOTE: special care is needed with appointments ending at midnight
+    ;; (typically all-day events): the end time has to be changed to 23:59 to
+    ;; prevent org agenda showing the event on one additional day
+    (cond
+     ;; start/end midnight
+     ;; A 0:0 - A+1 0:0 -> A
+     ;; A 0:0 - A+n 0:0 -> A - A+n-1
+     ((and start-at-midnight end-at-midnight) (if (> start-end-date-diff 1)
+                                                  (let ((end-ts (format-time-string "%Y-%m-%d %a" (time-subtract end time-1-day))))
+                                                    (format "<%s>--<%s>" start-date end-ts))
+                                                (format "<%s%s>" start-date repeat)))
+     ;; end midnight
+     ;; A .:. - A+1 0:0 -> A .:.-23:59
+     ;; A .:. - A+n 0:0 -> A .:. - A_n-1
+     (end-at-midnight (if (= start-end-date-diff 1)
+                          (format "<%s %s-23:59%s>" start-date start-time repeat)
+                        (let ((end-ts (format-time-string "%Y-%m-%d %a" (time-subtract end time-1-day))))
+                          (format "<%s %s>--<%s>" start-date start-time end-ts))))
+     ;; start midnight
+     ;; A 0:0 - A .:. -> A 0:0-.:. (default 1)
+     ;; A 0:0 - A+n .:. -> A - A+n .:.
+     ((and start-at-midnight
+           (plusp start-end-date-diff)) (format "<%s>--<%s %s>" start-date end-date end-time))
+     ;; default
+     ;; A .:. - A .:. -> A .:.-.:.
+     ;; A .:. - B .:.
+     ((zerop start-end-date-diff) (format "<%s %s-%s%s>" start-date start-time end-time repeat))
+     (t (format "<%s %s>--<%s %s>" start-date start-time end-date end-time)))))
 
 (defun gnus-icalendar--format-summary-line (summary &optional location)
   (if location

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog         |   10 ++++++++
 lisp/gnus-icalendar.el |   63 ++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 66 insertions(+), 7 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.