195 |
(delete "" (split-string (nth 6 e) "\n+")) |
(delete "" (split-string (nth 6 e) "\n+")) |
196 |
" "))) |
" "))) |
197 |
(link (nth 2 e)) |
(link (nth 2 e)) |
198 |
|
(enclosure (nth 7 e)) |
199 |
;; Enable encoding of Newsgroups header in XEmacs. |
;; Enable encoding of Newsgroups header in XEmacs. |
200 |
(default-enable-multibyte-characters t) |
(default-enable-multibyte-characters t) |
201 |
(rfc2047-header-encoding-alist |
(rfc2047-header-encoding-alist |
204 |
rfc2047-header-encoding-alist) |
rfc2047-header-encoding-alist) |
205 |
rfc2047-header-encoding-alist)) |
rfc2047-header-encoding-alist)) |
206 |
rfc2047-encode-encoded-words body) |
rfc2047-encode-encoded-words body) |
207 |
(when (or text link) |
(when (or text link enclosure) |
208 |
(insert "\n") |
(insert "\n") |
209 |
(insert "<#multipart type=alternative>\n" |
(insert "<#multipart type=alternative>\n" |
210 |
"<#part type=\"text/plain\">\n") |
"<#part type=\"text/plain\">\n") |
211 |
(setq body (point)) |
(setq body (point)) |
212 |
(if text |
(when text |
213 |
(progn |
(insert text "\n") |
214 |
(insert text "\n") |
(when (or link enclosure) |
215 |
(when link |
(insert "\n"))) |
216 |
(insert "\n" link "\n"))) |
(when link |
217 |
(when link |
(insert link "\n")) |
218 |
(insert link "\n"))) |
(when enclosure |
219 |
|
(insert (car enclosure) " " |
220 |
|
(nth 2 enclosure) " " |
221 |
|
(nth 3 enclosure) "\n")) |
222 |
(setq body (buffer-substring body (point))) |
(setq body (buffer-substring body (point))) |
223 |
(insert "<#/part>\n" |
(insert "<#/part>\n" |
224 |
"<#part type=\"text/html\">\n" |
"<#part type=\"text/html\">\n" |
227 |
(insert text "\n")) |
(insert text "\n")) |
228 |
(when link |
(when link |
229 |
(insert "<p><a href=\"" link "\">link</a></p>\n")) |
(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")) |
234 |
(insert "</body></html>\n" |
(insert "</body></html>\n" |
235 |
"<#/part>\n" |
"<#/part>\n" |
236 |
"<#/multipart>\n")) |
"<#/multipart>\n")) |
526 |
;;; Snarf functions |
;;; Snarf functions |
527 |
|
|
528 |
(defun nnrss-check-group (group server) |
(defun nnrss-check-group (group server) |
529 |
(let (file xml subject url extra changed author |
(let (file xml subject url extra changed author date |
530 |
date rss-ns rdf-ns content-ns dc-ns) |
enclosure rss-ns rdf-ns content-ns dc-ns) |
531 |
(if (and nnrss-use-local |
(if (and nnrss-use-local |
532 |
(file-exists-p (setq file (expand-file-name |
(file-exists-p (setq file (expand-file-name |
533 |
(nnrss-translate-file-chars |
(nnrss-translate-file-chars |
575 |
(setq date (or (nnrss-node-text dc-ns 'date item) |
(setq date (or (nnrss-node-text dc-ns 'date item) |
576 |
(nnrss-node-text rss-ns 'pubDate item) |
(nnrss-node-text rss-ns 'pubDate item) |
577 |
(message-make-date))) |
(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)))) |
599 |
(push |
(push |
600 |
(list |
(list |
601 |
(incf nnrss-group-max) |
(incf nnrss-group-max) |
604 |
(and subject (nnrss-mime-encode-string subject)) |
(and subject (nnrss-mime-encode-string subject)) |
605 |
(and author (nnrss-mime-encode-string author)) |
(and author (nnrss-mime-encode-string author)) |
606 |
date |
date |
607 |
(and extra (nnrss-decode-entities-string extra))) |
(and extra (nnrss-decode-entities-string extra)) |
608 |
|
enclosure) |
609 |
nnrss-group-data) |
nnrss-group-data) |
610 |
(gnus-sethash (or url extra) t nnrss-group-hashtb) |
(gnus-sethash (or url extra) t nnrss-group-hashtb) |
611 |
(setq changed t)) |
(setq changed t)) |