[beirc-cvs] CVS update: beirc/receivers.lisp
Andreas Fuchs
afuchs at common-lisp.net
Fri Sep 30 13:46:19 UTC 2005
Update of /project/beirc/cvsroot/beirc
In directory common-lisp.net:/tmp/cvs-serv16023
Modified Files:
receivers.lisp
Log Message:
Re-do global notices. Again. This time, for sure!
(At least we'll have a chance of understanding the logic now (-:)
Date: Fri Sep 30 15:46:18 2005
Author: afuchs
Index: beirc/receivers.lisp
diff -u beirc/receivers.lisp:1.8 beirc/receivers.lisp:1.9
--- beirc/receivers.lisp:1.8 Thu Sep 29 16:51:25 2005
+++ beirc/receivers.lisp Fri Sep 30 15:46:18 2005
@@ -85,14 +85,23 @@
unless the user has opened a query window to the source
already.")
+(defparameter *global-notice-targets* '("$*" "auth")
+ "NOTICE message targets that should be treated as network
+service targets.")
+
+(defun nickname-comparator (frame)
+ (lambda (nick1 nick2)
+ (string= (irc:normalize-nickname (current-connection frame) nick1)
+ (irc:normalize-nickname (current-connection frame) nick2))))
+
(defun from-network-service-p (source frame)
(member source *network-service-sources*
- :test (lambda (source1 source2)
- (string= (irc:normalize-nickname (current-connection frame) source1)
- (irc:normalize-nickname (current-connection frame) source2)))))
+ :test (nickname-comparator frame)))
-(defun global-notice-p (message target)
- (and (typep message 'irc:irc-notice-message) (string= target "$*")))
+(defun global-notice-p (message target frame)
+ (and (typep message 'irc:irc-notice-message)
+ (member target *global-notice-targets*
+ :test (nickname-comparator frame))))
(macrolet ((define-privmsg-receiver-lookup (message-type)
`(defmethod receiver-for-message ((message ,message-type) frame)
@@ -103,12 +112,14 @@
(target (if (equal nominal-target mynick)
(irc:source message)
nominal-target)))
- (if (or (find-receiver target frame)
- (not (from-network-service-p (irc:source message) frame))
- (and (eql nominal-target target)
- (not (global-notice-p message nominal-target))))
- (intern-receiver target frame :channel target)
- (server-receiver frame))))))
+ (cond ((find-receiver target frame)
+ (intern-receiver target frame :channel target))
+ ((or (global-notice-p message nominal-target frame)
+ (and (from-network-service-p (irc:source message) frame)
+ (equal nominal-target mynick)))
+ (server-receiver frame))
+ (t
+ (intern-receiver target frame :channel target)))))))
(define-privmsg-receiver-lookup irc:irc-privmsg-message)
(define-privmsg-receiver-lookup irc:ctcp-action-message)
(define-privmsg-receiver-lookup irc:irc-notice-message))
More information about the Beirc-cvs
mailing list