unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: LdBeth <andpuke@foxmail.com>, Paul Eggert <eggert@cs.ucla.edu>
Cc: 60325@debbugs.gnu.org
Subject: bug#60325: 30.0.50; [PATCH] Fix rfc822 date decode in newsticker
Date: Thu, 29 Dec 2022 11:06:04 +0200	[thread overview]
Message-ID: <83ilhu8tqb.fsf@gnu.org> (raw)
In-Reply-To: <tencent_08022BE4BF2B37D16E0047A09E460C611D07@qq.com> (message from LdBeth on Sun, 25 Dec 2022 17:32:45 -0600)

> Date: Sun, 25 Dec 2022 17:32:45 -0600
> From: LdBeth <andpuke@foxmail.com>
> 
> `newsticker--decode-rfc822-date' matches North American timezone in
> regex, but the actually time stamp conversion was not implemented.
> This patch fixes the missing timezone conversion.

Paul, any comments?  If not, I intend to install this on master.

Thanks.

> From c06782604df686dd17e6eab5caf64e1717f519dc Mon Sep 17 00:00:00 2001
> From: LdBeth <andpuke@foxmail.com>
> Date: Sun, 25 Dec 2022 17:15:12 -0600
> Subject: [PATCH] Fix newsticker timezone decode
> 
> `newsticker--decode-rfc822-date' has the regex pattern for
> North American timezones but the actual timezone conversion
> for them was not implmented. Now cond cases are added to
> handle them as specified in RFC822.
> ---
>  lisp/net/newst-backend.el | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
> index af196cc..2a87742 100644
> --- a/lisp/net/newst-backend.el
> +++ b/lisp/net/newst-backend.el
> @@ -1623,7 +1623,7 @@ Sat, 07 Sep 2002 00:00:01 GMT
>                ":\\([0-9]\\{2\\}\\)"
>                ;; second
>                "\\(:\\([0-9]\\{2\\}\\)\\)?"
> -              ;; zone -- fixme
> +              ;; zone
>                "\\(\\s-+\\("
>                "UT\\|GMT\\|EST\\|EDT\\|CST\\|CDT\\|MST\\|MDT\\|PST\\|PDT"
>                "\\|\\([-+]\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)"
> @@ -1642,16 +1642,26 @@ Sat, 07 Sep 2002 00:00:01 GMT
>                (offset-hour (read (or (match-string 14 rfc822-string)
>                                       "0")))
>                (offset-minute (read (or (match-string 15 rfc822-string)
> -                                       "0")))
> -              ;;FIXME
> -              )
> +                                       "0"))))
>            (when zone
>              (cond ((string= sign "+")
>                     (setq hour (- hour offset-hour))
>                     (setq minute (- minute offset-minute)))
>                    ((string= sign "-")
>                     (setq hour (+ hour offset-hour))
> -                   (setq minute (+ minute offset-minute)))))
> +                   (setq minute (+ minute offset-minute)))
> +                  ((or (string= zone "UT") (string= zone "GMT"))
> +                   nil)
> +                  ((string= zone "EDT")
> +                   (setq hour (+ hour 4)))
> +                  ((or (string= zone "EST") (string= zone "CDT"))
> +                   (setq hour (+ hour 5)))
> +                  ((or (string= zone "CST") (string= zone "MDT"))
> +                   (setq hour (+ hour 6)))
> +                  ((or (string= zone "MST") (string= zone "PDT"))
> +                   (setq hour (+ hour 7)))
> +                  ((string= zone "PST")
> +                   (setq hour (+ hour 8)))))
>            (condition-case error-data
>                (let ((i 1))
>                  (dolist (m '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug"
> -- 
> 2.33.1
> 





  reply	other threads:[~2022-12-29  9:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 23:32 bug#60325: 30.0.50; [PATCH] Fix rfc822 date decode in newsticker LdBeth
2022-12-29  9:06 ` Eli Zaretskii [this message]
2022-12-30  5:39   ` Paul Eggert
2022-12-30 14:49     ` Eli Zaretskii
2022-12-31  8:46       ` Paul Eggert

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83ilhu8tqb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60325@debbugs.gnu.org \
    --cc=andpuke@foxmail.com \
    --cc=eggert@cs.ucla.edu \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).