X-Git-Url: https://cgit.sxemacs.org/?p=riece;a=blobdiff_plain;f=lisp%2Friece-300.el;h=2f758dca68632d7e8574098751b97d602e0c9390;hp=dd33c6ddac525d2e0ccf0d82ac5d5c1161725f33;hb=48907818461a11953afa47aaf2ab84aa167e3f63;hpb=c93b87a80b0cc2e0c77bb0955380bd3284c254e8 diff --git a/lisp/riece-300.el b/lisp/riece-300.el index dd33c6d..2f758dc 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -40,8 +40,7 @@ " "))) (while replies (if (string-match - (concat "^\\(" riece-user-regexp - "\\)\\(\\*\\)?=\\([-+]\\)\\([^ ]+\\)") + (concat "^\\([^ ]+\\)\\(\\*\\)?=\\([-+]\\)\\([^ ]+\\)") (car replies)) (let ((user (match-string 1 (car replies))) (operator (not (null (match-beginning 2)))) @@ -93,7 +92,7 @@ "\n"))) (defun riece-handle-301-message (prefix number name string) - (if (string-match (concat "^\\(" riece-user-regexp "\\) :?") string) + (if (string-match (concat "^\\([^ ]+\\) :?") string) (let ((user (match-string 1 string)) (message (substring string (match-end 0)))) (riece-user-toggle-away user t) @@ -127,8 +126,7 @@ (defun riece-handle-311-message (prefix number name string) (if (string-match - (concat "^\\(" riece-user-regexp - "\\) \\([^ ]+\\) \\([^ ]+\\) \\* :?") + (concat "^\\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\* :?") string) (let ((user (match-string 1 string)) (name (substring string (match-end 0))) @@ -148,7 +146,7 @@ (defun riece-handle-312-message (prefix number name string) (if (string-match - (concat "^\\(" riece-user-regexp "\\) \\([^ ]+\\) :?") + (concat "^\\([^ ]+\\) \\([^ ]+\\) :?") string) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) @@ -160,7 +158,7 @@ "\n")))) (defun riece-handle-313-message (prefix number name string) - (if (string-match (concat "^" riece-user-regexp) string) + (if (string-match "^[^ ]+" string) (let ((user (match-string 0 string))) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) @@ -174,23 +172,35 @@ (defun riece-handle-317-message (prefix number name string) (if (string-match - (concat "^\\(" riece-user-regexp "\\) \\([0-9]+\\) ") + (concat "^\\([^ ]+\\) \\([0-9]+\\) ") string) - (let ((user (match-string 1 string)) - (idle (match-string 2 string))) + (let* ((user (match-string 1 string)) + (seconds (string-to-number (match-string 2 string))) + (units (list (cons (/ seconds 60 60 24) "days") + (cons (mod (/ seconds 60 60) 24) "hours") + (cons (mod (/ seconds 60) 60) "minutes") + (cons (mod seconds 60) "seconds")))) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) (concat (riece-concat-server-name - (format "%s is %s seconds idle" + (format "%s is %s idle" (riece-format-identity (riece-make-identity user riece-server-name) t) - idle)) + (mapconcat #'identity + (delq nil + (mapcar + (lambda (unit) + (if (/= (car unit) 0) + (format "%d %s" + (car unit) (cdr unit)))) + units)) + " "))) "\n"))))) (defun riece-handle-319-message (prefix number name string) - (if (string-match (concat "^\\(" riece-user-regexp "\\) :?") string) + (if (string-match (concat "^\\([^ ]+\\) :?") string) (let ((user (match-string 1 string)) (channels (mapconcat @@ -235,7 +245,7 @@ (make-local-variable 'riece-353-message-alist) (if (string-match "^[=\*@] *\\([^ ]+\\) +:?" string) (let* ((channel (match-string 1 string)) - (entry (assoc channel riece-353-message-alist))) + (entry (riece-identity-assoc channel riece-353-message-alist t))) (if entry (setcdr entry (concat (cdr entry) @@ -414,14 +424,15 @@ (channel-identity (riece-make-identity channel riece-server-name)) (buffer (riece-channel-buffer channel-identity)) - (entry (assoc channel riece-353-message-alist)) + (entry (riece-identity-assoc channel riece-353-message-alist t)) (string (cdr entry)) (start 0) users) (if entry - (setcdr entry nil)) + (setq riece-353-message-alist + (delq entry riece-353-message-alist))) (while (string-match - (concat "\\([@+]\\)?\\(" riece-user-regexp "\\) *") + (concat "\\([@+]\\)?\\([^ ]+\\) *") string start) (put-text-property (match-beginning 2) (match-end 2) 'riece-identity