comparison lisp/gnus/nnmbox.el @ 110410:f2e111723c3a

Merge changes made in Gnus trunk. Reimplement nnimap, and do tweaks to the rest of the code to support that. * gnus-int.el (gnus-finish-retrieve-group-infos) (gnus-retrieve-group-data-early): New functions. * gnus-range.el (gnus-range-nconcat): New function. * gnus-start.el (gnus-get-unread-articles): Support early retrieval of data. (gnus-read-active-for-groups): Support finishing the early retrieval of data. * gnus-sum.el (gnus-summary-move-article): Pass the move-to group name if the move is internal, so that nnimap can do fast internal moves. * gnus.el (gnus-article-special-mark-lists): Add uid/active tuples, for nnimap usage. * nnimap.el: Rewritten. * nnmail.el (nnmail-inhibit-default-split-group): New internal variable to allow the mail splitting to not return a default group. This is useful for nnimap, which will leave unmatched mail in the inbox. * utf7.el (utf7-encode): Autoload. Implement shell connection. * nnimap.el (nnimap-open-shell-stream): New function. (nnimap-open-connection): Use it. Get the number of lines by using BODYSTRUCTURE. (nnimap-transform-headers): Get the number of lines in each message. (nnimap-retrieve-headers): Query for BODYSTRUCTURE so that we get the number of lines. Not all servers return UIDNEXT. Work past this problem. Remove junk from end of file. Fix typo in "bogus" section. Make capabilties be case-insensitive. Require cl when compiling. Don't bug out if the LIST command doesn't have any parameters. 2010-09-17 Knut Anders Hatlen <kahatlen@gmail.com> (tiny change) * nnimap.el (nnimap-get-groups): Don't bug out if the LIST command doesn't have any parameters. (mm-text-html-renderer): Document gnus-article-html. 2010-09-17 Julien Danjou <julien@danjou.info> (tiny fix) * mm-decode.el (mm-text-html-renderer): Document gnus-article-html. * dgnushack.el: Define netrc-credentials. If the user doesn't have a /etc/services, supply some sensible port defaults. Have `unseen-or-unread' select an unread unseen article first. (nntp-open-server): Return whether the open was successful or not. Throughout all files, replace (save-excursion (set-buffer ...)) with (with-current-buffer ... ). Save result so that it doesn't say "failed" all the time. Add ~/.authinfo to the default, since that's probably most useful for users. Don't use the "finish" method when we're reading from the agent. Add some more nnimap-relevant agent stuff to nnagent.el. * nnimap.el (nnimap-with-process-buffer): Removed. Revert one line that was changed by mistake in the last checkin. (nnimap-open-connection): Don't error out when we can't make a connection nnimap-related changes to avoid bugging out if we can't contact a server. * gnus-start.el (gnus-get-unread-articles): Don't try to scan groups from methods that are denied. * nnimap.el (nnimap-possibly-change-group): Return nil if we can't log in. (nnimap-finish-retrieve-group-infos): Make sure we're not waiting for nothing. * gnus-sum.el (gnus-select-newsgroup): Indent.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sat, 18 Sep 2010 10:02:19 +0000
parents 8d09094063d0
children 93e093c035a0
comparison
equal deleted inserted replaced
110409:42d133e002e5 110410:f2e111723c3a
77 ;;; Interface functions 77 ;;; Interface functions
78 78
79 (nnoo-define-basics nnmbox) 79 (nnoo-define-basics nnmbox)
80 80
81 (deffoo nnmbox-retrieve-headers (sequence &optional newsgroup server fetch-old) 81 (deffoo nnmbox-retrieve-headers (sequence &optional newsgroup server fetch-old)
82 (save-excursion 82 (with-current-buffer nntp-server-buffer
83 (set-buffer nntp-server-buffer)
84 (erase-buffer) 83 (erase-buffer)
85 (let ((number (length sequence)) 84 (let ((number (length sequence))
86 (count 0) 85 (count 0)
87 article start stop) 86 article start stop)
88 (nnmbox-possibly-change-newsgroup newsgroup server) 87 (nnmbox-possibly-change-newsgroup newsgroup server)
147 nntp-server-buffer 146 nntp-server-buffer
148 (buffer-name nntp-server-buffer))) 147 (buffer-name nntp-server-buffer)))
149 148
150 (deffoo nnmbox-request-article (article &optional newsgroup server buffer) 149 (deffoo nnmbox-request-article (article &optional newsgroup server buffer)
151 (nnmbox-possibly-change-newsgroup newsgroup server) 150 (nnmbox-possibly-change-newsgroup newsgroup server)
152 (save-excursion 151 (with-current-buffer nnmbox-mbox-buffer
153 (set-buffer nnmbox-mbox-buffer)
154 (when (nnmbox-find-article article) 152 (when (nnmbox-find-article article)
155 (let (start stop) 153 (let (start stop)
156 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) 154 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
157 (setq start (point)) 155 (setq start (point))
158 (forward-line 1) 156 (forward-line 1)
206 (nnmbox-possibly-change-newsgroup group server) 204 (nnmbox-possibly-change-newsgroup group server)
207 (nnmbox-read-mbox) 205 (nnmbox-read-mbox)
208 (nnmail-get-new-mail 206 (nnmail-get-new-mail
209 'nnmbox 207 'nnmbox
210 (lambda () 208 (lambda ()
211 (save-excursion 209 (with-current-buffer nnmbox-mbox-buffer
212 (set-buffer nnmbox-mbox-buffer)
213 (nnmbox-save-buffer))) 210 (nnmbox-save-buffer)))
214 (file-name-directory nnmbox-mbox-file) 211 (file-name-directory nnmbox-mbox-file)
215 group 212 group
216 (lambda () 213 (lambda ()
217 (save-excursion 214 (save-excursion
251 (nnmbox-possibly-change-newsgroup newsgroup server) 248 (nnmbox-possibly-change-newsgroup newsgroup server)
252 (let* ((is-old t) 249 (let* ((is-old t)
253 rest) 250 rest)
254 (nnmail-activate 'nnmbox) 251 (nnmail-activate 'nnmbox)
255 252
256 (save-excursion 253 (with-current-buffer nnmbox-mbox-buffer
257 (set-buffer nnmbox-mbox-buffer)
258 (while (and articles is-old) 254 (while (and articles is-old)
259 (when (nnmbox-find-article (car articles)) 255 (when (nnmbox-find-article (car articles))
260 (if (setq is-old 256 (if (setq is-old
261 (nnmail-expired-article-p 257 (nnmail-expired-article-p
262 newsgroup 258 newsgroup
290 (article group server accept-form &optional last move-is-internal) 286 (article group server accept-form &optional last move-is-internal)
291 (let ((buf (get-buffer-create " *nnmbox move*")) 287 (let ((buf (get-buffer-create " *nnmbox move*"))
292 result) 288 result)
293 (and 289 (and
294 (nnmbox-request-article article group server) 290 (nnmbox-request-article article group server)
295 (save-excursion 291 (with-current-buffer buf
296 (set-buffer buf)
297 (erase-buffer) 292 (erase-buffer)
298 (insert-buffer-substring nntp-server-buffer) 293 (insert-buffer-substring nntp-server-buffer)
299 (goto-char (point-min)) 294 (goto-char (point-min))
300 (while (re-search-forward 295 (while (re-search-forward
301 "^X-Gnus-Newsgroup:" 296 "^X-Gnus-Newsgroup:"
362 (nnmbox-save-buffer)))) 357 (nnmbox-save-buffer))))
363 result)) 358 result))
364 359
365 (deffoo nnmbox-request-replace-article (article group buffer) 360 (deffoo nnmbox-request-replace-article (article group buffer)
366 (nnmbox-possibly-change-newsgroup group) 361 (nnmbox-possibly-change-newsgroup group)
367 (save-excursion 362 (with-current-buffer nnmbox-mbox-buffer
368 (set-buffer nnmbox-mbox-buffer)
369 (if (not (nnmbox-find-article article)) 363 (if (not (nnmbox-find-article article))
370 nil 364 nil
371 (nnmbox-delete-mail t t) 365 (nnmbox-delete-mail t t)
372 (insert 366 (insert
373 (with-temp-buffer 367 (with-temp-buffer
389 (deffoo nnmbox-request-delete-group (group &optional force server) 383 (deffoo nnmbox-request-delete-group (group &optional force server)
390 (nnmbox-possibly-change-newsgroup group server) 384 (nnmbox-possibly-change-newsgroup group server)
391 ;; Delete all articles in GROUP. 385 ;; Delete all articles in GROUP.
392 (if (not force) 386 (if (not force)
393 () ; Don't delete the articles. 387 () ; Don't delete the articles.
394 (save-excursion 388 (with-current-buffer nnmbox-mbox-buffer
395 (set-buffer nnmbox-mbox-buffer)
396 (goto-char (point-min)) 389 (goto-char (point-min))
397 ;; Delete all articles in this group. 390 ;; Delete all articles in this group.
398 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) 391 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":"))
399 found) 392 found)
400 (while (search-forward ident nil t) 393 (while (search-forward ident nil t)
410 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file) 403 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file)
411 t) 404 t)
412 405
413 (deffoo nnmbox-request-rename-group (group new-name &optional server) 406 (deffoo nnmbox-request-rename-group (group new-name &optional server)
414 (nnmbox-possibly-change-newsgroup group server) 407 (nnmbox-possibly-change-newsgroup group server)
415 (save-excursion 408 (with-current-buffer nnmbox-mbox-buffer
416 (set-buffer nnmbox-mbox-buffer)
417 (goto-char (point-min)) 409 (goto-char (point-min))
418 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) 410 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":"))
419 (new-ident (concat "\nX-Gnus-Newsgroup: " new-name ":")) 411 (new-ident (concat "\nX-Gnus-Newsgroup: " new-name ":"))
420 found) 412 found)
421 (while (search-forward ident nil t) 413 (while (search-forward ident nil t)
631 (defun nnmbox-read-mbox () 623 (defun nnmbox-read-mbox ()
632 (nnmail-activate 'nnmbox) 624 (nnmail-activate 'nnmbox)
633 (nnmbox-create-mbox) 625 (nnmbox-create-mbox)
634 (if (and nnmbox-mbox-buffer 626 (if (and nnmbox-mbox-buffer
635 (buffer-name nnmbox-mbox-buffer) 627 (buffer-name nnmbox-mbox-buffer)
636 (save-excursion 628 (with-current-buffer nnmbox-mbox-buffer
637 (set-buffer nnmbox-mbox-buffer)
638 (= (buffer-size) (nnheader-file-size nnmbox-mbox-file)))) 629 (= (buffer-size) (nnheader-file-size nnmbox-mbox-file))))
639 () 630 ()
640 (save-excursion 631 (save-excursion
641 (let ((delim (concat "^" message-unix-mail-delimiter)) 632 (let ((delim (concat "^" message-unix-mail-delimiter))
642 (alist nnmbox-group-alist) 633 (alist nnmbox-group-alist)