;;; Commentary:
;; Note: You need to have `url' (w3 0.46) or greater version
-;; installed for this backend to work.
+;; installed for some functions of this backend to work.
;; Todo:
;; 1. To support more web archives.
(require 'nnmail)
(require 'mm-util)
(require 'mail-source)
-(eval-when-compile
- (ignore-errors
- (require 'w3)
- (require 'url)
- (require 'w3-forms)
- (require 'nnweb)))
-;; Report failure to find w3 at load time if appropriate.
-(eval '(progn
- (require 'w3)
- (require 'url)
- (require 'w3-forms)
- (require 'nnweb)))
+(require 'mm-url)
(nnoo-declare nnwarchive)
"Where nnwarchive will save its files.")
(defvoo nnwarchive-type nil
- "The type of nnwarchive.")
+ "The type of nnwarchive.")
(defvoo nnwarchive-address ""
"The address of nnwarchive.")
(set-buffer nntp-server-buffer)
(erase-buffer)
(let (header)
- (dolist (art articles)
- (if (setq header (assq art nnwarchive-headers))
- (nnheader-insert-nov (cdr header))))))
+ (dolist (art articles)
+ (if (setq header (assq art nnwarchive-headers))
+ (nnheader-insert-nov (cdr header))))))
(let ((elem (assoc group nnwarchive-headers-cache)))
(if elem
(setcdr elem nnwarchive-headers)
(setq nnwarchive-login
(or nnwarchive-login
(read-string
- (format "Login at %s: " server)
- user-mail-address)))
+ (format "Login at %s: " server)
+ user-mail-address)))
(setq nnwarchive-passwd
(or nnwarchive-passwd
(mail-source-read-passwd
(format " *nnwarchive %s %s*" nnwarchive-type server)))))
(nnwarchive-set-default nnwarchive-type))
-(defun nnwarchive-encode-www-form-urlencoded (pairs)
- "Return PAIRS encoded for forms."
- (mapconcat
- (function
- (lambda (data)
- (concat (w3-form-encode-xwfu (car data)) "="
- (w3-form-encode-xwfu (cdr data)))))
- pairs "&"))
-
-(defun nnwarchive-fetch-form (url pairs)
- (let ((url-request-data (nnwarchive-encode-www-form-urlencoded pairs))
- (url-request-method "POST")
- (url-request-extra-headers
- '(("Content-type" . "application/x-www-form-urlencoded"))))
- (nnweb-insert url))
- t)
-
(defun nnwarchive-eval (expr)
(cond
((consp expr)
(defun nnwarchive-url (xurl)
(mm-with-unibyte-current-buffer
- (let ((url-confirmation-func 'identity)
+ (let ((url-confirmation-func 'identity) ;; Some hacks.
(url-cookie-multiple-line nil))
(cond
((eq (car xurl) 'post)
(pop xurl)
- (nnwarchive-fetch-form (car xurl) (nnwarchive-eval (cdr xurl))))
+ (mm-url-fetch-form (car xurl) (nnwarchive-eval (cdr xurl))))
(t
- (nnweb-insert (apply 'format (nnwarchive-eval xurl))))))))
+ (mm-url-insert (apply 'format (nnwarchive-eval xurl))))))))
(defun nnwarchive-generate-active ()
(save-excursion
article
(make-full-mail-header
article
- (nnweb-decode-entities-string subject)
- (nnweb-decode-entities-string from)
+ (mm-url-decode-entities-string subject)
+ (mm-url-decode-entities-string from)
date
(concat "<" group "%"
(number-to-string article)
(goto-char (point-min))
(while (re-search-forward "<a[^>]+>\\([^<]+\\)</a>" nil t)
(replace-match "\\1"))
- (nnweb-decode-entities)
+ (mm-url-decode-entities)
(buffer-string))
(defun nnwarchive-egroups-xover-files (group articles)
subject (match-string 2))
(forward-line 1)
(unless (assq article nnwarchive-headers)
- (if (looking-at "<UL><LI><EM>From</EM>:\\([^&]+\\)<\\([^&]+\\)>")
+ (if (looking-at "<UL><LI><EM>From</EM>: *\\([^<]*[^< ]\\) *<\\([^&]+\\)>")
(progn
(setq from (match-string 1)
date (identity (match-string 2))))
article
(make-full-mail-header
article
- (nnweb-decode-entities-string subject)
- (nnweb-decode-entities-string from)
+ (mm-url-decode-entities-string subject)
+ (mm-url-decode-entities-string from)
date
(format "<%05d%%%s>\n" (1- article) group)
""
(when (search-forward "X-Head-End" nil t)
(beginning-of-line)
(narrow-to-region (point-min) (point))
- (nnweb-decode-entities)
+ (mm-url-decode-entities)
(goto-char (point-min))
(while (search-forward "<!--X-" nil t)
(replace-match ""))
(search-forward "</ul>" nil t)
(end-of-line)
(narrow-to-region (point-min) (point))
- (nnweb-remove-markup)
- (nnweb-decode-entities)
+ (mm-url-remove-markup)
+ (mm-url-decode-entities)
(goto-char (point-min))
(delete-blank-lines)
(when from
(delete-region (match-beginning 0) (match-end 0))
(save-restriction
(narrow-to-region p (point))
- (nnweb-remove-markup)
- (nnweb-decode-entities)
+ (mm-url-remove-markup)
+ (mm-url-decode-entities)
(goto-char (point-max)))))
((looking-at "<P><A HREF=\"\\([^\"]+\\)")
(setq url (match-string 1))