This file is indexed.

/usr/share/emacs/site-lisp/w3m/shimbun/sb-mhonarc.el is in w3m-el-snapshot 1.4.527+0.20140108-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
;;; sb-mhonarc.el --- shimbun backend class for mhonarc

;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009
;; Yuuichi Teranishi <teranisi@gohome.org>
;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009
;; Akihiro Arisawa <ari@mbf.sphere.ne.jp>

;; Author: TSUCHIYA Masatoshi <tsuchiya@namazu.org>,
;;         Akihiro Arisawa    <ari@mbf.sphere.ne.jp>,
;;         Yuuichi Teranishi  <teranisi@gohome.org>
;; Keywords: news

;; This file is a part of shimbun.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Original code was nnshimbun.el written by
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>.

;;; Code:

(require 'shimbun)

(eval-and-compile
  (luna-define-class shimbun-mhonarc (shimbun)
		     (reverse-flag litemplate-regexp))
  (luna-define-internal-accessors 'shimbun-mhonarc))

(defvar shimbun-mhonarc-litemplate-regexp
  "<strong><a name=\"\\([0-9]+\\)\" href=\"\\(msg[0-9]+.html\\)\">\\([^<]+\\)</a></strong>\n<ul><li><em>From</em>: \\([^<]+\\)</li></ul>")

(luna-define-method initialize-instance :after ((shimbun shimbun-mhonarc)
						&rest init-args)
  (shimbun-mhonarc-set-reverse-flag-internal
   shimbun
   (symbol-value
    (intern-soft (concat "shimbun-" (shimbun-server-internal shimbun)
			 "-reverse-flag"))))
  (shimbun-mhonarc-set-litemplate-regexp-internal
   shimbun
   (symbol-value
    (intern-soft (concat "shimbun-" (shimbun-server-internal shimbun)
			 "-litemplate-regexp"))))
  shimbun)

(defun shimbun-mhonarc-replace-newline-to-space (string)
  (let ((i (length string)))
    (while (> i 0)
      (setq i (1- i))
      (when (eq (aref string i) ?\n)
	(aset string i ? )))
    string))

(defmacro shimbun-mhonarc-extract-header-values (shimbun url headers aux)
  `(let ((id (format "<%s%s%%%s>"
		     (or ,aux "")
		     (match-string 1)
		     (shimbun-current-group-internal ,shimbun)))
	 (url (shimbun-expand-url (match-string 2) ,url))
	 (subject (shimbun-mhonarc-replace-newline-to-space (match-string 3)))
	 (from (shimbun-mhonarc-replace-newline-to-space (match-string 4))))
     (if (shimbun-search-id ,shimbun id)
	 (throw 'stop ,headers)
       (push (shimbun-make-header 0
				  (shimbun-mime-encode-string subject)
				  (shimbun-mime-encode-string from)
				  "" id "" 0 0 url)
	     ,headers))))

(defmacro shimbun-mhonarc-get-headers (shimbun url headers &optional aux)
  `(save-excursion
     (let ((case-fold-search t)
	   (regexp (or (shimbun-mhonarc-litemplate-regexp-internal ,shimbun)
		       shimbun-mhonarc-litemplate-regexp)))
       (if (shimbun-mhonarc-reverse-flag-internal ,shimbun)
	   (progn
	     (goto-char (point-min))
	     (while (re-search-forward regexp nil t)
	       (shimbun-mhonarc-extract-header-values ,shimbun ,url
						      ,headers ,aux)
	       (forward-line 1)))
	 (goto-char (point-max))
	 (while (re-search-backward regexp nil t)
	   (shimbun-mhonarc-extract-header-values ,shimbun ,url
						  ,headers ,aux)
	   (forward-line 0)))
       ,headers)))

(luna-define-method shimbun-get-headers ((shimbun shimbun-mhonarc)
					 &optional range)
  (let (headers)
    (catch 'stop
      (shimbun-mhonarc-get-headers shimbun (shimbun-index-url shimbun)
				   headers))))

(defvar shimbun-mhonarc-optional-headers
  '("x-ml-count" "x-mail-count" "x-ml-name" "user-agent"))

(defconst shimbun-mhonarc-rot13-table
  (let ((table (make-vector 128 nil))
	(i 0))
    (while (< i 28)
      (aset table (+ (% (+ i 14) 28) ?@) (make-string 1 (+ i ?@)))
      (setq i (1+ i)))
    (setq i 0)
    (while (< i 26)
      (aset table (+ (% (+ i 13) 26) ?a) (make-string 1 (+ i ?a)))
      (setq i (1+ i)))
    table))

(defun shimbun-mhonarc-rot13-decode (str)
  "Decode STR encoded by mrot13() defined in mhonarc/ewhutil.pl."
  (with-temp-buffer
    (insert str)
    (goto-char (point-min))
    (while (and (skip-chars-forward "^a-zA-Z@\\[")
		(not (eobp)))
      (insert (aref shimbun-mhonarc-rot13-table (char-after)))
      (delete-char 1))
    (buffer-string)))

(defun shimbun-mhonarc-header-value ()
  (let ((pt (point)))
    (prog1
	(buffer-substring (match-end 0) (std11-field-end))
      (goto-char pt))))

(luna-define-generic shimbun-mhonarc-get-subject-value (shimbun-mhonarc)
  "Get encoded Subject field value.")
(luna-define-method shimbun-mhonarc-get-subject-value ((shimbun shimbun-mhonarc))
  (shimbun-mime-encode-string (shimbun-mhonarc-header-value)))

(luna-define-generic shimbun-mhonarc-get-from-r13-value (shimbun-mhonarc)
  "Get encoded From field value.")
(luna-define-method shimbun-mhonarc-get-from-r13-value ((shimbun shimbun-mhonarc))
  (shimbun-mime-encode-string (shimbun-mhonarc-rot13-decode
			       (shimbun-mhonarc-header-value))))

(luna-define-method shimbun-make-contents ((shimbun shimbun-mhonarc)
					   header)
  (if (search-forward "<!--X-Head-End-->" nil t)
      (progn
	(forward-line 0)
	;; Processing headers.
	(save-restriction
	  (narrow-to-region (point-min) (point))
	  (shimbun-decode-entities)
	  (goto-char (point-min))
	  (while (search-forward "\n<!--X-" nil t)
	    (replace-match "\n"))
	  (goto-char (point-min))
	  (while (search-forward " -->\n" nil t)
	    (replace-match "\n"))
	  (goto-char (point-min))
	  (while (search-forward "\t" nil t)
	    (replace-match " "))
	  (goto-char (point-min))
	  (let (refs)
	    (while (not (eobp))
	      (cond
	       ((looking-at "<!--")
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "Subject: +")
		(shimbun-header-set-subject
		 header (shimbun-mhonarc-get-subject-value shimbun))
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "From: +")
		(shimbun-header-set-from header
					 (shimbun-mime-encode-string
					  (shimbun-mhonarc-header-value)))
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "From-R13: +")
		(shimbun-header-set-from
		 header (shimbun-mhonarc-get-from-r13-value shimbun))
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "Date: +")
		(let ((date (shimbun-mhonarc-header-value)))
		  (shimbun-header-set-date
		   header
		   (if (string-match "\\([-+][0-9][0-9][0-9][0-9]\\) +([a-zA-Z][a-zA-Z][a-zA-Z])\\'"
				     date)
		       (substring date 0 (match-end 1))
		     date)))
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "Message-Id: +")
		(shimbun-header-set-id header
		 (concat "<" (shimbun-mhonarc-header-value) ">"))
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "Reference: +")
		(push (concat "<" (shimbun-mhonarc-header-value) ">") refs)
		(delete-region (point) (progn (forward-line 1) (point))))
	       ((looking-at "Content-Type: ")
		(delete-region (point) (progn (forward-line 1) (point))))
	       (t (forward-line 1))))
	    (insert "MIME-Version: 1.0\n")
	    (insert "Content-Type: text/html; charset=ISO-2022-JP\n")
	    (if refs
		(shimbun-header-set-references header
					       (mapconcat 'identity
							  (reverse refs) " ")))
	    (insert "\n")
	    (goto-char (point-min))
	    (shimbun-header-insert shimbun header))
	  (goto-char (point-max)))
	;; Processing optional headers.
	(let ((alist)
	      (cur-point (point))
	      (start (search-forward "<!--X-Head-of-Message-->" nil t))
	      (end (and (search-forward "<!--X-Head-of-Message-End-->" nil t)
			(match-beginning 0))))
	  (when (and start end)
	    (save-restriction
	      (narrow-to-region start end)
	      (goto-char (point-min))
	      (while (re-search-forward
		      (regexp-opt
		       '("<strong>" "</strong>" "<em>" "</em>" "</li>"))
		      nil t)
		(delete-region (match-beginning 0) (match-end 0))
		(goto-char (match-beginning 0)))
	      (shimbun-decode-entities)
	      (goto-char (point-min))
	      (while (not (eobp))
		(when (looking-at "<LI>\\([^:]+\\): +")
		  (when (member (downcase (match-string 1))
				shimbun-mhonarc-optional-headers)
		    (push (cons (match-string 1)
				(shimbun-mime-encode-string
				 (buffer-substring (match-end 0)
						   (point-at-eol))))
			  alist)))
		(forward-line 1))
	      (delete-region (point-min) (point-max)))
	    (save-restriction
	      (narrow-to-region (point-min) cur-point)
	      (goto-char (point-min))
	      (when (search-forward "\nMime-Version:" nil t)
		(forward-line 0)
		(dolist (p alist)
		  (insert (car p) ": " (cdr p) "\n")))
	      (goto-char (point-max)))))
	;; Processing body.
	(save-restriction
	  (narrow-to-region (point) (point-max))
	  (delete-region
	   (point)
	   (progn
	     (search-forward "\n<!--X-Body-of-Message-->\n" nil t)
	     (point)))
	  (when (search-forward "\n<!--X-Body-of-Message-End-->\n" nil t)
	    (forward-line -1)
	    (delete-region (point) (point-max)))
	  (goto-char (point-min))
	  (insert "<html>\n<head>\n<base href=\""
		  (shimbun-header-xref header) "\">\n</head>\n</body>\n")
	  (goto-char (point-max))
	  (insert "\n</body>\n</html>")))
    (goto-char (point-min))
    (shimbun-header-insert shimbun header)
    (insert
     "Content-Type: text/html; charset=ISO-2022-JP\nMIME-Version: 1.0\n\n"))
  (encode-coding-string (buffer-string)
			(mime-charset-to-coding-system "ISO-2022-JP")))

(provide 'sb-mhonarc)

;;; sb-mhonarc.el ends here