aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2005-05-06 00:27:50 +0000
committerMiles Bader2005-05-06 00:27:50 +0000
commit31640842b6cd2970ced612a422fa785d2d718dc0 (patch)
treeaa3076caf78ae382a4363291e020b798ba9ca57d
parent6c9fb58872487b26311784fc44c36bfd01198b63 (diff)
downloademacs-31640842b6cd2970ced612a422fa785d2d718dc0.tar.gz
emacs-31640842b6cd2970ced612a422fa785d2d718dc0.zip
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-291
Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 68) - Update from CVS 2005-04-28 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (article-date-ut): Support converting date in forwarded parts as well. (gnus-article-save-original-date): New macro. (gnus-display-mime): Use it. 2005-04-28 David Hansen <david.hansen@physik.fu-berlin.de> * lisp/gnus/nnrss.el (nnrss-check-group, nnrss-request-article): Support the enclosure element of <item>.
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-art.el140
-rw-r--r--lisp/gnus/nnrss.el52
3 files changed, 137 insertions, 69 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a5c403f0d7d..9f3a114adbe 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,15 @@
12005-04-28 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (article-date-ut): Support converting date in
4 forwarded parts as well.
5 (gnus-article-save-original-date): New macro.
6 (gnus-display-mime): Use it.
7
82005-04-28 David Hansen <david.hansen@physik.fu-berlin.de>
9
10 * nnrss.el (nnrss-check-group, nnrss-request-article): Support the
11 enclosure element of <item>.
12
12005-04-24 Teodor Zlatanov <tzz@lifelogs.com> 132005-04-24 Teodor Zlatanov <tzz@lifelogs.com>
2 14
3 * spam-report.el (spam-report-unplug-agent) 15 * spam-report.el (spam-report-unplug-agent)
@@ -18,7 +30,7 @@
18 Process requests from `spam-report-requests-file'. 30 Process requests from `spam-report-requests-file'.
19 (spam-report-url-ping-mm-url): Autoload. 31 (spam-report-url-ping-mm-url): Autoload.
20 [Added missing offline functionality from trunk.] 32 [Added missing offline functionality from trunk.]
21 33
222005-04-18 Katsumi Yamaoka <yamaoka@jpl.org> 342005-04-18 Katsumi Yamaoka <yamaoka@jpl.org>
23 35
24 * qp.el (quoted-printable-encode-region): Save excursion. 36 * qp.el (quoted-printable-encode-region): Save excursion.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 30ac3c6ccd8..55aaed15d90 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -2824,72 +2824,76 @@ lines forward."
2824 (forward-line 1) 2824 (forward-line 1)
2825 (setq ended t))))) 2825 (setq ended t)))))
2826 2826
2827(defun article-date-ut (&optional type highlight header) 2827(defun article-date-ut (&optional type highlight)
2828 "Convert DATE date to universal time in the current article. 2828 "Convert DATE date to universal time in the current article.
2829If TYPE is `local', convert to local time; if it is `lapsed', output 2829If TYPE is `local', convert to local time; if it is `lapsed', output
2830how much time has lapsed since DATE. For `lapsed', the value of 2830how much time has lapsed since DATE. For `lapsed', the value of
2831`gnus-article-date-lapsed-new-header' says whether the \"X-Sent:\" header 2831`gnus-article-date-lapsed-new-header' says whether the \"X-Sent:\" header
2832should replace the \"Date:\" one, or should be added below it." 2832should replace the \"Date:\" one, or should be added below it."
2833 (interactive (list 'ut t)) 2833 (interactive (list 'ut t))
2834 (let* ((header (or header 2834 (let* ((tdate-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
2835 (message-fetch-field "date") 2835 (date-regexp (cond ((not gnus-article-date-lapsed-new-header)
2836 "")) 2836 tdate-regexp)
2837 (tdate-regexp "^Date:[ \t]\\|^X-Sent:[ \t]") 2837 ((eq type 'lapsed)
2838 (date-regexp 2838 "^X-Sent:[ \t]")
2839 (cond 2839 (article-lapsed-timer
2840 ((not gnus-article-date-lapsed-new-header) 2840 "^Date:[ \t]")
2841 tdate-regexp) 2841 (t
2842 ((eq type 'lapsed) 2842 tdate-regexp)))
2843 "^X-Sent:[ \t]") 2843 (case-fold-search t)
2844 (t 2844 (inhibit-read-only t)
2845 "^Date:[ \t]")))
2846 (date (if (vectorp header) (mail-header-date header)
2847 header))
2848 (inhibit-point-motion-hooks t) 2845 (inhibit-point-motion-hooks t)
2849 pos 2846 pos date bface eface)
2850 bface eface)
2851 (save-excursion 2847 (save-excursion
2852 (save-restriction 2848 (save-restriction
2853 (article-narrow-to-head) 2849 (widen)
2854 (when (re-search-forward tdate-regexp nil t) 2850 (goto-char (point-min))
2855 (setq bface (get-text-property (gnus-point-at-bol) 'face) 2851 (while (or (setq date (get-text-property (setq pos (point))
2856 date (or (get-text-property (gnus-point-at-bol) 2852 'original-date))
2857 'original-date) 2853 (when (setq pos (next-single-property-change
2858 date) 2854 (point) 'original-date))
2859 eface (get-text-property (1- (gnus-point-at-eol)) 'face)) 2855 (setq date (get-text-property pos 'original-date))
2860 (forward-line 1)) 2856 t))
2861 (when (and date (not (string= date ""))) 2857 (narrow-to-region pos (or (text-property-any pos (point-max)
2858 'original-date nil)
2859 (point-max)))
2862 (goto-char (point-min)) 2860 (goto-char (point-min))
2863 (let ((inhibit-read-only t)) 2861 (when (re-search-forward tdate-regexp nil t)
2864 ;; Delete any old Date headers. 2862 (setq bface (get-text-property (gnus-point-at-bol) 'face)
2865 (while (re-search-forward date-regexp nil t) 2863 eface (get-text-property (1- (gnus-point-at-eol)) 'face)))
2866 (if pos 2864 (goto-char (point-min))
2867 (delete-region (progn (beginning-of-line) (point)) 2865 (setq pos nil)
2868 (progn (gnus-article-forward-header) 2866 ;; Delete any old Date headers.
2869 (point))) 2867 (while (re-search-forward date-regexp nil t)
2870 (delete-region (progn (beginning-of-line) (point)) 2868 (if pos
2871 (progn (gnus-article-forward-header) 2869 (delete-region (gnus-point-at-bol)
2872 (forward-char -1) 2870 (progn
2873 (point))) 2871 (gnus-article-forward-header)
2874 (setq pos (point)))) 2872 (point)))
2875 (when (and (not pos) 2873 (delete-region (gnus-point-at-bol)
2876 (re-search-forward tdate-regexp nil t)) 2874 (progn
2877 (forward-line 1)) 2875 (gnus-article-forward-header)
2878 (when pos 2876 (forward-char -1)
2879 (goto-char pos)) 2877 (point)))
2880 (insert (article-make-date-line date (or type 'ut))) 2878 (setq pos (point))))
2881 (unless pos 2879 (when (and (not pos)
2882 (insert "\n") 2880 (re-search-forward tdate-regexp nil t))
2883 (forward-line -1)) 2881 (forward-line 1))
2884 ;; Do highlighting. 2882 (gnus-goto-char pos)
2885 (beginning-of-line) 2883 (insert (article-make-date-line date (or type 'ut)))
2886 (when (looking-at "\\([^:]+\\): *\\(.*\\)$") 2884 (unless pos
2887 (put-text-property (match-beginning 1) (1+ (match-end 1)) 2885 (insert "\n")
2888 'original-date date) 2886 (forward-line -1))
2889 (put-text-property (match-beginning 1) (1+ (match-end 1)) 2887 ;; Do highlighting.
2890 'face bface) 2888 (beginning-of-line)
2891 (put-text-property (match-beginning 2) (match-end 2) 2889 (when (looking-at "\\([^:]+\\): *\\(.*\\)$")
2892 'face eface)))))))) 2890 (put-text-property (match-beginning 1) (1+ (match-end 1))
2891 'face bface)
2892 (put-text-property (match-beginning 2) (match-end 2)
2893 'face eface))
2894 (put-text-property (point-min) (1- (point-max)) 'original-date date)
2895 (goto-char (point-max))
2896 (widen))))))
2893 2897
2894(defun article-make-date-line (date type) 2898(defun article-make-date-line (date type)
2895 "Return a DATE line of TYPE." 2899 "Return a DATE line of TYPE."
@@ -3075,6 +3079,27 @@ This format is defined by the `gnus-article-time-format' variable."
3075 (interactive (list t)) 3079 (interactive (list t))
3076 (article-date-ut 'iso8601 highlight)) 3080 (article-date-ut 'iso8601 highlight))
3077 3081
3082(defmacro gnus-article-save-original-date (&rest forms)
3083 "Save the original date as a text property and evaluate FORMS."
3084 `(let* ((case-fold-search t)
3085 (start (progn
3086 (goto-char (point-min))
3087 (when (and (re-search-forward "^date:[\t\n ]+" nil t)
3088 (not (bolp)))
3089 (match-end 0))))
3090 (date (when (and start
3091 (re-search-forward "[\t ]*\n\\([^\t ]\\|\\'\\)"
3092 nil t))
3093 (buffer-substring-no-properties start
3094 (match-beginning 0)))))
3095 (goto-char (point-max))
3096 (skip-chars-backward "\n")
3097 (put-text-property (point-min) (point) 'original-date date)
3098 ,@forms
3099 (goto-char (point-max))
3100 (skip-chars-backward "\n")
3101 (put-text-property (point-min) (point) 'original-date date)))
3102
3078;; (defun article-show-all () 3103;; (defun article-show-all ()
3079;; "Show all hidden text in the article buffer." 3104;; "Show all hidden text in the article buffer."
3080;; (interactive) 3105;; (interactive)
@@ -4686,7 +4711,8 @@ N is the numerical prefix."
4686 (save-restriction 4711 (save-restriction
4687 (article-goto-body) 4712 (article-goto-body)
4688 (narrow-to-region (point-min) (point)) 4713 (narrow-to-region (point-min) (point))
4689 (gnus-treat-article 'head)))))))) 4714 (gnus-article-save-original-date
4715 (gnus-treat-article 'head)))))))))
4690 4716
4691(defcustom gnus-mime-display-multipart-as-mixed nil 4717(defcustom gnus-mime-display-multipart-as-mixed nil
4692 "Display \"multipart\" parts as \"multipart/mixed\". 4718 "Display \"multipart\" parts as \"multipart/mixed\".
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 04bebec79a6..42ab072f438 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -195,6 +195,7 @@ for decoding when the cdr that the data specify is not available.")
195 (delete "" (split-string (nth 6 e) "\n+")) 195 (delete "" (split-string (nth 6 e) "\n+"))
196 " "))) 196 " ")))
197 (link (nth 2 e)) 197 (link (nth 2 e))
198 (enclosure (nth 7 e))
198 ;; Enable encoding of Newsgroups header in XEmacs. 199 ;; Enable encoding of Newsgroups header in XEmacs.
199 (default-enable-multibyte-characters t) 200 (default-enable-multibyte-characters t)
200 (rfc2047-header-encoding-alist 201 (rfc2047-header-encoding-alist
@@ -203,18 +204,21 @@ for decoding when the cdr that the data specify is not available.")
203 rfc2047-header-encoding-alist) 204 rfc2047-header-encoding-alist)
204 rfc2047-header-encoding-alist)) 205 rfc2047-header-encoding-alist))
205 rfc2047-encode-encoded-words body) 206 rfc2047-encode-encoded-words body)
206 (when (or text link) 207 (when (or text link enclosure)
207 (insert "\n") 208 (insert "\n")
208 (insert "<#multipart type=alternative>\n" 209 (insert "<#multipart type=alternative>\n"
209 "<#part type=\"text/plain\">\n") 210 "<#part type=\"text/plain\">\n")
210 (setq body (point)) 211 (setq body (point))
211 (if text 212 (when text
212 (progn 213 (insert text "\n")
213 (insert text "\n") 214 (when (or link enclosure)
214 (when link 215 (insert "\n")))
215 (insert "\n" link "\n"))) 216 (when link
216 (when link 217 (insert link "\n"))
217 (insert link "\n"))) 218 (when enclosure
219 (insert (car enclosure) " "
220 (nth 2 enclosure) " "
221 (nth 3 enclosure) "\n"))
218 (setq body (buffer-substring body (point))) 222 (setq body (buffer-substring body (point)))
219 (insert "<#/part>\n" 223 (insert "<#/part>\n"
220 "<#part type=\"text/html\">\n" 224 "<#part type=\"text/html\">\n"
@@ -223,6 +227,10 @@ for decoding when the cdr that the data specify is not available.")
223 (insert text "\n")) 227 (insert text "\n"))
224 (when link 228 (when link
225 (insert "<p><a href=\"" link "\">link</a></p>\n")) 229 (insert "<p><a href=\"" link "\">link</a></p>\n"))
230 (when enclosure
231 (insert "<p><a href=\"" (car enclosure) "\">"
232 (cadr enclosure) "</a> " (nth 2 enclosure)
233 " " (nth 3 enclosure) "</p>\n"))
226 (insert "</body></html>\n" 234 (insert "</body></html>\n"
227 "<#/part>\n" 235 "<#/part>\n"
228 "<#/multipart>\n")) 236 "<#/multipart>\n"))
@@ -518,8 +526,8 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
518;;; Snarf functions 526;;; Snarf functions
519 527
520(defun nnrss-check-group (group server) 528(defun nnrss-check-group (group server)
521 (let (file xml subject url extra changed author 529 (let (file xml subject url extra changed author date
522 date rss-ns rdf-ns content-ns dc-ns) 530 enclosure rss-ns rdf-ns content-ns dc-ns)
523 (if (and nnrss-use-local 531 (if (and nnrss-use-local
524 (file-exists-p (setq file (expand-file-name 532 (file-exists-p (setq file (expand-file-name
525 (nnrss-translate-file-chars 533 (nnrss-translate-file-chars
@@ -567,6 +575,27 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
567 (setq date (or (nnrss-node-text dc-ns 'date item) 575 (setq date (or (nnrss-node-text dc-ns 'date item)
568 (nnrss-node-text rss-ns 'pubDate item) 576 (nnrss-node-text rss-ns 'pubDate item)
569 (message-make-date))) 577 (message-make-date)))
578 (when (setq enclosure (cadr (assq (intern (concat rss-ns "enclosure")) item)))
579 (let ((url (cdr (assq 'url enclosure)))
580 (len (cdr (assq 'length enclosure)))
581 (type (cdr (assq 'type enclosure)))
582 (name))
583 (setq len
584 (if (and len (integerp (setq len (string-to-number len))))
585 ;; actually already in `ls-lisp-format-file-size' but
586 ;; probably not worth to require it for one function
587 (do ((size (/ len 1.0) (/ size 1024.0))
588 (post-fixes (list "" "k" "M" "G" "T" "P" "E")
589 (cdr post-fixes)))
590 ((< size 1024)
591 (format "%.1f%s" size (car post-fixes))))
592 "0"))
593 (setq url (or url ""))
594 (setq name (if (string-match "/\\([^/]*\\)$" url)
595 (match-string 1 url)
596 "file"))
597 (setq type (or type ""))
598 (setq enclosure (list url name len type))))
570 (push 599 (push
571 (list 600 (list
572 (incf nnrss-group-max) 601 (incf nnrss-group-max)
@@ -575,7 +604,8 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
575 (and subject (nnrss-mime-encode-string subject)) 604 (and subject (nnrss-mime-encode-string subject))
576 (and author (nnrss-mime-encode-string author)) 605 (and author (nnrss-mime-encode-string author))
577 date 606 date
578 (and extra (nnrss-decode-entities-string extra))) 607 (and extra (nnrss-decode-entities-string extra))
608 enclosure)
579 nnrss-group-data) 609 nnrss-group-data)
580 (gnus-sethash (or url extra) t nnrss-group-hashtb) 610 (gnus-sethash (or url extra) t nnrss-group-hashtb)
581 (setq changed t)) 611 (setq changed t))