emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/gnus/nnwarchive.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/nnwarchive.el [lexbind]
Date: Wed, 15 Sep 2004 20:38:01 -0400

Index: emacs/lisp/gnus/nnwarchive.el
diff -c emacs/lisp/gnus/nnwarchive.el:1.2.2.2 
emacs/lisp/gnus/nnwarchive.el:1.2.2.3
*** emacs/lisp/gnus/nnwarchive.el:1.2.2.2       Tue Oct 14 23:34:51 2003
--- emacs/lisp/gnus/nnwarchive.el       Thu Sep 16 00:12:16 2004
***************
*** 1,5 ****
  ;;; nnwarchive.el --- interfacing with web archives
! ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
  
  ;; Author: Shenghuo Zhu <address@hidden>
  ;; Keywords: news egroups mail-archive
--- 1,5 ----
  ;;; nnwarchive.el --- interfacing with web archives
! ;; Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
  
  ;; Author: Shenghuo Zhu <address@hidden>
  ;; Keywords: news egroups mail-archive
***************
*** 24,30 ****
  ;;; Commentary:
  
  ;; Note: You need to have `url' (w3 0.46) or greater version
! ;; installed for this backend to work.
  
  ;; Todo:
  ;; 1. To support more web archives.
--- 24,30 ----
  ;;; Commentary:
  
  ;; Note: You need to have `url' (w3 0.46) or greater version
! ;; installed for some functions of this backend to work.
  
  ;; Todo:
  ;; 1. To support more web archives.
***************
*** 41,59 ****
  (require 'gnus-bcklg)
  (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)))
  
  (nnoo-declare nnwarchive)
  
--- 41,47 ----
  (require 'gnus-bcklg)
  (require 'nnmail)
  (require 'mm-util)
! (require 'mm-url)
  
  (nnoo-declare nnwarchive)
  
***************
*** 297,303 ****
                 user-mail-address)))
      (setq nnwarchive-passwd
          (or nnwarchive-passwd
!             (mail-source-read-passwd
               (format "Password for %s at %s: "
                       nnwarchive-login server)))))
    (unless nnwarchive-groups
--- 285,291 ----
                 user-mail-address)))
      (setq nnwarchive-passwd
          (or nnwarchive-passwd
!             (read-passwd
               (format "Password for %s at %s: "
                       nnwarchive-login server)))))
    (unless nnwarchive-groups
***************
*** 360,382 ****
             (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)
--- 348,353 ----
***************
*** 388,401 ****
  
  (defun nnwarchive-url (xurl)
    (mm-with-unibyte-current-buffer
!     (let ((url-confirmation-func 'identity)
          (url-cookie-multiple-line nil))
        (cond
         ((eq (car xurl) 'post)
        (pop xurl)
!       (nnwarchive-fetch-form (car xurl) (nnwarchive-eval (cdr xurl))))
         (t
!       (nnweb-insert (apply 'format (nnwarchive-eval xurl))))))))
  
  (defun nnwarchive-generate-active ()
    (save-excursion
--- 359,372 ----
  
  (defun nnwarchive-url (xurl)
    (mm-with-unibyte-current-buffer
!     (let ((url-confirmation-func 'identity) ;; Some hacks.
          (url-cookie-multiple-line nil))
        (cond
         ((eq (car xurl) 'post)
        (pop xurl)
!       (mm-url-fetch-form (car xurl) (nnwarchive-eval (cdr xurl))))
         (t
!       (mm-url-insert (apply 'format (nnwarchive-eval xurl))))))))
  
  (defun nnwarchive-generate-active ()
    (save-excursion
***************
*** 470,477 ****
               article
               (make-full-mail-header
                article
!               (nnweb-decode-entities-string subject)
!               (nnweb-decode-entities-string from)
                date
                (concat "<" group "%"
                        (number-to-string article)
--- 441,448 ----
               article
               (make-full-mail-header
                article
!               (mm-url-decode-entities-string subject)
!               (mm-url-decode-entities-string from)
                date
                (concat "<" group "%"
                        (number-to-string article)
***************
*** 490,496 ****
    (goto-char (point-min))
    (while (re-search-forward "<a[^>]+>\\([^<]+\\)</a>" nil t)
      (replace-match "\\1"))
!   (nnweb-decode-entities)
    (buffer-string))
  
  (defun nnwarchive-egroups-xover-files (group articles)
--- 461,467 ----
    (goto-char (point-min))
    (while (re-search-forward "<a[^>]+>\\([^<]+\\)</a>" nil t)
      (replace-match "\\1"))
!   (mm-url-decode-entities)
    (buffer-string))
  
  (defun nnwarchive-egroups-xover-files (group articles)
***************
*** 550,556 ****
            subject (match-string 2))
        (forward-line 1)
        (unless (assq article nnwarchive-headers)
!       (if (looking-at "<UL><LI><EM>From</EM>:\\([^&]+\\)<\\([^&]+\\)>")
            (progn
              (setq from (match-string 1)
                    date (identity (match-string 2))))
--- 521,527 ----
            subject (match-string 2))
        (forward-line 1)
        (unless (assq article nnwarchive-headers)
!       (if (looking-at "<UL><LI><EM>From</EM>: *\\([^<]*[^< ]\\) 
*&lt;\\([^&]+\\)&gt;")
            (progn
              (setq from (match-string 1)
                    date (identity (match-string 2))))
***************
*** 559,566 ****
               article
               (make-full-mail-header
                article
!               (nnweb-decode-entities-string subject)
!               (nnweb-decode-entities-string from)
                date
                (format "<%05d%%%s>\n" (1- article) group)
                ""
--- 530,537 ----
               article
               (make-full-mail-header
                article
!               (mm-url-decode-entities-string subject)
!               (mm-url-decode-entities-string from)
                date
                (format "<%05d%%%s>\n" (1- article) group)
                ""
***************
*** 623,629 ****
        (when (search-forward "X-Head-End" nil t)
        (beginning-of-line)
        (narrow-to-region (point-min) (point))
!       (nnweb-decode-entities)
        (goto-char (point-min))
        (while (search-forward "<!--X-" nil t)
          (replace-match ""))
--- 594,600 ----
        (when (search-forward "X-Head-End" nil t)
        (beginning-of-line)
        (narrow-to-region (point-min) (point))
!       (mm-url-decode-entities)
        (goto-char (point-min))
        (while (search-forward "<!--X-" nil t)
          (replace-match ""))
***************
*** 645,652 ****
        (search-forward "</ul>" nil t)
        (end-of-line)
        (narrow-to-region (point-min) (point))
!       (nnweb-remove-markup)
!       (nnweb-decode-entities)
        (goto-char (point-min))
        (delete-blank-lines)
        (when from
--- 616,623 ----
        (search-forward "</ul>" nil t)
        (end-of-line)
        (narrow-to-region (point-min) (point))
!       (mm-url-remove-markup)
!       (mm-url-decode-entities)
        (goto-char (point-min))
        (delete-blank-lines)
        (when from
***************
*** 687,694 ****
                (delete-region (match-beginning 0) (match-end 0))
                (save-restriction
                  (narrow-to-region p (point))
!                 (nnweb-remove-markup)
!                 (nnweb-decode-entities)
                  (goto-char (point-max)))))
             ((looking-at "<P><A HREF=\"\\([^\"]+\\)")
              (setq url (match-string 1))
--- 658,665 ----
                (delete-region (match-beginning 0) (match-end 0))
                (save-restriction
                  (narrow-to-region p (point))
!                 (mm-url-remove-markup)
!                 (mm-url-decode-entities)
                  (goto-char (point-max)))))
             ((looking-at "<P><A HREF=\"\\([^\"]+\\)")
              (setq url (match-string 1))
***************
*** 696,709 ****
                             (progn (forward-line) (point)))
              ;; I hate to download the url encode it, then immediately
              ;; decode it.
!             ;; FixMe: Find a better solution to attach the URL.
!             ;; Maybe do some hack in external part of mml-generate-mim-1.
!             (insert "<#part>"
!                     "\n--\nExternal: \n"
!                     (format "<URL:http://www.mail-archive.com/%s/%s>"
                              group url)
!                     "\n--\n"
!                     "<#/part>")
              (setq mime t))
             (t
              (setq p (point))
--- 667,683 ----
                             (progn (forward-line) (point)))
              ;; I hate to download the url encode it, then immediately
              ;; decode it.
!             (insert "<#external"
!                     " type="
!                     (or (and url
!                              (string-match "\\.[^\\.]+$" url)
!                              (mailcap-extension-to-mime
!                               (match-string 0 url)))
!                         "application/octet-stream")
!                     (format " url=\"http://www.mail-archive.com/%s/%s\"";
                              group url)
!                     ">\n"
!                     "<#/external>")
              (setq mime t))
             (t
              (setq p (point))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]