:group 'emchat-interface
:type '(choice (item t) (item nil)))
+(defcustom emchat-notify-flag t
+ "*Non-nil to send notifications via libnotify.
+
+Currently this simply uses `notify-send' shell command."
+ :group 'emchat-log
+ :type 'boolean)
+
+(defcustom emchat-notify-command (executable-find "notify-send")
+ "*The shell command used to send notifications."
+ :group 'emchat-log
+ :type 'string)
+
;;; Internal variables
(defvar emchat-log-buffer nil
(set-extent-property exp 'face face)
(set-extent-property exp 'balloon-help bhelp)))))
+(defun emchat-notify (id message)
+ "Send a notification about incoming MESSAGE from ID."
+ (let ((notify emchat-notify-command)
+ (icon (expand-file-name "emchat-icon.png" emchat-glyph-dir))
+ (urgency "normal")
+ (skip-id (member id '("!debug" "!info" "!system"))))
+ (when (and notify (not skip-id))
+ (call-process notify nil nil nil
+ "-i" icon
+ "-u" urgency
+ (format "New Message From: %s" id)
+ message))))
+
(defun emchat-log (id message option mark-unread)
"Log message under ID.
Put MESSAGE at the end of log buffer if OPTION is non-nil.
Mark MESSAGE unread if MARK-UNREAD is non-nil"
+ (unless (or (eq (current-buffer) emchat-log-buffer)
+ (frame-visible-p emchat-frame))
+ (emchat-notify id message))
(if (and option (buffer-live-p emchat-log-buffer))
(with-current-buffer emchat-log-buffer
(save-excursion