Show
Ignore:
Timestamp:
2005年09月10日 10時16分00秒 (3 years ago)
Author:
miyoshi
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/gnus/spam-report.el

    r3809 r3863  
    4848  :type '(radio (const nil) 
    4949                (regexp :value "^nntp\+.*:gmane\.")) 
    50   :group 'spam-report) 
    51  
    52 (defcustom spam-report-gmane-spam-header 
    53   "^X-Report-Spam: http://\\([^/]+\\)\\(.*\\)$" 
    54   "String matching Gmane spam-reporting header.  Two match groups are needed." 
    55   :type 'regexp 
    5650  :group 'spam-report) 
    5751 
     
    10498        (with-current-buffer nntp-server-buffer 
    10599          (gnus-request-head article gnus-newsgroup-name) 
    106           (goto-char (point-min)) 
    107           (if (re-search-forward spam-report-gmane-spam-header nil t) 
    108               (let* ((host (match-string 1)) 
    109                      (report (match-string 2)) 
    110                      (url (format "http://%s%s" host report))) 
    111                 (gnus-message 7 "Reporting spam through URL %s..." url) 
    112                 (spam-report-url-ping host report)) 
    113             (gnus-message 3 "Could not find X-Report-Spam in article %d..." 
    114                           article))))))) 
     100          (let ((case-fold-search t) 
     101                field host report url) 
     102            ;; First check for X-Report-Spam because it's more specific to 
     103            ;; spam reporting than Archived-At.  OTOH, all new articles on 
     104            ;; Gmane don't have X-Report-Spam anymore (unless Lars changes his 
     105            ;; mind :-)). 
     106            ;; 
     107            ;; There might be more than one Archived-At header so we need to 
     108            ;; find (and transform) the one related to Gmane. 
     109            (setq field (or (gnus-fetch-field "X-Report-Spam") 
     110                            (gnus-fetch-field "Archived-At"))) 
     111            (setq host (progn 
     112                         (string-match 
     113                          (concat "http://\\([a-z]+\\.gmane\\.org\\)" 
     114                                  "\\(/[^:/]+[:/][0-9]+\\)") 
     115                          field) 
     116                         (match-string 1 field))) 
     117            (setq report (match-string 2 field)) 
     118            (when (string-equal "permalink.gmane.org" host) 
     119              (setq host "spam.gmane.org")) 
     120            (setq url (format "http://%s%s" host report)) 
     121            (if (not (and host report url)) 
     122                (gnus-message 
     123                 3 "Could not find a spam report header in article %d..." 
     124                 article) 
     125              (gnus-message 7 "Reporting spam through URL %s..." url) 
     126              (spam-report-url-ping host report)))))))) 
    115127 
    116128(defun spam-report-url-ping (host report) 
    117129  "Ping a host through HTTP, addressing a specific GET resource using 
    118130the function specified by `spam-report-url-ping-function'." 
     131  ;; Example: 
     132  ;; host: "spam.gmane.org" 
     133  ;; report: "/gmane.some.group:123456" 
    119134  (funcall spam-report-url-ping-function host report)) 
    120135