(defun nnimap-login (user password)
(cond
- ((not (nnimap-capability "LOGINDISABLED"))
- (nnimap-command "LOGIN %S %S" user password))
- ((nnimap-capability "AUTH=PLAIN")
- (nnimap-command
- "AUTHENTICATE PLAIN %s"
- (base64-encode-string
- (format "\000%s\000%s"
- (nnimap-quote-specials user)
- (nnimap-quote-specials password)))))
((nnimap-capability "AUTH=CRAM-MD5")
(erase-buffer)
(let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5"))
(rfc2104-hash 'md5 64 16 password
(base64-decode-string challenge))))
"\r\n"))
- (nnimap-wait-for-response sequence)))))
+ (nnimap-wait-for-response sequence)))
+ ((not (nnimap-capability "LOGINDISABLED"))
+ (nnimap-command "LOGIN %S %S" user password))
+ ((nnimap-capability "AUTH=PLAIN")
+ (nnimap-command
+ "AUTHENTICATE PLAIN %s"
+ (base64-encode-string
+ (format "\000%s\000%s"
+ (nnimap-quote-specials user)
+ (nnimap-quote-specials password)))))))
(defun nnimap-quote-specials (string)
(with-temp-buffer
;; Collect all the body parts.
(while (looking-at ".*BODY\\[\\([.0-9]+\\)\\]")
(setq id (match-string 1)
- bytes (nnimap-get-length))
+ bytes (or (nnimap-get-length) 0))
(beginning-of-line)
(delete-region (point) (progn (forward-line 1) (point)))
(push (list id (buffer-substring (point) (+ (point) bytes)))