mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-10 22:20:51 +00:00
Fix erc-notifications-notify for non-PRIVMSGs, broken in last commit
* lisp/erc/erc-desktop-notifications.el (erc-notifications-notify): Take optional argument `privp', to be non-nil when notifying for a PRIVMSG. This is to work around bug introduced in last commit, as `erc-get-buffer' may return nil for non-PRIVMSG cases. (erc-notifications-PRIVMSG): Call erc-notifications-notify with non-nil `privp', as described above.
This commit is contained in:
parent
db4436eaf9
commit
74b151195d
1 changed files with 6 additions and 4 deletions
|
@ -55,12 +55,14 @@
|
||||||
|
|
||||||
(defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors
|
(defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors
|
||||||
|
|
||||||
(defun erc-notifications-notify (nick msg)
|
(defun erc-notifications-notify (nick msg &optional privp)
|
||||||
"Notify that NICK send some MSG.
|
"Notify that NICK send some MSG, where PRIVP should be non-nil for PRIVMSGs.
|
||||||
This will replace the last notification sent with this function."
|
This will replace the last notification sent with this function."
|
||||||
|
;; TODO: can we do this without PRIVP? (by "fixing" ERC's not
|
||||||
|
;; setting the current buffer to the existing query buffer)
|
||||||
(dbus-ignore-errors
|
(dbus-ignore-errors
|
||||||
(setq erc-notifications-last-notification
|
(setq erc-notifications-last-notification
|
||||||
(let ((channel (erc-get-buffer nick)))
|
(let ((channel (if privp (erc-get-buffer nick) (current-buffer))))
|
||||||
(notifications-notify :bus erc-notifications-bus
|
(notifications-notify :bus erc-notifications-bus
|
||||||
:title (format "%s in %s"
|
:title (format "%s in %s"
|
||||||
(xml-escape-string nick)
|
(xml-escape-string nick)
|
||||||
|
@ -80,7 +82,7 @@ This will replace the last notification sent with this function."
|
||||||
(not (and (boundp 'erc-track-exclude)
|
(not (and (boundp 'erc-track-exclude)
|
||||||
(member nick erc-track-exclude)))
|
(member nick erc-track-exclude)))
|
||||||
(not (erc-is-message-ctcp-and-not-action-p msg)))
|
(not (erc-is-message-ctcp-and-not-action-p msg)))
|
||||||
(erc-notifications-notify nick msg)))
|
(erc-notifications-notify nick msg t)))
|
||||||
;; Return nil to continue processing by ERC
|
;; Return nil to continue processing by ERC
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue