X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-log.el;h=84ff244a3984b577bcbcfe42aa2d8af7b93a849a;hb=c29e67d9775fc091a53a59d8fb315ef2e05bd46b;hp=fe4a25cb5b70496e1a43811168baf7c62fa4fe40;hpb=befd19f4c604901fe3e5ac71ac7151a6e3d3dc60;p=riece diff --git a/lisp/riece-log.el b/lisp/riece-log.el index fe4a25c..84ff244 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -26,7 +26,7 @@ ;; This add-on saves irc logs for every channel. ;; To use, add the following line to your ~/.riece/init.el: -;; (add-to-list 'riece-addons 'riece-log t) +;; (add-to-list 'riece-addons 'riece-log) ;;; Code: @@ -43,7 +43,7 @@ :group 'riece-log) (defcustom riece-log-directory-map nil - "The map of channel name and directory name." + "*The map of channel name and directory name." :type '(repeat (cons (string :tag "Channel name") (string :tag "Directory name"))) :group 'riece-log) @@ -77,22 +77,21 @@ If integer, flash back only this line numbers. t means all lines." (riece-log-get-directory identity))) (defun riece-log-get-directory (identity) - (let ((channel (riece-identity-prefix identity)) - (server (riece-identity-server identity))) - (let ((map (assoc channel riece-log-directory-map))) - (if map - (expand-file-name (cdr map) riece-log-directory) - (if (string-match (concat riece-channel-regexp - "\\([^:]+\\)\\(:\\*\\.\\(.*\\)\\)?") channel) - (let ((name (match-string 1 channel)) - (suffix (match-string 3 channel))) - (let ((name (if suffix (concat name "-" suffix) name))) - (if server - (expand-file-name - name - (expand-file-name server riece-log-directory)) - (expand-file-name name riece-log-directory)))) - riece-log-directory))))) + (let* ((channel (riece-identity-prefix identity)) + (server (riece-identity-server identity)) + (map (assoc channel riece-log-directory-map)) + name) + (cond (map (setq name (cdr map))) + ((string-match riece-channel-regexp channel) + (let ((suffix (match-string 2 channel))) + (setq name (substring channel (match-end 1) (match-beginning 2))) + (when (and (stringp suffix) + (string-match "^:\\*\\.\\(.*\\)" suffix)) + (setq name (concat name "-" (match-string 1 suffix)))))) + (t (setq name "priv"))) + (if server + (expand-file-name name (expand-file-name server riece-log-directory)) + (expand-file-name name riece-log-directory)))) (defun riece-log-flashback (identity) (when riece-log-flashback