From c93c34f7a4a82916aa1e8bd6f9e94dea23d14e6a Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 9 Nov 1999 00:52:35 +0000 Subject: [PATCH] New files. --- lisp/imap.el | 38 ++++++++++----------------------- lisp/nnimap.el | 65 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 44 insertions(+), 59 deletions(-) diff --git a/lisp/imap.el b/lisp/imap.el index 661dd0a..f3cd50d 100644 --- a/lisp/imap.el +++ b/lisp/imap.el @@ -136,6 +136,7 @@ (require 'cl) (autoload 'open-ssl-stream "ssl") (autoload 'base64-decode-string "base64") + (autoload 'base64-encode-string "mel") (autoload 'rfc2104-hash "rfc2104") (autoload 'md5 "md5") (autoload 'utf7-encode "utf7") @@ -227,8 +228,6 @@ encoded mailboxes which doesn't translate into ISO-8859-1.") (defconst imap-default-port 143) (defconst imap-default-ssl-port 993) (defconst imap-default-stream 'network) -(defconst imap-coding-system-for-read 'binary) -(defconst imap-coding-system-for-write 'binary) (defconst imap-local-variables '(imap-server imap-port imap-client-eol @@ -322,11 +321,6 @@ actually value is really the text on the continuation line.") ;; Utility functions: -(defsubst imap-disable-multibyte () - "Enable multibyte in the current buffer." - (when (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte nil))) - (defun imap-read-passwd (prompt &rest args) "Read a password using PROMPT. If ARGS, PROMPT is used as an argument to `format'." @@ -384,13 +378,13 @@ argument to `format'." (defun imap-kerberos4-open (name buffer server port) (message "Opening Kerberized IMAP connection...") (let* ((port (or port imap-default-port)) - (coding-system-for-read imap-coding-system-for-read) - (coding-system-for-write imap-coding-system-for-write) - (process (start-process - name buffer shell-file-name shell-command-switch - (format-spec - imap-imtest-program - (format-spec-make ?s server ?p (number-to-string port)))))) + (process (as-binary-process + (start-process + name buffer shell-file-name shell-command-switch + (format-spec + imap-imtest-program + (format-spec-make ?s server ?p (number-to-string port)) + ))))) (when process (with-current-buffer buffer (setq imap-client-eol "\n") @@ -403,7 +397,6 @@ argument to `format'." (sit-for 1)) (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert-buffer-substring buffer))) @@ -423,14 +416,13 @@ argument to `format'." (defun imap-ssl-open-2 (name buffer server port &optional extra-ssl-args) (let* ((port (or port imap-default-ssl-port)) - (coding-system-for-read imap-coding-system-for-read) - (coding-system-for-write imap-coding-system-for-write) (ssl-program-name imap-ssl-program) (ssl-program-arguments (append imap-ssl-arguments extra-ssl-args (list "-connect" (format "%s:%d" server port)))) (process (ignore-errors (open-ssl-stream name buffer server port)))) (when process + (set-process-coding-system process 'binary 'binary) (with-current-buffer buffer (goto-char (point-min)) (while (and (memq (process-status process) '(open run)) @@ -441,7 +433,6 @@ argument to `format'." (sit-for 1)) (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert-buffer-substring buffer))) @@ -476,9 +467,7 @@ argument to `format'." (defun imap-network-open (name buffer server port) (let* ((port (or port imap-default-port)) - (coding-system-for-read imap-coding-system-for-read) - (coding-system-for-write imap-coding-system-for-write) - (process (open-network-stream name buffer server port))) + (process (open-network-stream-as-binary name buffer server port))) (when process (while (and (memq (process-status process) '(open run)) (goto-char (point-min)) @@ -487,7 +476,6 @@ argument to `format'." (sit-for 1)) (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert-buffer-substring buffer))) @@ -619,7 +607,6 @@ necessery. If nil, the buffer name is generated." (if (imap-opened buffer) (imap-close buffer)) (mapc 'make-variable-buffer-local imap-local-variables) - (imap-disable-multibyte) (buffer-disable-undo) (setq imap-server (or server imap-server)) (setq imap-port (or port imap-port)) @@ -1240,7 +1227,6 @@ BODY." (setq cmdstr (concat cmdstr imap-client-eol)) (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert cmdstr))) @@ -1276,7 +1262,6 @@ BODY." (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert-buffer-substring cmd))) @@ -1334,7 +1319,6 @@ literals. Return nil if no complete line has arrived." (insert string) (and imap-log (with-current-buffer (get-buffer-create imap-log) - (imap-disable-multibyte) (buffer-disable-undo) (goto-char (point-max)) (insert string))) @@ -1399,7 +1383,7 @@ literals. Return nil if no complete line has arrived." (defsubst imap-parse-string () (let (strstart strend) - (cond ((and (eq (char-after) ?\") + (cond ((and (eq (char-after (point)) ?\") (setq strstart (point)) (setq strend (search-forward "\"" nil t 2))) (buffer-substring-no-properties (1+ strstart) (1- strend))) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index c8c57f9..f8c4a66 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -65,7 +65,6 @@ (require 'nnoo) (require 'nnmail) (require 'nnheader) -(require 'mm-util) (require 'gnus) (require 'gnus-async) (require 'gnus-range) @@ -370,35 +369,37 @@ If EXAMINE is non-nil the group is selected read-only." (with-current-buffer nntp-server-buffer (nnheader-insert-nov (with-current-buffer nnimap-server-buffer - (vector imap-current-message - (nnimap-replace-whitespace - (imap-message-envelope-subject imap-current-message)) - (nnimap-replace-whitespace - (imap-envelope-from - (car-safe (imap-message-envelope-from - imap-current-message)))) - (nnimap-replace-whitespace - (imap-message-envelope-date imap-current-message)) - (nnimap-replace-whitespace - (imap-message-envelope-message-id imap-current-message)) - (nnimap-replace-whitespace - (let ((str (if (imap-capability 'IMAP4rev1) - (nth 2 (assoc - "HEADER.FIELDS REFERENCES" - (imap-message-get - imap-current-message 'BODYDETAIL))) - (imap-message-get imap-current-message - 'RFC822.HEADER)))) - (if (> (length str) (length "References: ")) - (substring str (length "References: ")) - (if (and (setq str (imap-message-envelope-in-reply-to - imap-current-message)) - (string-match "<[^>]+>" str)) - (substring str (match-beginning 0) (match-end 0)))))) - (imap-message-get imap-current-message 'RFC822.SIZE) - (imap-body-lines (imap-message-body imap-current-message)) - nil ;; xref - nil))))) ;; extra-headers + (make-full-mail-header + imap-current-message + (or (nnimap-replace-whitespace + (imap-message-envelope-subject imap-current-message)) + "(none)") + (nnimap-replace-whitespace + (imap-envelope-from + (car-safe (imap-message-envelope-from + imap-current-message)))) + (nnimap-replace-whitespace + (imap-message-envelope-date imap-current-message)) + (nnimap-replace-whitespace + (imap-message-envelope-message-id imap-current-message)) + (nnimap-replace-whitespace + (let ((str (if (imap-capability 'IMAP4rev1) + (nth 2 (assoc + "HEADER.FIELDS REFERENCES" + (imap-message-get + imap-current-message 'BODYDETAIL))) + (imap-message-get imap-current-message + 'RFC822.HEADER)))) + (if (> (length str) (length "References: ")) + (substring str (length "References: ")) + (if (and (setq str (imap-message-envelope-in-reply-to + imap-current-message)) + (string-match "<[^>]+>" str)) + (substring str (match-beginning 0) (match-end 0)))))) + (imap-message-get imap-current-message 'RFC822.SIZE) + (imap-body-lines (imap-message-body imap-current-message)) + nil ;; xref + nil))))) ;; extra-headers (defun nnimap-retrieve-which-headers (articles fetch-old) "Get a range of articles to fetch based on ARTICLES and FETCH-OLD." @@ -431,7 +432,7 @@ If EXAMINE is non-nil the group is selected read-only." (if (or nnmail-use-long-file-names (file-exists-p (concat dir file))) (concat dir file) - (concat dir (mm-encode-coding-string + (concat dir (encode-coding-string (nnheader-replace-chars-in-string file ?. ?/) nnmail-pathname-coding-system))))) @@ -439,7 +440,7 @@ If EXAMINE is non-nil the group is selected read-only." (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 (progn (goto-char (point-min)) (when (not (eobp)) -- 1.7.10.4