[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
nnimap 0.93 -> 0.94 patches
- To: nnimap@extundo.com
- Subject: nnimap 0.93 -> 0.94 patches
- From: Simon Josefsson <jas@pdc.kth.se>
- Date: 16 Mar 1999 21:33:28 +0100
- User-Agent: Gnus/5.07008 (Pterodactyl Gnus v0.80) Emacs/20.3.6
Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.179 nnimap/ChangeLog:1.181
*** nnimap/ChangeLog:1.179 Thu Feb 4 17:51:23 1999
--- nnimap/ChangeLog Tue Mar 16 12:25:06 1999
***************
*** 1,3 ****
--- 1,28 ----
+ 1999-03-16 Simon Josefsson <jas@pdc.kth.se>
+
+ * nnimap 0.94 released.
+
+ * nnimap.el (nnimap-current-server): New variable.
+ (nnimap-get-server-buffer): New macro.
+ (nnimap-open-connection): New function (previously part of
+ `nnimap-open-server').
+ (nnimap-open-server):
+ (nnimap-server-opened):
+ (nnimap-close-server):
+ (nnimap-request-close):
+ (nnimap-status-message):
+ (nnimap-possibly-change-server): Rewrite.
+
+ * imap.el (imap-anonymous-open): Renamed to imap-anonymous-auth,
+ typo.
+ (imap-read-passwd): Removed autoloading of ange-ftp,
+ ange-ftp-read-passwd doesn't exist in all Emacsen.
+ (imap-read-passwd): read-passwd can be located in many places,
+ check better.
+
+ * nnimap.el (nnimap-saved-info):
+ (nnimap-active-hashtb): Removed (unused).
+
1999-02-05 Simon Josefsson <jas@pdc.kth.se>
* nnimap 0.93 released.
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.112 nnimap/imap.el:1.116
*** nnimap/imap.el:1.112 Thu Feb 4 17:31:32 1999
--- nnimap/imap.el Tue Mar 16 12:11:13 1999
***************
*** 1,5 ****
;;; imap.el --- imap library
! ;; Copyright (C) 1998 Free Software Foundation, Inc.
;; Author: Simon Josefsson <jas@pdc.kth.se>
;; Keywords: mail
--- 1,5 ----
;;; imap.el --- imap library
! ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
;; Author: Simon Josefsson <jas@pdc.kth.se>
;; Keywords: mail
***************
*** 130,135 ****
--- 130,137 ----
;;
;; o Handle literals in ENVELOPE/BODY fetch responses
;; o Parse UIDs as strings? (28 bit limit)
+ ;; o Write `imap-read' which escapes characters `read' can't handle (like "#"),
+ ;; and use it instead of `read'.
;; o Sleep.
;;
***************
*** 308,317 ****
(let ((prompt (if args
(apply 'format prompt args)
prompt)))
! (funcall (if (load "passwd" t)
'read-passwd
- (unless (fboundp 'ange-ftp-read-passwd)
- (autoload 'ange-ftp-read-passwd "ange-ftp"))
'ange-ftp-read-passwd) prompt)))
(defsubst imap-ok-p (status)
--- 310,319 ----
(let ((prompt (if args
(apply 'format prompt args)
prompt)))
! (funcall (if (or (fboundp 'read-passwd)
! (load "subr" t)
! (load "passwd" t))
'read-passwd
'ange-ftp-read-passwd) prompt)))
(defsubst imap-ok-p (status)
***************
*** 499,505 ****
(defun imap-anonymous-p (buffer)
t)
! (defun imap-anonymous-open (buffer)
(with-current-buffer buffer
(imap-ok-p (imap-send-command-wait
(concat "LOGIN anonymous \"" (concat (user-login-name) "@"
--- 501,507 ----
(defun imap-anonymous-p (buffer)
t)
! (defun imap-anonymous-auth (buffer)
(with-current-buffer buffer
(imap-ok-p (imap-send-command-wait
(concat "LOGIN anonymous \"" (concat (user-login-name) "@"
***************
*** 1641,1646 ****
--- 1643,1649 ----
imap-message-flags-add
imap-message-copy
imap-message-append
+ imap-send-command-1
imap-send-command
imap-wait-for-tag
imap-sentinel
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.130 nnimap/nnimap.el:1.132
*** nnimap/nnimap.el:1.130 Thu Feb 4 17:41:30 1999
--- nnimap/nnimap.el Tue Mar 16 12:25:31 1999
***************
*** 93,99 ****
(nnoo-declare nnimap)
! (defconst nnimap-version "nnimap 0.93")
;; Splitting variables
--- 93,99 ----
(nnoo-declare nnimap)
! (defconst nnimap-version "nnimap 0.94")
;; Splitting variables
***************
*** 270,356 ****
;; Internal variables.
(defvoo nnimap-need-expunge nil)
! (defvoo nnimap-server-buffer nil)
! (defvar nnimap-saved-info nil)
! (defvoo nnimap-active-hashtb nil)
!
! ;; radford:
! ;; shouldn't have to keep this info around, nnoo should???
! ;; The only reason for this is `nnimap-server-opened' needs
! ;; `nnimap-server-buffer' to do its work, but have to change
! ;; servers to get the right one. I don't think `opened'
! ;; should be changing servers. A better way anyone???
! ;; jas:
! ;; i think this is the way to do it. from "Backend interface" in
! ;; the gnus manual:
! ;; "When Gnus asks for information from a backend--say nntp---on
! ;; something, it will normally include a virtual server name in the
! ;; function parameters. (If not, the backend should use the "current"
! ;; virtual server.) For instance, nntp-request-list takes a virtual
! ;; server as its only (optional) parameter. If this virtual server hasn't
! ;; been opened, the function should fail."
! (defvar nnimap-server-buffer-alist nil)
!
(defvar nnimap-length)
(defvar nnimap-counter)
- (defvar nnimap-debug "*nnimap-debug*")
! (when nnimap-debug
! (require 'trace)
! (buffer-disable-undo (get-buffer-create nnimap-debug))
! (mapc (lambda (f) (trace-function-background f nnimap-debug))
! '(
! nnimap-close-group
! nnimap-close-server
! nnimap-open-server
! nnimap-expunge-close-group
! nnimap-date-days-ago
! nnimap-time-substract
! nnimap-possibly-change-group
! nnimap-possibly-change-server
! nnimap-request-accept-article
! nnimap-request-article
! nnimap-request-article-part
! nnimap-request-body
! nnimap-request-close
! nnimap-request-create-group
! nnimap-request-delete-group
! nnimap-request-group
! nnimap-request-head
! nnimap-request-list
! nnimap-request-list-mapper
! nnimap-request-newgroups
! nnimap-request-post
! nnimap-request-rename-group
! nnimap-request-scan
! ; nnimap-send-command-wait
! ; nnimap-ok-p
! nnimap-split-copy-delete-article
! nnimap-split-move-article
! nnimap-split-to-groups
! nnimap-split-articles
! nnimap-request-update-info-internal
! nnimap-request-set-mark
! nnimap-retrieve-groups
! nnimap-retrieve-headers
! nnimap-server-opened
! nnimap-status-message
! nnimap-update-alist-soft
! nnimap-range-to-string
! ; nnimap-request-expire-articles-progress
! nnimap-request-expire-articles
! nnimap-request-move-article
! nnimap-mark-to-predicate
! nnimap-mark-to-flag
! nnimap-mark-permanent-p
! gnus-group-nnimap-edit-acl-done
! gnus-group-nnimap-edit-acl
! nnimap-save-info-hook
! nnimap-update-flags-hook
! )))
;; nnimap 1.x functions:
(defun nnimap-body-lines (body)
"Return number of lines in article by looking at the mime bodystructure
BODY."
--- 270,382 ----
;; Internal variables.
(defvoo nnimap-need-expunge nil)
! (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-length)
(defvar nnimap-counter)
! (defvar nnimap-debug "*nnimap-debug*")
;; nnimap 1.x functions:
+ (defmacro nnimap-get-server-buffer (server)
+ "Return buffer for SERVER. If SERVER is nil, the current server is
+ used."
+ `(nth 1 (assoc (or ,server nnimap-current-server)
+ nnimap-server-buffer-alist)))
+
+ (defun nnimap-possibly-change-server (server)
+ ;; Return buffer of server SERVER. If SERVER is nil, return current
+ ;; server buffer. Changes the current server as a side-effect.
+ (setq nnimap-current-server (or server nnimap-current-server)
+ nnimap-server-buffer (nnimap-get-server-buffer nnimap-current-server)))
+
+ (nnoo-define-basics nnimap)
+
+ (defun nnimap-open-connection (server)
+ (if (not (imap-open nnimap-address nnimap-server-port nnimap-stream
+ nnimap-authenticator nnimap-server-buffer))
+ (nnheader-report 'nnimap "Can't open connection to server %s" server)
+ (unless (or (imap-capability 'IMAP4 nnimap-server-buffer)
+ (imap-capability 'IMAP4rev1 nnimap-server-buffer)
+ (imap-capability 'IMAP4REV1 nnimap-server-buffer))
+ (imap-close nnimap-server-buffer)
+ (nnheader-report 'nnimap "Server %s is not IMAP4 compliant" server))
+ (let (list alist user passwd)
+ (and (fboundp 'gnus-parse-netrc)
+ (setq list (gnus-parse-netrc nnimap-authinfo-file)
+ alist (or (and (gnus-netrc-get
+ (gnus-netrc-machine list server) "machine")
+ (gnus-netrc-machine list server))
+ (gnus-netrc-machine list nnimap-address))
+ user (gnus-netrc-get alist "login")
+ passwd (gnus-netrc-get alist "password")))
+ (if (imap-authenticate nnimap-server-buffer user passwd)
+ (prog1
+ (push (list server nnimap-server-buffer)
+ nnimap-server-buffer-alist)
+ (nnimap-possibly-change-server server))
+ (imap-close nnimap-server-buffer)
+ (kill-buffer nnimap-server-buffer)
+ (nnheader-report 'nnimap "Could not authenticate to %s" server)))))
+
+ (deffoo nnimap-open-server (server &optional defs)
+ (nnheader-init-server-buffer)
+ (if (nnimap-server-opened server)
+ t
+ (unless (assq 'nnimap-server-buffer defs)
+ (push (list 'nnimap-server-buffer (concat " *nnimap* " server)) defs))
+ ;; translate `nnimap-server-address' to `nnimap-address' in defs
+ ;; for people that configured nnimap with a very old version
+ (unless (assq 'nnimap-address defs)
+ (if (assq 'nnimap-server-address defs)
+ (push (list 'nnimap-address
+ (cadr (assq 'nnimap-server-address defs))) defs)
+ (push (list 'nnimap-address server) defs)))
+ (nnoo-change-server 'nnimap server defs)
+ (if (null nnimap-server-buffer)
+ (error "this shouldn't happen"))
+ (or (imap-opened nnimap-server-buffer)
+ (nnimap-open-connection server))))
+
+ (deffoo nnimap-server-opened (&optional server)
+ "If SERVER is the current virtual server, and the connection to the
+ physical server is alive, this function return a non-nil value. If
+ SERVER is nil, it is treated as the current server."
+ ;; clean up autologouts??
+ (and (or server nnimap-current-server)
+ (nnoo-server-opened 'nnimap (or server nnimap-current-server))
+ (imap-opened (nnimap-get-server-buffer server))))
+
+ (deffoo nnimap-close-server (&optional server)
+ "Close connection to server and free all resources connected to
+ it. Return nil if the server couldn't be closed for some reason."
+ (let ((server (or server nnimap-current-server)))
+ (when (or (nnimap-server-opened server)
+ (imap-opened (nnimap-get-server-buffer server)))
+ (imap-close (nnimap-get-server-buffer server))
+ (kill-buffer (nnimap-get-server-buffer server))
+ (setq nnimap-server-buffer nil
+ nnimap-current-server nil
+ nnimap-server-buffer-alist
+ (delq server nnimap-server-buffer-alist)))
+ (nnoo-close-server 'nnimap server)))
+
+ (deffoo nnimap-request-close ()
+ "Close connection to all servers and free all resources that the
+ backend have reserved. All buffers that have been created by that
+ backend should be killed. (Not the nntp-server-buffer, though.) This
+ function is generally only called when Gnus is shutting down."
+ (mapcar (lambda (server) (nnimap-close-server (car server)))
+ nnimap-server-buffer-alist)
+ (setq nnimap-server-buffer-alist nil))
+
+ (deffoo nnimap-status-message (&optional server)
+ "This function returns the last error message from server."
+ (when (nnimap-possibly-change-server server)
+ (nnoo-status-message 'nnimap server)))
+
(defun nnimap-body-lines (body)
"Return number of lines in article by looking at the mime bodystructure
BODY."
***************
*** 635,650 ****
;;; Interface functions, required backend functions
- ;;; This seems to define the following:
- ;;; `nnimap-close-server' `nnimap-server-opened'
- ;;; `nnimap-open-server' `nnimap-status-message'
- ;;; open-server -> nnoo-change-server
- ;;; close-server -> nnoo-close-server
- ;;; server-opened -> nnoo-server-opened
- ;;; status-message -> nnoo-status-message
-
- (nnoo-define-basics nnimap)
-
(defun nnimap-retrieve-headers-progress ()
(when (> nnimap-length 25)
(setq nnimap-counter (1+ nnimap-counter))
--- 661,666 ----
***************
*** 697,777 ****
(delete-backward-char 1)))
'headers))))
- (deffoo nnimap-open-server (server &optional defs)
- (or (and (nnimap-server-opened server)
- (nnoo-change-server 'nnimap server defs)
- (if (null nnimap-server-buffer)
- (error "this shouldn't happen")
- t))
- (progn
- (unless (assq 'nnimap-address defs)
- (if (assq 'nnimap-server-address defs)
- (push (list 'nnimap-address (cadr (assq 'nnimap-server-address
- defs))) defs)
- (push (list 'nnimap-address server) defs)))
- (unless (assq 'nnimap-server-buffer defs)
- (push (list 'nnimap-server-buffer (concat " *nnimap* " server))
- defs))
- (nnoo-change-server 'nnimap server defs)
- (if (not (imap-open nnimap-address nnimap-server-port
- nnimap-stream nnimap-authenticator
- nnimap-server-buffer))
- (nnheader-report 'nnimap "Could not connect to server %s" server)
- (unless (or (imap-capability 'IMAP4 nnimap-server-buffer)
- (imap-capability 'IMAP4rev1 nnimap-server-buffer)
- (imap-capability 'IMAP4REV1 nnimap-server-buffer))
- (imap-close nnimap-server-buffer)
- (nnheader-report 'nnimap "Server %s not IMAP4" server))
- (let (list alist user passwd)
- (and (fboundp 'gnus-parse-netrc)
- (setq list (gnus-parse-netrc nnimap-authinfo-file)
- alist (or (and (gnus-netrc-get (gnus-netrc-machine
- list server) "machine")
- (gnus-netrc-machine list server))
- (gnus-netrc-machine list nnimap-address))
- user (gnus-netrc-get alist "login")
- passwd (gnus-netrc-get alist "password")))
- (if (imap-authenticate nnimap-server-buffer user passwd)
- (push (cons server nnimap-server-buffer)
- nnimap-server-buffer-alist)
- (imap-close nnimap-server-buffer)
- (nnheader-report 'nnimap "Could not authenticate to %s"
- server)))))))
-
- (deffoo nnimap-close-server (&optional server)
- (let ((s-b (assoc (setq server (or server (nnoo-current-server 'nnimap)))
- nnimap-server-buffer-alist)))
- (when s-b
- (setq nnimap-server-buffer nil)
- (setq nnimap-server-buffer-alist (delq s-b nnimap-server-buffer-alist))
- (imap-close (cdr s-b)))
- (nnoo-close-server 'nnimap server)))
-
- (deffoo nnimap-request-close ()
- (mapc (lambda (s-b) (nnimap-close-server (car s-b)))
- nnimap-server-buffer-alist)
- (setq nnimap-server-buffer-alist nil))
-
- (deffoo nnimap-server-opened (&optional server)
- (let ((buffer (cdr (assoc
- (setq server (or server (nnoo-current-server 'nnimap)))
- nnimap-server-buffer-alist))))
- (if (and (gnus-buffer-live-p buffer)
- (gnus-buffer-live-p nntp-server-buffer))
- (let ((running (imap-opened buffer)))
- ;; clean up autologouts
- (unless running
- (nnimap-close-server server))
- running))))
-
- (deffoo nnimap-status-message (&optional server)
- (let ((buffer (cdr (assoc
- (setq server (or server (nnoo-current-server 'nnimap)))
- nnimap-server-buffer-alist))))
- (when buffer
- (with-current-buffer buffer
- (nnoo-status-message 'nnimap server)))))
-
(deffoo nnimap-request-article (article &optional group server to-buffer)
(nnimap-request-article-part 'RFC822 article group server to-buffer t))
(deffoo nnimap-request-head (article &optional group server to-buffer)
--- 713,718 ----
***************
*** 1279,1302 ****
(imap-mailbox-unselect)))))))
(not imap-current-mailbox))
- (defun nnimap-possibly-change-server (server)
- "Change to server SERVER if needed (open it if it's closed). If SERVER is
- nil, change to current server."
- (and (setq server (or server (nnoo-current-server 'nnimap)))
- (nnimap-open-server server)))
-
(defun nnimap-possibly-change-group (group &optional server)
- (setq server (or server (nnoo-current-server 'nnimap)))
(when (nnimap-possibly-change-server server)
(with-current-buffer nnimap-server-buffer
(when group
(let ((groupname (gnus-group-normally-qualified
! 'nnimap server group)))
(if (and imap-current-mailbox
(not (string= group imap-current-mailbox)))
(nnimap-expunge-close-group))
(when (imap-mailbox-select group nil
! (gnus-ephemeral-group-p groupname))
;; check/set UIDVALIDITY
(let ((new-uid (imap-mailbox-get 'uidvalidity))
(old-uid (gnus-group-get-parameter groupname 'uidvalidity))
--- 1220,1236 ----
(imap-mailbox-unselect)))))))
(not imap-current-mailbox))
(defun nnimap-possibly-change-group (group &optional server)
(when (nnimap-possibly-change-server server)
(with-current-buffer nnimap-server-buffer
(when group
(let ((groupname (gnus-group-normally-qualified
! 'nnimap nnimap-current-server group)))
(if (and imap-current-mailbox
(not (string= group imap-current-mailbox)))
(nnimap-expunge-close-group))
(when (imap-mailbox-select group nil
! (gnus-ephemeral-group-p groupname))
;; check/set UIDVALIDITY
(let ((new-uid (imap-mailbox-get 'uidvalidity))
(old-uid (gnus-group-get-parameter groupname 'uidvalidity))
***************
*** 1340,1345 ****
--- 1274,1344 ----
(setcdr plist next)
(setq plist next))
head))))
+
+ (when nnimap-debug
+ (require 'trace)
+ (buffer-disable-undo (get-buffer-create nnimap-debug))
+ (mapc (lambda (f) (trace-function-background f nnimap-debug))
+ '(
+ ;nnimap-body-lines
+ nnimap-request-scan
+ nnimap-split-copy-delete-article
+ nnimap-split-move-article
+ nnimap-expand-newtext
+ nnimap-split-to-groups
+ nnimap-split-find-rule
+ nnimap-split-find-inbox
+ nnimap-split-articles
+ nnimap-request-set-mark
+ nnimap-request-move-article
+ gnus-group-nnimap-expunge
+ gnus-group-nnimap-edit-acl
+ gnus-group-nnimap-edit-acl-done
+ nnimap-group-mode-hook
+ nnimap-retrieve-headers-progress
+ nnimap-retrieve-headers
+ nnimap-open-server
+ nnimap-close-server
+ nnimap-request-close
+ nnimap-server-opened
+ nnimap-status-message
+ nnimap-request-article
+ nnimap-request-head
+ nnimap-request-body
+ nnimap-request-article-part
+ nnimap-request-group
+ gnus-group-normally-qualified
+ nnimap-close-group
+ nnimap-request-list-mapper
+ nnimap-pattern-to-list-arguments
+ nnimap-request-list
+ nnimap-request-post
+ nnimap-retrieve-groups
+ nnimap-request-update-info-internal
+ nnimap-request-type
+ nnimap-request-group-description
+ nnimap-request-list-newsgroups
+ nnimap-request-newgroups
+ nnimap-request-create-group
+ nnimap-time-substract
+ nnimap-date-days-ago
+ ;nnimap-request-expire-articles-progress
+ nnimap-request-expire-articles
+ nnimap-request-accept-article
+ nnimap-request-delete-group
+ nnimap-request-rename-group
+ ;nnimap-mark-to-predicate
+ ;nnimap-mark-to-flag-1
+ ;nnimap-mark-to-flag
+ ;nnimap-mark-permanent-p
+ nnimap-update-alist-soft
+ nnimap-range-to-string
+ nnimap-send-command-wait
+ ;nnimap-ok-p
+ nnimap-expunge-close-group
+ nnimap-possibly-change-server
+ nnimap-possibly-change-group
+ )))
(provide 'nnimap)