(elmo-parse-token): Add optional argument `requirement'.
(elmo-parse-prefixed-element): Likewise.
* elmo-net.el (elmo-net-quote-chars): Renamed from
`elmo-net-quote-chars-regexp'.
(elmo-net-format-quoted): Add optional argument `extra-chars'.
* elmo-pop3.el (elmo-folder-initialize): Fix the token separators
by info document. Check token `uidl' is started an alphabet.
* elmo-nntp.el (elmo-folder-initialize): Fix the token separators
by info document. Check token `user' is started an alphabet.
* elmo-imap4.el (elmo-folder-initialize): Ditto.
(elmo-folder-list-subfolders): Quote user.
+2005-06-07 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-util.el (elmo-token-valid-p): New function.
+ (elmo-parse-token): Add optional argument `requirement'.
+ (elmo-parse-prefixed-element): Likewise.
+
+ * elmo-net.el (elmo-net-quote-chars): Renamed from
+ `elmo-net-quote-chars-regexp'.
+ (elmo-net-format-quoted): Add optional argument `extra-chars'.
+
+ * elmo-pop3.el (elmo-folder-initialize): Fix the token separators
+ by info document. Check token `uidl' is started an alphabet.
+
+ * elmo-nntp.el (elmo-folder-initialize): Fix the token separators
+ by info document. Check token `user' is started an alphabet.
+
+ * elmo-imap4.el (elmo-folder-initialize): Ditto.
+ (elmo-folder-list-subfolders): Quote user.
+
2005-06-05 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo-util.el (elmo-quoted-specials-list): New constant.
(setq default-user (elmo-match-string 1 default-server))
(setq default-server (elmo-match-string 2 default-server)))
;; 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) "/@:!"
+ "^[A-Za-z]+"))
(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)
elmo-imap4-default-user))
(not (eq (elmo-net-folder-auth-internal folder)
(or elmo-imap4-default-authenticate-type 'clear))))
- (setq append-serv (concat ":" (elmo-net-folder-user-internal folder))))
+ (setq append-serv (concat ":"
+ (elmo-net-format-quoted
+ (elmo-net-folder-user-internal folder) "/"))))
(unless (eq (elmo-net-folder-auth-internal folder)
(or elmo-imap4-default-authenticate-type 'clear))
(setq append-serv
(cdr result)))
folder (concat prefix
(elmo-net-format-quoted
- (elmo-imap4-decode-folder-string folder))
+ (elmo-imap4-decode-folder-string folder) ":")
(and append-serv
(eval append-serv)))
ret (append ret (if has-child-p
(mapcar (lambda (fld)
(concat prefix
(elmo-net-format-quoted
- (elmo-imap4-decode-folder-string fld))
+ (elmo-imap4-decode-folder-string fld) ":")
(and append-serv
(eval append-serv))))
result))))
(setq alist (cdr alist)))
spec))
-(defconst elmo-net-quote-chars-regexp "[@:!]")
+(defconst elmo-net-quote-chars "@:!")
-(defun elmo-net-format-quoted (string)
- (if (string-match elmo-net-quote-chars-regexp string)
+(defun elmo-net-format-quoted (string &optional extra-chars)
+ (if (string-match (concat "[" elmo-net-quote-chars extra-chars "]")
+ string)
(elmo-quoted-token string)
string))
elmo-network-stream-type-alist))
elmo-network-stream-type-alist))
explicit-user parse)
- (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) "@:!"
+ "^[A-Za-z]+"))
(elmo-net-folder-set-user-internal folder
(if (eq (length (car parse)) 0)
(unless explicit-user
elmo-network-stream-type-alist))
parse)
;; 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) "@:!" "^[a-z]+"))
(elmo-pop3-folder-set-use-uidl-internal folder
(if (eq (length (car parse)) 0)
elmo-pop3-default-use-uidl
(std11-wrap-as-quoted-pairs string elmo-quoted-specials-list)
"\""))
-(defun elmo-parse-token (string &optional seps)
+(defun elmo-token-valid-p (token requirement)
+ (cond ((null requirement))
+ ((stringp requirement)
+ (string-match requirement token))
+ ((functionp requirement)
+ (funcall requirement token))))
+
+(defun elmo-parse-token (string &optional seps requirement)
"Parse atom from STRING using SEPS as a string of separator char list."
(let ((len (length string))
(seps (and seps (string-to-char-list seps)))
(t (setq content (cons c content)
i (1+ i)))))
(if in (error "Parse error in quoted"))
- (cons (if (null content) "" (char-list-to-string (nreverse content)))
- (substring string i)))))
-
-(defun elmo-parse-prefixed-element (prefix string &optional seps)
- (if (and (not (eq (length string) 0))
- (eq (aref string 0) prefix))
- (elmo-parse-token (substring string 1) seps)
- (cons "" string)))
+ (let ((atom (if (null content)
+ ""
+ (char-list-to-string (nreverse content)))))
+ (if (elmo-token-valid-p atom requirement)
+ (cons atom (substring string i))
+ (cons "" string))))))
+
+(defun elmo-parse-prefixed-element (prefix string &optional seps requirement)
+ (let (parsed)
+ (if (and (not (eq (length string) 0))
+ (eq (aref string 0) prefix)
+ (setq parsed (elmo-parse-token (substring string 1) seps))
+ (elmo-token-valid-p (car parsed) requirement))
+ parsed
+ (cons "" string))))
;;; Number set defined by OKAZAKI Tetsurou <okazaki@be.to>
;;