Kludge to fix pct-encoding of authority part of IMAP URLs in IMAIL.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 24 Oct 2010 01:21:02 +0000 (01:21 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sun, 24 Oct 2010 01:21:02 +0000 (01:21 +0000)
src/imail/imail-imap.scm

index 333b1d2c7cd55b01c020ae063b7c3f972fb3c2f4..e8c4bb15fa9d4708710ae171f8e8755c77c65c53 100644 (file)
@@ -112,16 +112,20 @@ USA.
 (define (make-imap-url-string url mailbox)
   (if (not mailbox)
       (error:wrong-type-argument mailbox string 'MAKE-IMAP-URL-STRING))
-  (string-append "//"
-                (let ((user-id (imap-url-user-id url)))
-                  (if (string=? user-id (current-user-name))
-                      ""
-                      (string-append (url:encode-string user-id) "@")))
-                (string-downcase (imap-url-host url))
-                (let ((port (imap-url-port url)))
-                  (if (= port 143)
-                      ""
-                      (string-append ":" (number->string port))))
+  (string-append (call-with-output-string
+                 (lambda (port)
+                   (write-uri-authority
+                    (make-uri-authority
+                     (let ((user-id (imap-url-user-id url)))
+                       (if (string=? user-id (current-user-name))
+                           #f
+                           user-id))
+                     (string-downcase (imap-url-host url))
+                     (let ((port (imap-url-port url)))
+                       (if (= port 143)
+                           #f
+                           port)))
+                    port)))
                 (if (or (string=? mailbox "")
                         (string=? mailbox "/"))
                     mailbox