From: Lars Magne Ingebrigtsen Date: Sat, 18 Sep 2010 20:55:03 +0000 (+0200) Subject: Allow sending \n instead of \r\n on 'shell streams. X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=7910436193727860c0055d1d558838639a507a14 Allow sending \n instead of \r\n on 'shell streams. (nnimap): Add a `newlinep' field to keep track of end-of-line conventions. Don't send CRLF to things that don't want it. (nnimap-request-accept-article): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2278db340..12a7a07c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -8,6 +8,10 @@ (nnimap-wait-for-response): Be a bit more lax in finding the end of the command we're looking for. This helps when the server sends more responses after we've gotten everything we expected. + (nnimap): Add a `newlinep' field to keep track of end-of-line + conventions. + Don't send CRLF to things that don't want it. + (nnimap-request-accept-article): Ditto. 2010-09-18 Julien Danjou diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 2a83bdeb6..601683e59 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -78,7 +78,7 @@ not done by default on servers that doesn't support that command.") "Internal variable with default value for `nnimap-split-download-body'.") (defstruct nnimap - group process commands capabilities select-result) + group process commands capabilities select-result newlinep) (defvar nnimap-object nil) @@ -263,6 +263,8 @@ not done by default on servers that doesn't support that command.") (delete-process (nnimap-process nnimap-object)) (setq nnimap-object nil)))) (when nnimap-object + (when (eq nnimap-stream 'shell) + (setf (nnimap-newlinep nnimap-object) t)) (setf (nnimap-capabilities nnimap-object) (mapcar #'upcase @@ -489,7 +491,10 @@ not done by default on servers that doesn't support that command.") "APPEND %S {%d}" (utf7-encode group t) (length message))) (process-send-string (get-buffer-process (current-buffer)) message) - (process-send-string (get-buffer-process (current-buffer)) "\r\n") + (process-send-string (get-buffer-process (current-buffer)) + (if (nnimap-newlinep nnimap-object) + "\n" + "\r\n")) (let ((result (nnimap-get-response sequence))) (when result (cons group @@ -773,9 +778,12 @@ not done by default on servers that doesn't support that command.") (process-send-string (get-buffer-process (current-buffer)) (nnimap-log-command - (format "%d %s\r\n" + (format "%d %s%s\n" (incf nnimap-sequence) - (apply #'format args)))) + (apply #'format args) + (if (nnimap-newlinep nnimap-object) + "" + "\r")))) nnimap-sequence) (defun nnimap-log-command (command)