From: ueno Date: Fri, 27 Feb 2004 14:05:57 +0000 (+0000) Subject: * riece-display.el (riece-emit-signal): Create signal object X-Git-Tag: signal-slot-mergepoint~15 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83c5633180c266d1e2cf0dd3184f1c5609a96db9;p=elisp%2Friece.git * riece-display.el (riece-emit-signal): Create signal object internally. --- diff --git a/lisp/riece-300.el b/lisp/riece-300.el index 995a214..f8f50a9 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -52,19 +52,13 @@ (if operator (setq status (cons "operator" status))) (riece-user-toggle-away user away) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-away - (riece-make-identity - user - riece-server-name) - away)) + (riece-emit-signal 'riece-user-toggle-away + (riece-make-identity user riece-server-name) + away) (riece-user-toggle-operator user operator) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-operator - (riece-make-identity - user - riece-server-name) - operator)) + (riece-emit-signal 'riece-user-toggle-operator + (riece-make-identity user riece-server-name) + operator) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) (concat @@ -99,12 +93,9 @@ (let ((user (match-string 1 string)) (message (substring string (match-end 0)))) (riece-user-toggle-away user t) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-away - (riece-make-identity - user - riece-server-name) - t)) + (riece-emit-signal 'riece-user-toggle-away + (riece-make-identity user riece-server-name) + t) (riece-insert-info (list riece-dialogue-buffer riece-others-buffer) (concat @@ -118,21 +109,17 @@ (defun riece-handle-305-message (prefix number name string) (riece-user-toggle-away riece-real-nickname nil) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-away - (riece-make-identity - riece-real-nickname - riece-server-name) - nil))) + (riece-emit-signal 'riece-user-toggle-away + (riece-make-identity riece-real-nickname + riece-server-name) + nil)) (defun riece-handle-306-message (prefix number name string) (riece-user-toggle-away riece-real-nickname t) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-away - (riece-make-identity - riece-real-nickname - riece-server-name) - t))) + (riece-emit-signal 'riece-user-toggle-away + (riece-make-identity riece-real-nickname + riece-server-name) + t)) (defun riece-handle-311-message (prefix number name string) (if (string-match @@ -309,12 +296,9 @@ (while modes (riece-channel-toggle-mode channel (car modes) (eq toggle ?+)) (setq modes (cdr modes))) - (riece-emit-signal (riece-make-signal - 'riece-channel-toggle-modes - (riece-make-identity - channel - riece-server-name) - modes (eq toggle ?+))) + (riece-emit-signal 'riece-channel-toggle-modes + (riece-make-identity channel riece-server-name) + modes (eq toggle ?+)) (let* ((channel-identity (riece-make-identity channel riece-server-name)) (buffer (riece-channel-buffer channel-identity))) @@ -352,11 +336,10 @@ (riece-format-identity channel-identity t) message)) "\n"))) - (riece-emit-signal (riece-make-signal - 'riece-channel-set-topic + (riece-emit-signal 'riece-channel-set-topic channel-identity (unless remove - message)))))) + message))))) (defun riece-handle-331-message (prefix number name string) (riece-handle-set-topic prefix number name string t)) @@ -420,19 +403,13 @@ (setq status (nreverse status))) (riece-naming-assert-join nick channel) (riece-user-toggle-away user away) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-away - (riece-make-identity - user - riece-server-name) - away)) + (riece-emit-signal 'riece-user-toggle-away + (riece-make-identity user riece-server-name) + away)) (riece-user-toggle-operator user operator) - (riece-emit-signal (riece-make-signal - 'riece-user-toggle-operator - (riece-make-identity - user - riece-server-name) - operator)) + (riece-emit-signal 'riece-user-toggle-operator + (riece-make-identity user riece-server-name) + operator) (riece-insert-info buffer (concat (riece-concat-user-status status info) "\n")) diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index e5081dc..6ff9561 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -559,8 +559,8 @@ If prefix argument ARG is non-nil, toggle frozen status." (setq riece-freeze (if arg (< 0 (prefix-numeric-value arg)) (not riece-freeze))) - (riece-emit-signal (riece-make-signal 'riece-buffer-toggle-freeze - (current-buffer) riece-freeze)))) + (riece-emit-signal 'riece-buffer-toggle-freeze + (current-buffer) riece-freeze))) (defun riece-command-toggle-own-freeze (&optional arg) "Prevent automatic scrolling of the dialogue window. @@ -576,8 +576,8 @@ If prefix argument ARG is non-nil, toggle frozen status." (not (eq riece-freeze 'own))) (setq riece-freeze 'own) (setq riece-freeze nil))) - (riece-emit-signal (riece-make-signal 'riece-buffer-toggle-freeze - (current-buffer) riece-freeze))) + (riece-emit-signal 'riece-buffer-toggle-freeze + (current-buffer) riece-freeze)) (eval-when-compile (autoload 'riece-exit "riece")) diff --git a/lisp/riece-display.el b/lisp/riece-display.el index 26a7996..abaac35 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -71,10 +71,11 @@ This function is for internal use only." This function is for internal use only." (aref slot 2)) -(defun riece-make-signal (name &rest args) +(defun riece-make-signal (name args) "Make an instance of signal object. The 1st arguments is the name of the signal and the rest of arguments -are the data of the signal." +are the data of the signal. +This function is for internal use only." (vector name args)) (defun riece-signal-name (signal) @@ -92,13 +93,15 @@ are the data of the signal." (if (boundp symbol) (symbol-value symbol)))))) -(defun riece-emit-signal (signal) +(defun riece-emit-signal (signal-name &rest args) "Emit SIGNAL." - (let ((symbol (intern-soft (symbol-name (riece-signal-name signal)) + (let ((symbol (intern-soft (symbol-name signal-name) riece-signal-slot-obarray)) + signal slots) (when symbol - (setq slots (symbol-value symbol)) + (setq signal (riece-make-signal signal-name args) + slots (symbol-value symbol)) (while slots (condition-case error (if (or (null (riece-slot-filter (car slots))) @@ -107,14 +110,14 @@ are the data of the signal." (if riece-debug (message "Error occurred in signal filter for \"%S\": %S" - (riece-signal-name signal) error)) + signal-name error)) nil)) (funcall (riece-slot-function (car slots)) signal (riece-slot-handback (car slots)))) (error (if riece-debug (message "Error occurred in slot function for \"%S\": %S" - (riece-signal-name signal) error)))) + signal-name error)))) (setq slots (cdr slots)))))) (defun riece-display-connect-signals () @@ -406,7 +409,7 @@ are the data of the signal." (setq riece-current-channel identity riece-channel-buffer (riece-channel-buffer riece-current-channel)) (run-hook-with-args 'riece-after-switch-to-channel-functions last) - (riece-emit-signal (riece-make-signal 'riece-switch-to-channel)))) + (riece-emit-signal 'riece-switch-to-channel))) (defun riece-join-channel (identity) (unless (riece-identity-member identity riece-current-channels) @@ -437,7 +440,7 @@ are the data of the signal." (let ((last riece-current-channel)) (run-hook-with-args 'riece-after-switch-to-channel-functions last) (setq riece-current-channel nil) - (riece-emit-signal (riece-make-signal 'riece-switch-to-channel)))))) + (riece-emit-signal 'riece-switch-to-channel))))) (defun riece-part-channel (identity) (let ((pointer (riece-identity-member identity riece-current-channels))) diff --git a/lisp/riece-handle.el b/lisp/riece-handle.el index ee2b73f..dd848a8 100644 --- a/lisp/riece-handle.el +++ b/lisp/riece-handle.el @@ -323,10 +323,8 @@ (user-identity (riece-make-identity user riece-server-name)) (channel-identity (riece-make-identity channel riece-server-name))) (riece-channel-set-topic (riece-get-channel channel) topic) - (riece-emit-signal (riece-make-signal - 'riece-channel-set-topic - channel-identity - topic)) + (riece-emit-signal 'riece-channel-set-topic + channel-identity topic) (let ((buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer @@ -360,27 +358,21 @@ ((eq (car modes) ?o) (riece-channel-toggle-operator channel parameter (eq toggle ?+)) - (riece-emit-signal (riece-make-signal - 'riece-channel-toggle-operator - (riece-make-identity - channel - riece-server-name) - (riece-make-identity - parameter - riece-server-name) - (eq toggle ?+)))) + (riece-emit-signal 'riece-channel-toggle-operator + (riece-make-identity channel + riece-server-name) + (riece-make-identity parameter + riece-server-name) + (eq toggle ?+))) ((eq (car modes) ?v) (riece-channel-toggle-speaker channel parameter (eq toggle ?+)) - (riece-emit-signal (riece-make-signal - 'riece-channel-toggle-speaker - (riece-make-identity - channel - riece-server-name) - (riece-make-identity - parameter - riece-server-name) - (eq toggle ?+)))) + (riece-emit-signal 'riece-channel-toggle-speaker + (riece-make-identity channel + riece-server-name) + (riece-make-identity parameter + riece-server-name) + (eq toggle ?+))) ((eq (car modes) ?b) (riece-channel-toggle-banned channel parameter (eq toggle ?+))) @@ -393,12 +385,10 @@ (riece-channel-toggle-mode channel (car modes) (eq toggle ?+))) (setq modes (cdr modes))) - (riece-emit-signal (riece-make-signal - 'riece-channel-toggle-modes - (riece-make-identity - channel - riece-server-name) - modes toggle))))) + (riece-emit-signal 'riece-channel-toggle-modes + (riece-make-identity channel + riece-server-name) + modes toggle)))) (defun riece-handle-mode-message (prefix string) (let* ((user (riece-prefix-nickname prefix)) diff --git a/lisp/riece-message.el b/lisp/riece-message.el index ead3ca7..768d781 100644 --- a/lisp/riece-message.el +++ b/lisp/riece-message.el @@ -159,8 +159,7 @@ Normally they are *Dialogue* and/or *Others*." (riece-own-frozen buffer)) (with-current-buffer buffer (setq riece-freeze nil)) - (riece-emit-signal (riece-make-signal 'riece-buffer-toggle-freeze - buffer nil))) + (riece-emit-signal 'riece-buffer-toggle-freeze buffer nil)) (setq parent-buffers (riece-message-parent-buffers message buffer)) (riece-insert buffer (concat open-bracket name close-bracket diff --git a/lisp/riece-naming.el b/lisp/riece-naming.el index 1e9352e..044e4f9 100644 --- a/lisp/riece-naming.el +++ b/lisp/riece-naming.el @@ -40,9 +40,8 @@ (riece-join-channel channel-identity) (riece-switch-to-channel channel-identity) (setq riece-join-channel-candidate nil)) - (riece-emit-signal (riece-make-signal 'riece-naming-assert-join - user-identity - channel-identity)))) + (riece-emit-signal 'riece-naming-assert-join + user-identity channel-identity))) (defun riece-naming-assert-part (user-name channel-name) (riece-user-toggle-channel user-name channel-name nil) @@ -55,9 +54,8 @@ riece-server-name))) (if (riece-identity-equal-no-server user-name riece-real-nickname) (riece-part-channel channel-identity)) - (riece-emit-signal (riece-make-signal 'riece-naming-assert-part - user-identity - channel-identity)))) + (riece-emit-signal 'riece-naming-assert-part + user-identity channel-identity))) (defun riece-naming-assert-rename (old-name new-name) (if (riece-identity-equal-no-server old-name riece-real-nickname) @@ -88,8 +86,8 @@ riece-channel-buffer-alist)))) (if (riece-identity-equal old-identity riece-current-channel) (riece-switch-to-channel new-identity))) - (riece-emit-signal (riece-make-signal 'riece-naming-assert-rename - old-identity new-identity)))) + (riece-emit-signal 'riece-naming-assert-rename + old-identity new-identity))) (defun riece-naming-assert-channel-users (users channel-name) (let ((channel-identity (riece-make-identity channel-name @@ -115,9 +113,8 @@ (riece-switch-to-channel channel-identity) (setq riece-join-channel-candidate nil)) (setq users (cdr users))) - (riece-emit-signal (riece-make-signal 'riece-naming-assert-channel-users - (nreverse user-identity-list) - channel-identity)))) + (riece-emit-signal 'riece-naming-assert-channel-users + (nreverse user-identity-list) channel-identity))) (provide 'riece-naming)