(elmo-quoted-token): New function.
* elmo-net.el (elmo-net-quote-chars-regexp): New constant.
(elmo-net-format-quoted): New function.
(elmo-net-parse-network): Ditto.
(elmo-folder-initialize): Use it.
* elmo-nntp.el (elmo-folder-initialize): Use
`elmo-net-parse-network' to parse network specification instead of
`elmo-folder-initialize#elmo-net'.
* elmo-pop3.el (elmo-folder-initialize): Ditto.
* elmo-imap4.el (elmo-folder-initialize): Ditto.
(elmo-folder-list-subfolders): Quote folder name by
`elmo-net-format-quoted'.
+2005-06-05 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-util.el (elmo-quoted-specials-list): New constant.
+ (elmo-quoted-token): New function.
+
+ * elmo-net.el (elmo-net-quote-chars-regexp): New constant.
+ (elmo-net-format-quoted): New function.
+ (elmo-net-parse-network): Ditto.
+ (elmo-folder-initialize): Use it.
+
+ * elmo-nntp.el (elmo-folder-initialize): Use
+ `elmo-net-parse-network' to parse network specification instead of
+ `elmo-folder-initialize#elmo-net'.
+
+ * elmo-pop3.el (elmo-folder-initialize): Ditto.
+
+ * elmo-imap4.el (elmo-folder-initialize): Ditto.
+ (elmo-folder-list-subfolders): Quote folder name by
+ `elmo-net-format-quoted'.
+
2005-05-22 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo-nntp.el (elmo-nntp-use-server-search-p): New function.
(elmo-imap4-forward)
(nreverse body)))))
-(luna-define-method elmo-folder-initialize :around ((folder
- elmo-imap4-folder)
- name)
+(luna-define-method elmo-folder-initialize ((folder elmo-imap4-folder) name)
(let ((default-user elmo-imap4-default-user)
(default-server elmo-imap4-default-server)
(default-port elmo-imap4-default-port)
;; "hoge%imap.server@gateway".
(setq default-user (elmo-match-string 1 default-server))
(setq default-server (elmo-match-string 2 default-server)))
- (setq name (luna-call-next-method))
;; mailbox
- (setq parse (elmo-parse-token name ":"))
+ (setq parse (elmo-parse-token name ":/@"))
(elmo-imap4-folder-set-mailbox-internal folder
(elmo-imap4-encode-folder-string
(car parse)))
;; user
- (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "/"))
+ (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "/@"))
(elmo-net-folder-set-user-internal folder
(if (eq (length (car parse)) 0)
default-user
(car parse)))
;; auth
- (setq parse (elmo-parse-prefixed-element ?/ (cdr parse)))
+ (setq parse (elmo-parse-prefixed-element ?/ (cdr parse) "@"))
(elmo-net-folder-set-auth-internal
folder
(if (eq (length (car parse)) 0)
(or elmo-imap4-default-authenticate-type 'clear)
(intern (car parse))))
+ ;; network
+ (elmo-net-parse-network folder (cdr parse))
(unless (elmo-net-folder-server-internal folder)
(elmo-net-folder-set-server-internal folder default-server))
(unless (elmo-net-folder-port-internal folder)
fld))
(cdr result)))
folder (concat prefix
- (elmo-imap4-decode-folder-string folder)
+ (elmo-net-format-quoted
+ (elmo-imap4-decode-folder-string folder))
(and append-serv
(eval append-serv)))
ret (append ret (if has-child-p
(list folder)))))
ret)
(mapcar (lambda (fld)
- (concat prefix (elmo-imap4-decode-folder-string fld)
+ (concat prefix
+ (elmo-net-format-quoted
+ (elmo-imap4-decode-folder-string fld))
(and append-serv
(eval append-serv))))
result))))
(setq alist (cdr alist)))
spec))
-(luna-define-method elmo-folder-initialize ((folder
- elmo-net-folder)
- name)
+(defconst elmo-net-quote-chars-regexp "[@:!]")
+
+(defun elmo-net-format-quoted (string)
+ (if (string-match elmo-net-quote-chars-regexp string)
+ (elmo-quoted-token string)
+ string))
+
+(defun elmo-net-parse-network (folder network)
+ (let (parse)
+ ;; server
+ (setq parse (elmo-parse-prefixed-element ?@ network ":!"))
+ (when (> (length (car parse)) 0)
+ (elmo-net-folder-set-server-internal folder (car parse)))
+ ;; port
+ (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "!"))
+ (when (> (length (car parse)) 0)
+ (elmo-net-folder-set-port-internal folder (string-to-int (car parse))))
+ ;; stream-type
+ (elmo-net-folder-set-stream-type-internal
+ folder
+ (assoc (cdr parse) elmo-network-stream-type-alist))))
+
+(luna-define-method elmo-folder-initialize ((folder elmo-net-folder) name)
;; user and auth should be set in subclass.
(when (string-match "\\(@[^@:/!]+\\)?\\(:[0-9]+\\)?\\(!.*\\)?$" name)
- (if (match-beginning 1)
- (elmo-net-folder-set-server-internal
- folder
- (elmo-match-substring 1 name 1)))
- (if (match-beginning 2)
- (elmo-net-folder-set-port-internal
- folder
- (string-to-int (elmo-match-substring 2 name 1))))
- (if (match-beginning 3)
- (elmo-net-folder-set-stream-type-internal
- folder
- (assoc (elmo-match-string 3 name)
- elmo-network-stream-type-alist)))
- (substring name 0 (match-beginning 0))))
+ (elmo-net-parse-network folder (substring name (match-beginning 0))))
+ folder)
(luna-define-method elmo-net-port-info ((folder elmo-net-folder))
(list (elmo-net-folder-server-internal folder)
(group temp-crosses reads))
(luna-define-internal-accessors 'elmo-nntp-folder))
-(luna-define-method elmo-folder-initialize :around ((folder
- elmo-nntp-folder)
- name)
+(luna-define-method elmo-folder-initialize ((folder elmo-nntp-folder) name)
(let ((elmo-network-stream-type-alist
(if elmo-nntp-stream-type-alist
(setq elmo-network-stream-type-alist
elmo-network-stream-type-alist))
elmo-network-stream-type-alist))
explicit-user parse)
- (setq name (luna-call-next-method))
- (setq parse (elmo-parse-token name ":"))
+ (setq parse (elmo-parse-token name ":@"))
(elmo-nntp-folder-set-group-internal folder
(elmo-nntp-encode-group-string
(car parse)))
(setq explicit-user (eq ?: (string-to-char (cdr parse))))
- (setq parse (elmo-parse-prefixed-element ?: (cdr parse)))
+ (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "@"))
(elmo-net-folder-set-user-internal folder
(if (eq (length (car parse)) 0)
(unless explicit-user
elmo-nntp-default-user)
(car parse)))
+ ;; network
+ (elmo-net-parse-network folder (cdr parse))
(unless (elmo-net-folder-server-internal folder)
(elmo-net-folder-set-server-internal folder
elmo-nntp-default-server))
(use-uidl location-alist))
(luna-define-internal-accessors 'elmo-pop3-folder))
-(luna-define-method elmo-folder-initialize :around ((folder
- elmo-pop3-folder)
- name)
+(luna-define-method elmo-folder-initialize ((folder elmo-pop3-folder) name)
(let ((elmo-network-stream-type-alist
(if elmo-pop3-stream-type-alist
(append elmo-pop3-stream-type-alist
elmo-network-stream-type-alist)
elmo-network-stream-type-alist))
parse)
- (setq name (luna-call-next-method))
;; user
- (setq parse (elmo-parse-token name "/:"))
+ (setq parse (elmo-parse-token name "/:@"))
(elmo-net-folder-set-user-internal folder
(if (eq (length (car parse)) 0)
elmo-pop3-default-user
(car parse)))
;; auth
- (setq parse (elmo-parse-prefixed-element ?/ (cdr parse) ":"))
+ (setq parse (elmo-parse-prefixed-element ?/ (cdr parse) ":@"))
(elmo-net-folder-set-auth-internal folder
(if (eq (length (car parse)) 0)
elmo-pop3-default-authenticate-type
(intern (downcase (car parse)))))
;; uidl
- (setq parse (elmo-parse-prefixed-element ?: (cdr parse)))
+ (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "@"))
(elmo-pop3-folder-set-use-uidl-internal folder
(if (eq (length (car parse)) 0)
elmo-pop3-default-use-uidl
(string= (car parse) "uidl")))
+ ;; network
+ (elmo-net-parse-network folder (cdr parse))
(unless (elmo-net-folder-server-internal folder)
(elmo-net-folder-set-server-internal folder
elmo-pop3-default-server))
newtext)))
;;; Folder parser utils.
+(defconst elmo-quoted-specials-list '(?\\ ?\"))
+
+(defun elmo-quoted-token (string)
+ (concat "\""
+ (std11-wrap-as-quoted-pairs string elmo-quoted-specials-list)
+ "\""))
+
(defun elmo-parse-token (string &optional seps)
"Parse atom from STRING using SEPS as a string of separator char list."
(let ((len (length string))