From: ueno Date: Mon, 26 Aug 2002 06:28:19 +0000 (+0000) Subject: * liece-handle.el (liece-handle-mode-message): Care X-Git-Tag: liece-1_4_8~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=ecc70c8ff36ede8b6a0809f7f94d1fd0b0ce4e05;p=elisp%2Fliece.git * liece-handle.el (liece-handle-mode-message): Care liece-channel-set-* are defined as macros. * liece-inlines.el (string-equal-ignore-case): Don't use compare-strings. (string-list-member-ignore-case): Don't use member-ignore-case. Suggested by "Akinori MUSHA" . [cf. ] --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d1fdaa6..34463ec 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2002-08-26 Daiki Ueno + + * liece-handle.el (liece-handle-mode-message): Care + liece-channel-set-* are defined as macros. + * liece-inlines.el (string-equal-ignore-case): Don't use + compare-strings. + (string-list-member-ignore-case): Don't use member-ignore-case. + Suggested by "Akinori MUSHA" . + [cf. ] + 2002-05-19 Daiki Ueno * liece-xemacs.el (liece-xemacs-modeline-glyph): Check 'xbm. diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index e84f045..4f0863e 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -261,38 +261,43 @@ (defun* liece-handle-mode-message (prefix rest) (if (liece-handle-check-changes-ignored) (return-from liece-handle-mode-message)) - (let ((chnl " ") (str "") mflag mflags marg margs val md chnlp) - (or (and (string-match "\\([^ ]*\\) +:?" rest) - (setq chnl (match-string 1 rest) - str (substring rest (match-end 0)) - chnlp (liece-channel-p chnl) - str (if (= (aref str (1- (length str))) ? ) - (substring str 0 -1) str) - chnl (liece-channel-virtual chnl))) - (and (string-match " +:" rest) - (setq str (substring rest (match-end 0)))) - (return-from liece-handle-mode-message)) - + (let (mflgs margs val chnl mode chnlp) + (if (string-match "\\([^ ]*\\) *:?" rest) + (progn + (setq chnl (match-string 1 rest) + mode (substring rest (match-end 0))) + (if (liece-channel-p chnl) + (setq chnl (liece-channel-virtual chnl) chnlp t)) + (if (string-match " *$" mode) + (setq mode (substring mode 0 (match-beginning 0))))) + (return-from liece-handle-mode-message)) ;; parse modes - (when (string-match "\\([^ ]*\\) +" str) - (setq mflag (match-string 1 str) - marg (substring str (match-end 0)) - mflags (liece-string-to-list mflag)) - (while (string-match "^\\([^ ]*\\) +" marg) - (setq margs (cons (match-string 1 marg) margs) - marg (substring marg (match-end 0)))) - (or (string= marg "") (setq margs (cons marg margs))) - (while (setq md (pop mflags)) - (cond ((eq ?- md) (setq val nil)) - ((eq ?+ md) (setq val t)) - ((eq ?o md) (liece-channel-set-operator chnl (pop margs) val)) - ((eq ?v md) (liece-channel-set-voice chnl (pop margs) val)) - ((eq ?b md) (liece-channel-set-ban chnl (pop margs) val)) - ((eq ?e md) (liece-channel-set-exception chnl (pop margs) val)) - ((eq ?I md) (liece-channel-set-invite chnl (pop margs) val)) - (chnlp (liece-channel-set-mode val md chnl)) - (t (liece-nick-set-mode val md chnl))))) - + (when (string-match "\\([^ ]*\\) *" mode) + (setq mflgs (liece-string-to-list (match-string 1 mode)) + margs (delete "" (split-string + (substring mode (match-end 0)) + "[ ]+"))) + (while mflgs + (cond ((eq ?- (car mflgs)) (setq val nil)) + ((eq ?+ (car mflgs)) (setq val t)) + ((eq ?o (car mflgs)) + (liece-channel-set-operator chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?v (car mflgs)) + (liece-channel-set-voice chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?b (car mflgs)) + (liece-channel-set-ban chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?e (car mflgs)) + (liece-channel-set-exception chnl (car margs) val) + (setq margs (cdr margs))) + ((eq ?I (car mflgs)) + (liece-channel-set-invite chnl (car margs) val) + (setq margs (cdr margs))) + (chnlp (liece-channel-set-mode val (car mflgs) chnl)) + (t (liece-nick-set-mode val (car mflgs) chnl))) + (setq mflgs (cdr mflgs)))) (liece-set-channel-indicator) (cond (liece-compress-changes @@ -303,26 +308,26 @@ (regexp-quote liece-change-prefix) (regexp-quote chnl) (regexp-quote prefix))) (default (format (_ "%sNew mode for %s set by %s: %s\n") - liece-change-prefix chnl prefix str))) + liece-change-prefix chnl prefix mode))) (liece-replace (liece-pick-buffer chnl) - match default text (concat ", " str "\n")) + match default text (concat ", " mode "\n")) (liece-replace (if (and liece-current-channel (liece-channel-equal chnl liece-current-channel)) liece-D-buffer (append liece-D-buffer liece-O-buffer)) - match default text (concat ", " str "\n")))) + match default text (concat ", " mode "\n")))) (t (liece-insert-change (liece-pick-buffer chnl) (format (_ "New mode for %s set by %s: %s\n") - chnl prefix str)) + chnl prefix mode)) (liece-insert-change (if (and liece-current-channel (liece-channel-equal chnl liece-current-channel)) liece-D-buffer (append liece-D-buffer liece-O-buffer)) (format (_ "New mode for %s set by %s: %s\n") - chnl prefix str)))))) + chnl prefix mode)))))) (defun* liece-handle-kick-message (prefix rest) (if (/= 3 (length (setq rest (liece-split-line rest)))) diff --git a/lisp/liece-inlines.el b/lisp/liece-inlines.el index e8a283e..416d24c 100644 --- a/lisp/liece-inlines.el +++ b/lisp/liece-inlines.el @@ -44,21 +44,15 @@ (defmacro string-join (strlst &optional del) `(mapconcat #'identity ,strlst ,del)) -(static-if (subr-fboundp 'compare-strings) - (defmacro string-equal-ignore-case (s1 s2) - `(eq t (compare-strings ,s1 0 nil ,s2 0 nil 'ignore-case))) - (defmacro string-equal-ignore-case (s1 s2) - `(string-equal (upcase ,s1) (upcase ,s2)))) - -(static-if (fboundp 'member-ignore-case) - (defalias 'string-list-member-ignore-case - 'member-ignore-case) - (defsubst string-list-member-ignore-case (thing list) - "Returns t if thing is member of list, not funcallable" - (member-if - (lambda (item) - (and (stringp item) (string-equal-ignore-case thing item))) - list))) +(defmacro string-equal-ignore-case (s1 s2) + `(string-equal (upcase ,s1) (upcase ,s2))) + +(defsubst string-list-member-ignore-case (thing list) + "Returns t if thing is member of list, not funcallable" + (member-if + (lambda (item) + (and (stringp item) (string-equal-ignore-case thing item))) + list)) (defsubst string-list-remove-ignore-case (thing list) (let ((element (string-list-member-ignore-case thing list)))