Gnus development mailing list
 help / color / mirror / Atom feed
* Patch to handle invalid dates during expiry
@ 2005-11-20 19:33 Stefan Schimanski
  2005-11-21 23:19 ` Katsumi Yamaoka
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Schimanski @ 2005-11-20 19:33 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 180 bytes --]

Hi!

Attached is a patch to nnmail.el to fix "Invalid Date" errors when the
expire code hits messages with date headers which cannot be parsed by
date-to-time.

Stefan Schimanski


[-- Attachment #1.2: nnmail.el.diff --]
[-- Type: text/plain, Size: 929 bytes --]

Index: nnmail.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmail.el,v
retrieving revision 7.21
diff -u -p -B -w -r7.21 nnmail.el
--- nnmail.el	4 Oct 2005 15:27:45 -0000	7.21
+++ nnmail.el	20 Nov 2005 19:22:21 -0000
@@ -1867,8 +1867,12 @@ See the Info node `(gnus)Fancy Mail Spli
 	 (case-fold-search nil)
 	 (from (or (message-fetch-field "from") ""))
 	 (to (or (message-fetch-field "to") ""))
-	 (date (date-to-time
-		(or (message-fetch-field "date") (current-time-string))))
+	 (date 
+	  (condition-case err
+		  (date-to-time
+		   (or (message-fetch-field "date") (current-time-string)))
+		(error (message "%s" (error-message-string err)) 
+			   (date-to-time (current-time-string)))))
 	 (target 'delete))
     (dolist (regexp-target-pair (reverse nnmail-fancy-expiry-targets) target)
       (setq header (car regexp-target-pair))

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

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

* Re: Patch to handle invalid dates during expiry
  2005-11-20 19:33 Patch to handle invalid dates during expiry Stefan Schimanski
@ 2005-11-21 23:19 ` Katsumi Yamaoka
  0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2005-11-21 23:19 UTC (permalink / raw)
  Cc: ding

>>>>> In <874q679krr.fsf@1stein.org> Stefan Schimanski wrote:

> Attached is a patch to nnmail.el to fix "Invalid Date" errors when the
> expire code hits messages with date headers which cannot be parsed by
> date-to-time.

> -	 (date (date-to-time
> -		(or (message-fetch-field "date") (current-time-string))))
> +	 (date 
> +	  (condition-case err
> +		  (date-to-time
> +		   (or (message-fetch-field "date") (current-time-string)))
> +		(error (message "%s" (error-message-string err)) 
> +			   (date-to-time (current-time-string)))))

Fixed in the trunk and the v5-10 branch.  Thanks.

I realized another problem concerned with `current-time-string'.
In Japan (TZ=+0900), for instance, the value of

(date-to-time (current-time-string))

gains from the value of `(current-time)' for 9 hours.  It is
because the value of `current-time-string' has no TZ info.

(current-time-string)
"Tue Nov 22 08:19:18 2005"

(format-time-string "%a %b %d %T %Y" (date-to-time (current-time-string)))
"Tue Nov 22 17:19:18 2005"

It might make the date that of tomorrow (or yesterday).  So,
I've modified it so as to use `current-time' rather than
`current-time-string'.



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

end of thread, other threads:[~2005-11-21 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-20 19:33 Patch to handle invalid dates during expiry Stefan Schimanski
2005-11-21 23:19 ` Katsumi Yamaoka

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