(expand-file-name name (expand-file-name server riece-log-directory))
(expand-file-name name riece-log-directory))))
+(defun riece-log-get-directory-1 (identity)
+ (let ((prefix (riece-identity-canonicalize-prefix
+ (riece-identity-prefix identity)))
+ (server (riece-identity-server identity))
+ (map (assoc (riece-format-identity identity) riece-log-directory-map))
+ name)
+ (if map
+ (setq name (cdr map))
+ (expand-file-name (riece-log-encode-file-name prefix)
+ (expand-file-name
+ (riece-log-encode-file-name (concat "." server))
+ riece-log-directory)))))
+
(defun riece-log-encode-file-name (file-name)
(if riece-log-file-name-coding-system
(setq file-name
(encode-coding-string file-name
riece-log-file-name-coding-system)))
- (let ((index 0))
- (while (string-match "[^-0-9A-Za-z=_.\x80-\xFF]" file-name index)
- (setq file-name (replace-match
- (format "=%02X"
- (aref file-name (match-beginning 0)))
+ (let ((index 0)
+ c)
+ (while (string-match "[^-0-9A-Za-z=_\x80-\xFF]" file-name index)
+ (setq c (aref file-name (match-beginning 0))
+ file-name (replace-match
+ (if (eq c ?=)
+ "=="
+ (format "=%02X" c))
nil t file-name)
index (+ 3 index)))
file-name))
(defun riece-log-decode-file-name (file-name)
(let ((index 0))
- (while (string-match "=\\([0-7][0-9A-F]\\)" file-name index)
+ (while (string-match "==\\|=\\([0-7][0-9A-F]\\)" file-name index)
(setq file-name (replace-match
- (char-to-string
- (car (read-from-string
- (concat "?\\x" (match-string 1 file-name)))))
+ (if (eq (aref file-name (match-end 0)) ?=)
+ "="
+ (char-to-string
+ (car (read-from-string
+ (concat "?\\x" (match-string 1 file-name))))))
nil t file-name)
index (1+ index)))
file-name)