X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-300.el;h=109f2f2e14b90d03c28da8de86aa0912a1c9685c;hb=03065d2ff4a647d8d1d030a211329ba1910372ac;hp=dd33c6ddac525d2e0ccf0d82ac5d5c1161725f33;hpb=c93b87a80b0cc2e0c77bb0955380bd3284c254e8;p=riece diff --git a/lisp/riece-300.el b/lisp/riece-300.el index dd33c6d..109f2f2 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -25,6 +25,9 @@ ;;; Code: (require 'riece-misc) +(require 'riece-naming) +(require 'riece-signal) +(require 'riece-display) (eval-when-compile (autoload 'riece-default-handle-numeric-reply "riece-handle")) @@ -40,8 +43,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 +95,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 +129,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 +149,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 +161,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 +175,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 +248,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 +427,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