From: yamaoka Date: Sat, 18 Feb 2006 03:40:47 +0000 (+0000) Subject: Synch with flim-1_14 branch. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5dbae50f8822c11ab15b5650a78d1bd72b9df60a;p=elisp%2Fflim.git Synch with flim-1_14 branch. --- diff --git a/ChangeLog b/ChangeLog index 669a673..72e1506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-18 Hiroya Murata + + * smtp.el (smtp-debug): New user option. + (smtp-read-response): Treat a line break code loosely. If + smtp-debug is non-nil, show an invalid response. + 2005-12-25 Katsumi Yamaoka * eword-decode.el: Change the way to decode successive diff --git a/smtp.el b/smtp.el index 0fcf274..af9e404 100644 --- a/smtp.el +++ b/smtp.el @@ -148,6 +148,11 @@ For instance, the value \"Sending (%k)...\" shows like (const :tag "Don't show progress message" nil)) :group 'smtp) +(defcustom smtp-debug nil + "*If non-nil, smtp debug info printout into messages." + :type 'boolean + :group 'smtp) + (defvar sasl-mechanisms) ;;;###autoload @@ -455,7 +460,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." (let ((smtp-use-sasl nil) (smtp-use-starttls-ignore-error t)) (funcall smtp-submit-package-function package))) - (setq servers (cdr servers))))) + (setq servers (cdr servers))))) ;;; @ hook methods for `smtp-submit-package' ;;; @@ -653,26 +658,31 @@ BUFFER may be a buffer or a buffer name which contains mail message." response) (while response-continue (goto-char smtp-read-point) - (while (not (search-forward smtp-end-of-line nil t)) + (while (not (re-search-forward "\r?\n" nil t)) (unless (smtp-connection-opened connection) (signal 'smtp-error "Connection closed")) (accept-process-output (smtp-connection-process-internal connection)) (goto-char smtp-read-point)) - (if decoder - (let ((string (buffer-substring smtp-read-point (- (point) 2)))) - (delete-region smtp-read-point (point)) - (insert (funcall decoder string) smtp-end-of-line))) - (setq response - (nconc response - (list (buffer-substring - (+ 4 smtp-read-point) - (- (point) 2))))) - (goto-char - (prog1 smtp-read-point - (setq smtp-read-point (point)))) - (if (looking-at "[1-5][0-9][0-9] ") - (setq response (cons (read (point-marker)) response) - response-continue nil))) + (let ((bol smtp-read-point) + (eol (match-beginning 0))) + (when decoder + (let ((string (buffer-substring bol eol))) + (delete-region bol (point)) + (insert (funcall decoder string)) + (setq eol (point)) + (insert smtp-end-of-line))) + (setq smtp-read-point (point)) + (goto-char bol) + (cond + ((looking-at "[1-5][0-9][0-9]\\([ -]\\)") + (setq response + (nconc response + (list (buffer-substring (match-end 0) eol)))) + (when (string= (match-string 1) " ") + (setq response (cons (read (point-marker)) response) + response-continue nil))) + (smtp-debug + (message "Invalid response: %s" (buffer-substring bol eol)))))) response)) (defun smtp-send-command (connection command)