Implement shell connection.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 17 Sep 2010 18:06:44 +0000 (20:06 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 17 Sep 2010 18:06:44 +0000 (20:06 +0200)
* nnimap.el (nnimap-open-shell-stream): New function.
(nnimap-open-connection): Use it.

lisp/ChangeLog
lisp/nnimap.el

index 0c8bf2e..4569b24 100644 (file)
@@ -1,5 +1,8 @@
 2010-09-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * nnimap.el (nnimap-open-shell-stream): New function.
+       (nnimap-open-connection): Use it.
+
        * utf7.el (utf7-encode): Autoload.
 
        * nnmail.el (nnmail-inhibit-default-split-group): New internal variable
index 548b6ec..c469032 100644 (file)
@@ -43,6 +43,12 @@ it will default to `imap'.")
   "How nnimap will talk to the IMAP server.
 Values are `ssl' and `network'.")
 
+(defvoo nnimap-shell-program (if (boundp 'imap-shell-program)
+                                (if (listp imap-shell-program)
+                                    (car imap-shell-program)
+                                  imap-shell-program)
+                              "ssh %s imapd"))
+
 (defvoo nnimap-inbox nil
   "The mail box where incoming mail arrives and should be split out of.")
 
@@ -172,18 +178,35 @@ not done by default on servers that doesn't support that command.")
     (push (list buffer (current-buffer)) nnimap-connection-alist)
     (current-buffer)))
 
+(defun nnimap-open-shell-stream (name buffer host port)
+  (let ((process (start-process name buffer shell-file-name
+                               shell-command-switch
+                               (format-spec
+                                nnimap-shell-program
+                                (format-spec-make
+                                 ?s host
+                                 ?p port)))))
+    process))
+
 (defun nnimap-open-connection (buffer)
   (with-current-buffer (nnimap-make-process-buffer buffer)
-    (let ((credentials
-          (cond
-           ((eq nnimap-stream 'network)
-            (open-network-stream "*nnimap*" (current-buffer) nnimap-address
-                                 (or nnimap-server-port "imap"))
-            (netrc-credentials nnimap-address "imap"))
-           ((eq nnimap-stream 'ssl)
-            (open-tls-stream "*nnimap*" (current-buffer) nnimap-address
-                             (or nnimap-server-port "imaps"))
-            (netrc-credentials nnimap-address "imaps" "imap")))))
+    (let* ((coding-system-for-read 'binary)
+          (coding-system-for-write 'binary)
+          (credentials
+           (cond
+            ((eq nnimap-stream 'network)
+             (open-network-stream "*nnimap*" (current-buffer) nnimap-address
+                                  (or nnimap-server-port "imap"))
+             (netrc-credentials nnimap-address "imap"))
+            ((eq nnimap-stream 'stream)
+             (nnimap-open-shell-stream
+              "*nnimap*" (current-buffer) nnimap-address
+              (or nnimap-server-port "imap"))
+             (netrc-credentials nnimap-address "imap"))
+            ((eq nnimap-stream 'ssl)
+             (open-tls-stream "*nnimap*" (current-buffer) nnimap-address
+                              (or nnimap-server-port "imaps"))
+             (netrc-credentials nnimap-address "imaps" "imap")))))
       (setf (nnimap-process nnimap-object)
            (get-buffer-process (current-buffer)))
       (unless credentials
@@ -904,3 +927,6 @@ not done by default on servers that doesn't support that command.")
 (provide 'nnimap)
 
 ;;; nnimap.el ends here
+bash: imapd: command not found
+
+Process name exited abnormally with code 127