Mercurial > hg > xemacs-beta
comparison lisp/gnus/nnmbox.el @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | ac2d302a0011 |
children | 4103f0995bd7 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
1 ;;; nnmbox.el --- mail mbox access for Gnus | 1 ;;; nnmbox.el --- mail mbox access for Gnus |
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc. | 2 ;; Copyright (C) 1995,96,97 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no> | 4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no> |
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> | 5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> |
6 ;; Keywords: news, mail | 6 ;; Keywords: news, mail |
7 | 7 |
80 (nnmbox-possibly-change-newsgroup newsgroup server) | 80 (nnmbox-possibly-change-newsgroup newsgroup server) |
81 (while sequence | 81 (while sequence |
82 (setq article (car sequence)) | 82 (setq article (car sequence)) |
83 (setq art-string (nnmbox-article-string article)) | 83 (setq art-string (nnmbox-article-string article)) |
84 (set-buffer nnmbox-mbox-buffer) | 84 (set-buffer nnmbox-mbox-buffer) |
85 (if (or (search-forward art-string nil t) | 85 (when (or (search-forward art-string nil t) |
86 (progn (goto-char (point-min)) | 86 (progn (goto-char (point-min)) |
87 (search-forward art-string nil t))) | 87 (search-forward art-string nil t))) |
88 (progn | 88 (setq start |
89 (setq start | 89 (save-excursion |
90 (save-excursion | 90 (re-search-backward |
91 (re-search-backward | 91 (concat "^" message-unix-mail-delimiter) nil t) |
92 (concat "^" message-unix-mail-delimiter) nil t) | 92 (point))) |
93 (point))) | 93 (search-forward "\n\n" nil t) |
94 (search-forward "\n\n" nil t) | 94 (setq stop (1- (point))) |
95 (setq stop (1- (point))) | 95 (set-buffer nntp-server-buffer) |
96 (set-buffer nntp-server-buffer) | 96 (insert (format "221 %d Article retrieved.\n" article)) |
97 (insert (format "221 %d Article retrieved.\n" article)) | 97 (insert-buffer-substring nnmbox-mbox-buffer start stop) |
98 (insert-buffer-substring nnmbox-mbox-buffer start stop) | 98 (goto-char (point-max)) |
99 (goto-char (point-max)) | 99 (insert ".\n")) |
100 (insert ".\n"))) | |
101 (setq sequence (cdr sequence)) | 100 (setq sequence (cdr sequence)) |
102 (setq count (1+ count)) | 101 (setq count (1+ count)) |
103 (and (numberp nnmail-large-newsgroup) | 102 (and (numberp nnmail-large-newsgroup) |
104 (> number nnmail-large-newsgroup) | 103 (> number nnmail-large-newsgroup) |
105 (zerop (% count 20)) | 104 (zerop (% count 20)) |
114 (nnheader-fold-continuation-lines) | 113 (nnheader-fold-continuation-lines) |
115 'headers))) | 114 'headers))) |
116 | 115 |
117 (deffoo nnmbox-open-server (server &optional defs) | 116 (deffoo nnmbox-open-server (server &optional defs) |
118 (nnoo-change-server 'nnmbox server defs) | 117 (nnoo-change-server 'nnmbox server defs) |
118 (nnmbox-create-mbox) | |
119 (cond | 119 (cond |
120 ((not (file-exists-p nnmbox-mbox-file)) | 120 ((not (file-exists-p nnmbox-mbox-file)) |
121 (nnmbox-close-server) | 121 (nnmbox-close-server) |
122 (nnheader-report 'nnmbox "No such file: %s" nnmbox-mbox-file)) | 122 (nnheader-report 'nnmbox "No such file: %s" nnmbox-mbox-file)) |
123 ((file-directory-p nnmbox-mbox-file) | 123 ((file-directory-p nnmbox-mbox-file) |
145 (deffoo nnmbox-request-article (article &optional newsgroup server buffer) | 145 (deffoo nnmbox-request-article (article &optional newsgroup server buffer) |
146 (nnmbox-possibly-change-newsgroup newsgroup server) | 146 (nnmbox-possibly-change-newsgroup newsgroup server) |
147 (save-excursion | 147 (save-excursion |
148 (set-buffer nnmbox-mbox-buffer) | 148 (set-buffer nnmbox-mbox-buffer) |
149 (goto-char (point-min)) | 149 (goto-char (point-min)) |
150 (if (search-forward (nnmbox-article-string article) nil t) | 150 (when (search-forward (nnmbox-article-string article) nil t) |
151 (let (start stop) | 151 (let (start stop) |
152 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) | 152 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) |
153 (setq start (point)) | 153 (setq start (point)) |
154 (forward-line 1) | 154 (forward-line 1) |
155 (or (and (re-search-forward | 155 (or (and (re-search-forward |
156 (concat "^" message-unix-mail-delimiter) nil t) | 156 (concat "^" message-unix-mail-delimiter) nil t) |
157 (forward-line -1)) | 157 (forward-line -1)) |
158 (goto-char (point-max))) | 158 (goto-char (point-max))) |
159 (setq stop (point)) | 159 (setq stop (point)) |
160 (let ((nntp-server-buffer (or buffer nntp-server-buffer))) | 160 (let ((nntp-server-buffer (or buffer nntp-server-buffer))) |
161 (set-buffer nntp-server-buffer) | 161 (set-buffer nntp-server-buffer) |
162 (erase-buffer) | 162 (erase-buffer) |
163 (insert-buffer-substring nnmbox-mbox-buffer start stop) | 163 (insert-buffer-substring nnmbox-mbox-buffer start stop) |
164 (goto-char (point-min)) | 164 (goto-char (point-min)) |
165 (while (looking-at "From ") | 165 (while (looking-at "From ") |
166 (delete-char 5) | 166 (delete-char 5) |
167 (insert "X-From-Line: ") | 167 (insert "X-From-Line: ") |
168 (forward-line 1)) | 168 (forward-line 1)) |
169 (if (numberp article) | 169 (if (numberp article) |
170 (cons nnmbox-current-group article) | 170 (cons nnmbox-current-group article) |
171 (nnmbox-article-group-number))))))) | 171 (nnmbox-article-group-number))))))) |
172 | 172 |
173 (deffoo nnmbox-request-group (group &optional server dont-check) | 173 (deffoo nnmbox-request-group (group &optional server dont-check) |
174 (let ((active (cadr (assoc group nnmbox-group-alist)))) | 174 (let ((active (cadr (assoc group nnmbox-group-alist)))) |
175 (cond | 175 (cond |
176 ((or (null active) | 176 ((or (null active) |
184 (nnheader-insert "211 %d %d %d %s\n" | 184 (nnheader-insert "211 %d %d %d %s\n" |
185 (1+ (- (cdr active) (car active))) | 185 (1+ (- (cdr active) (car active))) |
186 (car active) (cdr active) group))))) | 186 (car active) (cdr active) group))))) |
187 | 187 |
188 (deffoo nnmbox-request-scan (&optional group server) | 188 (deffoo nnmbox-request-scan (&optional group server) |
189 (nnmbox-possibly-change-newsgroup group server) | |
189 (nnmbox-read-mbox) | 190 (nnmbox-read-mbox) |
190 (nnmail-get-new-mail | 191 (nnmail-get-new-mail |
191 'nnmbox | 192 'nnmbox |
192 (lambda () | 193 (lambda () |
193 (save-excursion | 194 (save-excursion |
206 t) | 207 t) |
207 | 208 |
208 (deffoo nnmbox-request-list (&optional server) | 209 (deffoo nnmbox-request-list (&optional server) |
209 (save-excursion | 210 (save-excursion |
210 (nnmail-find-file nnmbox-active-file) | 211 (nnmail-find-file nnmbox-active-file) |
211 (setq nnmbox-group-alist (nnmail-get-active)))) | 212 (setq nnmbox-group-alist (nnmail-get-active)) |
213 t)) | |
212 | 214 |
213 (deffoo nnmbox-request-newgroups (date &optional server) | 215 (deffoo nnmbox-request-newgroups (date &optional server) |
214 (nnmbox-request-list server)) | 216 (nnmbox-request-list server)) |
215 | 217 |
216 (deffoo nnmbox-request-list-newsgroups (&optional server) | 218 (deffoo nnmbox-request-list-newsgroups (&optional server) |
225 | 227 |
226 (save-excursion | 228 (save-excursion |
227 (set-buffer nnmbox-mbox-buffer) | 229 (set-buffer nnmbox-mbox-buffer) |
228 (while (and articles is-old) | 230 (while (and articles is-old) |
229 (goto-char (point-min)) | 231 (goto-char (point-min)) |
230 (if (search-forward (nnmbox-article-string (car articles)) nil t) | 232 (when (search-forward (nnmbox-article-string (car articles)) nil t) |
231 (if (setq is-old | 233 (if (setq is-old |
232 (nnmail-expired-article-p | 234 (nnmail-expired-article-p |
233 newsgroup | 235 newsgroup |
234 (buffer-substring | 236 (buffer-substring |
235 (point) (progn (end-of-line) (point))) force)) | 237 (point) (progn (end-of-line) (point))) force)) |
236 (progn | 238 (progn |
237 (nnheader-message 5 "Deleting article %d in %s..." | 239 (nnheader-message 5 "Deleting article %d in %s..." |
238 (car articles) newsgroup) | 240 (car articles) newsgroup) |
239 (nnmbox-delete-mail)) | 241 (nnmbox-delete-mail)) |
240 (setq rest (cons (car articles) rest)))) | 242 (push (car articles) rest))) |
241 (setq articles (cdr articles))) | 243 (setq articles (cdr articles))) |
242 (save-buffer) | 244 (save-buffer) |
243 ;; Find the lowest active article in this group. | 245 ;; Find the lowest active article in this group. |
244 (let ((active (nth 1 (assoc newsgroup nnmbox-group-alist)))) | 246 (let ((active (nth 1 (assoc newsgroup nnmbox-group-alist)))) |
245 (goto-char (point-min)) | 247 (goto-char (point-min)) |
251 (nnmail-save-active nnmbox-group-alist nnmbox-active-file) | 253 (nnmail-save-active nnmbox-group-alist nnmbox-active-file) |
252 (nconc rest articles)))) | 254 (nconc rest articles)))) |
253 | 255 |
254 (deffoo nnmbox-request-move-article | 256 (deffoo nnmbox-request-move-article |
255 (article group server accept-form &optional last) | 257 (article group server accept-form &optional last) |
256 (nnmbox-possibly-change-newsgroup group server) | |
257 (let ((buf (get-buffer-create " *nnmbox move*")) | 258 (let ((buf (get-buffer-create " *nnmbox move*")) |
258 result) | 259 result) |
259 (and | 260 (and |
260 (nnmbox-request-article article group server) | 261 (nnmbox-request-article article group server) |
261 (save-excursion | 262 (save-excursion |
271 (progn (forward-line 1) (point)))) | 272 (progn (forward-line 1) (point)))) |
272 (setq result (eval accept-form)) | 273 (setq result (eval accept-form)) |
273 (kill-buffer buf) | 274 (kill-buffer buf) |
274 result) | 275 result) |
275 (save-excursion | 276 (save-excursion |
277 (nnmbox-possibly-change-newsgroup group server) | |
276 (set-buffer nnmbox-mbox-buffer) | 278 (set-buffer nnmbox-mbox-buffer) |
277 (goto-char (point-min)) | 279 (goto-char (point-min)) |
278 (if (search-forward (nnmbox-article-string article) nil t) | 280 (when (search-forward (nnmbox-article-string article) nil t) |
279 (nnmbox-delete-mail)) | 281 (nnmbox-delete-mail)) |
280 (and last (save-buffer)))) | 282 (and last (save-buffer)))) |
281 result)) | 283 result)) |
282 | 284 |
283 (deffoo nnmbox-request-accept-article (group &optional server last) | 285 (deffoo nnmbox-request-accept-article (group &optional server last) |
284 (nnmbox-possibly-change-newsgroup group server) | 286 (nnmbox-possibly-change-newsgroup group server) |
299 (goto-char (point-min)) | 301 (goto-char (point-min)) |
300 (search-forward "\n\n" nil t) | 302 (search-forward "\n\n" nil t) |
301 (forward-line -1) | 303 (forward-line -1) |
302 (while (re-search-backward "^X-Gnus-Newsgroup: " nil t) | 304 (while (re-search-backward "^X-Gnus-Newsgroup: " nil t) |
303 (delete-region (point) (progn (forward-line 1) (point)))) | 305 (delete-region (point) (progn (forward-line 1) (point)))) |
304 (setq result (nnmbox-save-mail (and (stringp group) group)))) | 306 (setq result (nnmbox-save-mail |
307 (if (stringp group) | |
308 (list (cons group (nnmbox-active-number group))) | |
309 (nnmail-article-group 'nnmbox-active-number))))) | |
305 (save-excursion | 310 (save-excursion |
306 (set-buffer nnmbox-mbox-buffer) | 311 (set-buffer nnmbox-mbox-buffer) |
307 (goto-char (point-max)) | 312 (goto-char (point-max)) |
308 (insert-buffer-substring buf) | 313 (insert-buffer-substring buf) |
309 (and last (save-buffer)) | 314 (and last (save-buffer)) |
335 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) | 340 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) |
336 found) | 341 found) |
337 (while (search-forward ident nil t) | 342 (while (search-forward ident nil t) |
338 (setq found t) | 343 (setq found t) |
339 (nnmbox-delete-mail)) | 344 (nnmbox-delete-mail)) |
340 (and found (save-buffer))))) | 345 (when found |
346 (save-buffer))))) | |
341 ;; Remove the group from all structures. | 347 ;; Remove the group from all structures. |
342 (setq nnmbox-group-alist | 348 (setq nnmbox-group-alist |
343 (delq (assoc group nnmbox-group-alist) nnmbox-group-alist) | 349 (delq (assoc group nnmbox-group-alist) nnmbox-group-alist) |
344 nnmbox-current-group nil) | 350 nnmbox-current-group nil) |
345 ;; Save the active file. | 351 ;; Save the active file. |
355 (new-ident (concat "\nX-Gnus-Newsgroup: " new-name ":")) | 361 (new-ident (concat "\nX-Gnus-Newsgroup: " new-name ":")) |
356 found) | 362 found) |
357 (while (search-forward ident nil t) | 363 (while (search-forward ident nil t) |
358 (replace-match new-ident t t) | 364 (replace-match new-ident t t) |
359 (setq found t)) | 365 (setq found t)) |
360 (and found (save-buffer)))) | 366 (when found |
367 (save-buffer)))) | |
361 (let ((entry (assoc group nnmbox-group-alist))) | 368 (let ((entry (assoc group nnmbox-group-alist))) |
362 (and entry (setcar entry new-name)) | 369 (when entry |
370 (setcar entry new-name)) | |
363 (setq nnmbox-current-group nil) | 371 (setq nnmbox-current-group nil) |
364 ;; Save the new group alist. | 372 ;; Save the new group alist. |
365 (nnmail-save-active nnmbox-group-alist nnmbox-active-file) | 373 (nnmail-save-active nnmbox-group-alist nnmbox-active-file) |
366 t)) | 374 t)) |
367 | 375 |
368 | 376 |
369 ;;; Internal functions. | 377 ;;; Internal functions. |
370 | 378 |
371 ;; If FORCE, delete article no matter how many X-Gnus-Newsgroup | 379 ;; If FORCE, delete article no matter how many X-Gnus-Newsgroup |
372 ;; headers there are. If LEAVE-DELIM, don't delete the Unix mbox | 380 ;; headers there are. If LEAVE-DELIM, don't delete the Unix mbox |
373 ;; delimiter line. | 381 ;; delimiter line. |
374 (defun nnmbox-delete-mail (&optional force leave-delim) | 382 (defun nnmbox-delete-mail (&optional force leave-delim) |
375 ;; Delete the current X-Gnus-Newsgroup line. | 383 ;; Delete the current X-Gnus-Newsgroup line. |
376 (or force | 384 (or force |
377 (delete-region | 385 (delete-region |
385 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) | 393 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) |
386 (if leave-delim (progn (forward-line 1) (point)) | 394 (if leave-delim (progn (forward-line 1) (point)) |
387 (match-beginning 0))) | 395 (match-beginning 0))) |
388 (progn | 396 (progn |
389 (forward-line 1) | 397 (forward-line 1) |
390 (or (and (re-search-forward (concat "^" message-unix-mail-delimiter) | 398 (or (and (re-search-forward (concat "^" message-unix-mail-delimiter) |
391 nil t) | 399 nil t) |
392 (if (and (not (bobp)) leave-delim) | 400 (if (and (not (bobp)) leave-delim) |
393 (progn (forward-line -2) (point)) | 401 (progn (forward-line -2) (point)) |
394 (match-beginning 0))) | 402 (match-beginning 0))) |
395 (point-max)))) | 403 (point-max)))) |
396 (goto-char (point-min)) | 404 (goto-char (point-min)) |
397 ;; Only delete the article if no other groups owns it as well. | 405 ;; Only delete the article if no other groups owns it as well. |
398 (if (or force (not (re-search-forward "^X-Gnus-Newsgroup: " nil t))) | 406 (when (or force (not (re-search-forward "^X-Gnus-Newsgroup: " nil t))) |
399 (delete-region (point-min) (point-max)))))) | 407 (delete-region (point-min) (point-max)))))) |
400 | 408 |
401 (defun nnmbox-possibly-change-newsgroup (newsgroup &optional server) | 409 (defun nnmbox-possibly-change-newsgroup (newsgroup &optional server) |
402 (when (and server | 410 (when (and server |
403 (not (nnmbox-server-opened server))) | 411 (not (nnmbox-server-opened server))) |
404 (nnmbox-open-server server)) | 412 (nnmbox-open-server server)) |
405 (if (or (not nnmbox-mbox-buffer) | 413 (when (or (not nnmbox-mbox-buffer) |
406 (not (buffer-name nnmbox-mbox-buffer))) | 414 (not (buffer-name nnmbox-mbox-buffer))) |
407 (save-excursion | 415 (save-excursion |
408 (set-buffer (setq nnmbox-mbox-buffer | 416 (set-buffer (setq nnmbox-mbox-buffer |
409 (nnheader-find-file-noselect | 417 (nnheader-find-file-noselect |
410 nnmbox-mbox-file nil 'raw))) | 418 nnmbox-mbox-file nil 'raw))) |
411 (buffer-disable-undo (current-buffer)))) | 419 (buffer-disable-undo (current-buffer)))) |
412 (if (not nnmbox-group-alist) | 420 (when (not nnmbox-group-alist) |
413 (nnmail-activate 'nnmbox)) | 421 (nnmail-activate 'nnmbox)) |
414 (if newsgroup | 422 (if newsgroup |
415 (if (assoc newsgroup nnmbox-group-alist) | 423 (when (assoc newsgroup nnmbox-group-alist) |
416 (setq nnmbox-current-group newsgroup)) | 424 (setq nnmbox-current-group newsgroup)) |
417 t)) | 425 t)) |
418 | 426 |
419 (defun nnmbox-article-string (article) | 427 (defun nnmbox-article-string (article) |
420 (if (numberp article) | 428 (if (numberp article) |
421 (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":" | 429 (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":" |
423 (concat "\nMessage-ID: " article))) | 431 (concat "\nMessage-ID: " article))) |
424 | 432 |
425 (defun nnmbox-article-group-number () | 433 (defun nnmbox-article-group-number () |
426 (save-excursion | 434 (save-excursion |
427 (goto-char (point-min)) | 435 (goto-char (point-min)) |
428 (and (re-search-forward "^X-Gnus-Newsgroup: +\\([^:]+\\):\\([0-9]+\\) " | 436 (when (re-search-forward "^X-Gnus-Newsgroup: +\\([^:]+\\):\\([0-9]+\\) " |
429 nil t) | 437 nil t) |
430 (cons (buffer-substring (match-beginning 1) (match-end 1)) | 438 (cons (buffer-substring (match-beginning 1) (match-end 1)) |
431 (string-to-int | 439 (string-to-int |
432 (buffer-substring (match-beginning 2) (match-end 2))))))) | 440 (buffer-substring (match-beginning 2) (match-end 2))))))) |
433 | 441 |
434 (defun nnmbox-save-mail (&optional group) | 442 (defun nnmbox-save-mail (group-art) |
435 "Called narrowed to an article." | 443 "Called narrowed to an article." |
436 (let* ((nnmail-split-methods | 444 (let ((delim (concat "^" message-unix-mail-delimiter))) |
437 (if group (list (list group "")) nnmail-split-methods)) | |
438 (group-art (nreverse (nnmail-article-group 'nnmbox-active-number))) | |
439 (delim (concat "^" message-unix-mail-delimiter))) | |
440 (goto-char (point-min)) | 445 (goto-char (point-min)) |
441 ;; This might come from somewhere else. | 446 ;; This might come from somewhere else. |
442 (unless (looking-at delim) | 447 (unless (looking-at delim) |
443 (insert "From nobody " (current-time-string) "\n") | 448 (insert "From nobody " (current-time-string) "\n") |
444 (goto-char (point-min))) | 449 (goto-char (point-min))) |
455 group-art)) | 460 group-art)) |
456 | 461 |
457 (defun nnmbox-insert-newsgroup-line (group-art) | 462 (defun nnmbox-insert-newsgroup-line (group-art) |
458 (save-excursion | 463 (save-excursion |
459 (goto-char (point-min)) | 464 (goto-char (point-min)) |
460 (if (search-forward "\n\n" nil t) | 465 (when (search-forward "\n\n" nil t) |
461 (progn | 466 (forward-char -1) |
462 (forward-char -1) | 467 (while group-art |
463 (while group-art | 468 (insert (format "X-Gnus-Newsgroup: %s:%d %s\n" |
464 (insert (format "X-Gnus-Newsgroup: %s:%d %s\n" | 469 (caar group-art) (cdar group-art) |
465 (caar group-art) (cdar group-art) | 470 (current-time-string))) |
466 (current-time-string))) | 471 (setq group-art (cdr group-art)))) |
467 (setq group-art (cdr group-art))))) | |
468 t)) | 472 t)) |
469 | 473 |
470 (defun nnmbox-active-number (group) | 474 (defun nnmbox-active-number (group) |
471 ;; Find the next article number in GROUP. | 475 ;; Find the next article number in GROUP. |
472 (let ((active (cadr (assoc group nnmbox-group-alist)))) | 476 (let ((active (cadr (assoc group nnmbox-group-alist)))) |
473 (if active | 477 (if active |
474 (setcdr active (1+ (cdr active))) | 478 (setcdr active (1+ (cdr active))) |
475 ;; This group is new, so we create a new entry for it. | 479 ;; This group is new, so we create a new entry for it. |
476 ;; This might be a bit naughty... creating groups on the drop of | 480 ;; This might be a bit naughty... creating groups on the drop of |
477 ;; a hat, but I don't know... | 481 ;; a hat, but I don't know... |
478 (setq nnmbox-group-alist (cons (list group (setq active (cons 1 1))) | 482 (push (list group (setq active (cons 1 1))) |
479 nnmbox-group-alist))) | 483 nnmbox-group-alist)) |
480 (cdr active))) | 484 (cdr active))) |
485 | |
486 (defun nnmbox-create-mbox () | |
487 (when (not (file-exists-p nnmbox-mbox-file)) | |
488 (nnmail-write-region 1 1 nnmbox-mbox-file t 'nomesg))) | |
481 | 489 |
482 (defun nnmbox-read-mbox () | 490 (defun nnmbox-read-mbox () |
483 (nnmail-activate 'nnmbox) | 491 (nnmail-activate 'nnmbox) |
484 (if (not (file-exists-p nnmbox-mbox-file)) | 492 (nnmbox-create-mbox) |
485 (write-region 1 1 nnmbox-mbox-file t 'nomesg)) | |
486 (if (and nnmbox-mbox-buffer | 493 (if (and nnmbox-mbox-buffer |
487 (buffer-name nnmbox-mbox-buffer) | 494 (buffer-name nnmbox-mbox-buffer) |
488 (save-excursion | 495 (save-excursion |
489 (set-buffer nnmbox-mbox-buffer) | 496 (set-buffer nnmbox-mbox-buffer) |
490 (= (buffer-size) (nnheader-file-size nnmbox-mbox-file)))) | 497 (= (buffer-size) (nnheader-file-size nnmbox-mbox-file)))) |
514 (setq alist (cdr alist))) | 521 (setq alist (cdr alist))) |
515 | 522 |
516 (goto-char (point-min)) | 523 (goto-char (point-min)) |
517 (while (re-search-forward delim nil t) | 524 (while (re-search-forward delim nil t) |
518 (setq start (match-beginning 0)) | 525 (setq start (match-beginning 0)) |
519 (if (not (search-forward "\nX-Gnus-Newsgroup: " | 526 (when (not (search-forward "\nX-Gnus-Newsgroup: " |
520 (save-excursion | 527 (save-excursion |
521 (setq end | 528 (setq end |
522 (or | 529 (or |
523 (and | 530 (and |
524 (re-search-forward delim nil t) | 531 (re-search-forward delim nil t) |
525 (match-beginning 0)) | 532 (match-beginning 0)) |
526 (point-max)))) | 533 (point-max)))) |
527 t)) | 534 t)) |
528 (save-excursion | 535 (save-excursion |
529 (save-restriction | 536 (save-restriction |
530 (narrow-to-region start end) | 537 (narrow-to-region start end) |
531 (nnmbox-save-mail)))) | 538 (nnmbox-save-mail |
539 (nnmail-article-group 'nnmbox-active-number))))) | |
532 (goto-char end)))))) | 540 (goto-char end)))))) |
533 | 541 |
534 (provide 'nnmbox) | 542 (provide 'nnmbox) |
535 | 543 |
536 ;;; nnmbox.el ends here | 544 ;;; nnmbox.el ends here |