;;; Code:
+(eval-when-compile (require 'cl))
+(eval-when-compile (require 'gnus-clfns))
(require 'imap)
+
(require 'nnoo)
(require 'nnmail)
(require 'nnheader)
-(require 'mm-util)
(require 'gnus)
(require 'gnus-range)
(require 'gnus-start)
(nnimap-strict-function :tag "User-defined function"))
(repeat :menu-tag "Multi-server (extended)"
:tag "Multi-server list"
- (list (regexp :tag "Server regexp")
+ (list (regexp :tag "Server regexp")
(list (regexp :tag "Incoming Mailbox regexp")
(repeat :tag "Rules for matching server(s) and mailbox(es)"
(list (string :tag "Destination mailbox")
(defvar nnimap-callback-buffer nil
"Which buffer the asynchronous article prefetch callback should work in.")
(defvar nnimap-server-buffer-alist nil) ;; Map server name to buffers.
-(defvar nnimap-current-server nil) ;; Current server
-(defvar nnimap-server-buffer nil) ;; Current servers' buffer
+(defvar nnimap-current-server nil) ;; Current server
+(defvar nnimap-server-buffer nil) ;; Current servers' buffer
\f
(if (equal server "")
"unnamed"
server) "." group "." old-uidvalidity
- nnimap-nov-file-name-suffix) t))
+ nnimap-nov-file-name-suffix) t))
(file (if (or nnmail-use-long-file-names
(file-exists-p (expand-file-name nameuid dir)))
(expand-file-name nameuid dir)
(expand-file-name
- (mm-encode-coding-string
+ (encode-coding-string
(nnheader-replace-chars-in-string nameuid ?. ?/)
nnmail-pathname-coding-system)
dir))))
group (or server nnimap-current-server))
(zerop (imap-mailbox-get 'exists group))
t ;; for OGnus to see if ignoring uidvalidity
- ;; changes has any bad effects.
+ ;; changes has any bad effects.
(yes-or-no-p
(format
"nnimap: Group %s is not uidvalid. Continue? " group)))
(with-temp-buffer
(buffer-disable-undo)
(insert headers)
+ (nnheader-fold-continuation-lines)
+ (subst-char-in-region (point-min) (point-max) ?\t ? )
(nnheader-ms-strip-cr)
(nnheader-fold-continuation-lines)
(subst-char-in-region (point-min) (point-max) ?\t ? )
(if (equal server "")
"unnamed"
server) "." group "." uidvalidity
- nnimap-nov-file-name-suffix) t))
+ nnimap-nov-file-name-suffix) t))
(oldfile (if (or nnmail-use-long-file-names
(file-exists-p (expand-file-name name dir)))
(expand-file-name name dir)
(expand-file-name
- (mm-encode-coding-string
+ (encode-coding-string
(nnheader-replace-chars-in-string name ?. ?/)
nnmail-pathname-coding-system)
dir)))
(file-exists-p (expand-file-name nameuid dir)))
(expand-file-name nameuid dir)
(expand-file-name
- (mm-encode-coding-string
+ (encode-coding-string
(nnheader-replace-chars-in-string nameuid ?. ?/)
nnmail-pathname-coding-system)
dir))))
(with-current-buffer nntp-server-buffer
(let ((nov (nnimap-group-overview-filename group server)))
(when (file-exists-p nov)
- (mm-insert-file-contents nov)
+ (nnheader-insert-file-contents nov)
(set-buffer-modified-p nil)
(let ((min (ignore-errors (goto-char (point-min))
(read (current-buffer))))
(nnimap-retrieve-headers-from-server
(cons (1+ (cdr cached)) high) group server))
(when nnimap-prune-cache
- ;; remove nov's for articles which has expired on server
+ ;; remove nov's for articles which has expired on server
(goto-char (point-min))
(dolist (uid (gnus-set-difference articles uids))
(when (re-search-forward (format "^%d\t" uid) nil t)
(with-current-buffer nnimap-callback-buffer
(insert
(with-current-buffer nnimap-server-buffer
- (nnimap-demule
- (if (imap-capability 'IMAP4rev1)
- ;; xxx don't just use car? alist doesn't contain
- ;; anything else now, but it might...
- (nth 2 (car (imap-message-get (imap-current-message) 'BODYDETAIL)))
- (imap-message-get (imap-current-message) 'RFC822)))))
+ (if (imap-capability 'IMAP4rev1)
+ ;; xxx don't just use car? alist doesn't contain
+ ;; anything else now, but it might...
+ (nth 2 (car (imap-message-get (imap-current-message) 'BODYDETAIL)))
+ (imap-message-get (imap-current-message) 'RFC822))))
(nnheader-ms-strip-cr)
(funcall nnimap-callback-callback-function t)))
(erase-buffer)
(let ((data (imap-fetch article part prop nil
nnimap-server-buffer)))
- (insert (nnimap-demule (if detail
- (nth 2 (car data))
- data))))
- (nnheader-ms-strip-cr)
- (gnus-message 10 "nnimap: Fetching (part of) article %d...done"
- article)
- (if (bobp)
- (nnheader-report 'nnimap "No such article: %s"
- (imap-error-text nnimap-server-buffer))
- (cons group article)))
+ (when data
+ (insert (if detail (nth 2 (car data)) data))
+ (nnheader-ms-strip-cr)
+ (gnus-message 10
+ "nnimap: Fetching (part of) article %d...done"
+ article)
+ (if (bobp)
+ (nnheader-report 'nnimap "No such article: %s"
+ (imap-error-text nnimap-server-buffer))
+ (cons group article)))))
(add-hook 'imap-fetch-data-hook 'nnimap-callback)
(setq nnimap-callback-callback-function nnheader-callback-function
nnimap-callback-buffer nntp-server-buffer)
(or (member "\\NoSelect"
(imap-mailbox-get 'list-flags group nnimap-server-buffer))
(let ((info (nnimap-find-minmax-uid group 'examine)))
- (when (> (or (imap-mailbox-get 'recent group
+ (when (> (or (imap-mailbox-get 'recent group
nnimap-server-buffer) 0)
0)
(push (list (cons group 0)) nnmail-split-history))
(deffoo nnimap-request-update-info-internal (group info &optional server)
(when (nnimap-possibly-change-group group server)
- (when info ;; xxx what does this mean? should we create a info?
+ (when info;; xxx what does this mean? should we create a info?
(with-current-buffer nnimap-server-buffer
(gnus-message 5 "nnimap: Updating info for %s..."
(gnus-info-group info))
gnus-article-mark-lists)
(when nnimap-importantize-dormant
- ;; nnimap mark dormant article as ticked too (for other clients)
+ ;; nnimap mark dormant article as ticked too (for other clients)
;; so we remove that mark for gnus since we support dormant
(gnus-info-set-marks
info
(setq regrepp (string-match "\\\\[0-9&]" group))
(re-search-forward regexp nil t))
(funcall regexp group))
- ;; Don't enter the article into the same group twice.
+ ;; Don't enter the article into the same group twice.
(not (assoc group to-groups)))
(push (if regrepp
(nnmail-expand-newtext group)
(let (rule inbox removeorig (inboxes (nnimap-split-find-inbox server)))
;; iterate over inboxes
(while (and (setq inbox (pop inboxes))
- (nnimap-possibly-change-group inbox)) ;; SELECT
+ (nnimap-possibly-change-group inbox));; SELECT
;; find split rule for this server / inbox
(when (setq rule (nnimap-split-find-rule server inbox))
;; iterate over articles
(and removeorig
(imap-message-flags-add (format "%d" article)
"\\Seen \\Deleted")))))
- (when (imap-mailbox-select inbox) ;; just in case
+ (when (imap-mailbox-select inbox);; just in case
;; todo: UID EXPUNGE (if available) to remove splitted articles
(imap-mailbox-expunge)
(imap-mailbox-close)))
(unless (eq nnmail-expiry-target 'delete)
(with-temp-buffer
(dolist (art (gnus-uncompress-sequence arts))
- (nnimap-request-article art group server (current-buffer))
+ (nnimap-request-article art group server (current-buffer))
;; hints for optimization in `nnimap-request-accept-article'
(let ((nnimap-current-move-article art)
(nnimap-current-move-group group)
(let (uid)
(if (setq uid
(if (string= nnimap-current-server nnimap-current-move-server)
- ;; moving article within same server, speed it up...
+ ;; moving article within same server, speed it up...
(and (nnimap-possibly-change-group
nnimap-current-move-group)
(imap-message-copy (number-to-string
nnimap-server-buffer))
(with-current-buffer (current-buffer)
(goto-char (point-min))
- ;; remove any 'From blabla' lines, some IMAP servers
+ ;; remove any 'From blabla' lines, some IMAP servers
;; reject the entire message otherwise.
(when (looking-at "^From[^:]")
(kill-region (point) (progn (forward-line) (point))))