-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nick highlight function #72
Comments
Oh, just over a year since this issue was created! :-) This should work: (circe-add-message-handler "PRIVMSG" 'my/handle-highlight)
(defun my/handle-highlight (nick user host command args)
(when (string-match (with-circe-server-buffer (regexp-quote circe-server-nick))
(cadr args))
...)) While I think an accessor function for the current nick would be nice, I don't think this is particularly cumbersome to warrant a special hook. Any opinions? |
Actually, @wasamasa, does not sound complicated at all. Something like this? (defvar circe-message-regex-handlers nil
"List of (regex . handler) pairs.
If a PRIVMSG matches REGEX, HANDLER is called with the usual
nick/user/host/command/args arguments.")
(circe-add-message-handler "PRIVMSG" 'circe-message-regex-handler)
(defun circe-message-regex-handler (nick user host command args)
(dolist (entry circe-message-regex-handlers)
(when (string-match (car entry)
(cadr args))
(funcall (cdr entry) nick user host command args)))) |
Hmm, that looks a bit too flexible (and rather like something I'd use for an IRC bot, not myself), I rather thought of separating the handler and the regular expression since I only have one function I'm firing, but many more regular expressions. It shouldn't really matter though since I could just use |
A user defined function called when the users nick gets highlighted in a channel would be a nice feature.
The text was updated successfully, but these errors were encountered: