Function: erc-notifications-notify

erc-notifications-notify is a byte-compiled function defined in erc-desktop-notifications.el.gz.

Signature

(erc-notifications-notify NICK MSG &optional PRIVP)

Documentation

Notify that NICK send some MSG, where PRIVP should be non-nil for PRIVMSGs.

This will replace the last notification sent with this function.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-desktop-notifications.el.gz
(defun erc-notifications-notify (nick msg &optional privp)
  "Notify that NICK send some MSG, where PRIVP should be non-nil for PRIVMSGs.
This will replace the last notification sent with this function."
  (dbus-ignore-errors
    (setq erc-notifications-last-notification
          (let* ((channel (or (and privp (not (equal nick (erc-target)))
                                   (erc-get-buffer nick))
                              (current-buffer)))
                 (title (if (or privp (equal nick (erc-target)))
                            (erc-compat--xml-escape-string nick t)
                          (format "%s in %s"
                                  (erc-compat--xml-escape-string nick t)
                                  channel)))
                 (body (erc-compat--xml-escape-string
                        (erc-controls-strip msg) t)))
            (funcall (cond ((featurep 'android)
                            #'android-notifications-notify)
                           ((featurep 'haiku)
                            #'haiku-notifications-notify)
                           (t #'notifications-notify))
                     :bus erc-notifications-bus
                     :title title
                     :body body
                     :replaces-id erc-notifications-last-notification
                     :app-icon erc-notifications-icon
                     :actions '("default" "Switch to buffer")
                     :on-action (lambda (&rest _)
                                  (pop-to-buffer channel)))))))