:group 'emchat-log
:type 'boolean)
+(defcustom emchat-notify-events-type 'msg
+ "*What event types to send notifications for.
+
+Possible values are:
+ all -- all events \(anything and everything that is logged\).
+ incoming -- only incoming messages plus system and debug events.
+ This would include friends status changes.
+ msg -- incoming user messages only \(default\).
+ nil -- no events."
+ :group 'emchat-log
+ :type '(choice (item :tag "All Events" all)
+ (item :tag "Incoming msg + sys + debug events" incoming)
+ (item :tag "Incoming user messages" msg)
+ (item :tag "Nothing" nil)))
+
(defcustom emchat-notify-command (executable-find "notify-send")
"*The shell command used to send notifications."
:group 'emchat-log
(set-extent-property exp 'balloon-help bhelp)))))
(defun emchat-notify (id message)
- "Send a notification about incoming MESSAGE from ID."
+ "Send a notification about 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))))
+ (urgency "normal"))
+ (when notify
+ (unless (eq (selected-frame) emchat-frame)
+ (ecase emchat-notify-events-type
+ (all (call-process notify nil nil nil
+ "-i" icon
+ "-u" urgency
+ (format "New Message From: %s" id)
+ message))
+ (incoming
+ (and (not (search ">>>" message))
+ (not (search "***|" message))
+ (call-process notify nil nil nil
+ "-i" icon
+ "-u" urgency
+ (format "New Message From: %s" id)
+ message)))
+ (msg
+ (and (not (equal id "!debug"))
+ (not (equal id "!error"))
+ (not (equal id "!system"))
+ (not (search ">>>" message))
+ (not (search "***|" message))
+ (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 (eq (selected-frame) emchat-frame)
- (emchat-notify id message))
(if (and option (buffer-live-p emchat-log-buffer))
(with-current-buffer emchat-log-buffer
(save-excursion
;; use concat instead of format for extent
(concat "[" id "] " message "\n"))
(fill-region start-point (point))
+ (when emchat-notify-flag
+ (emchat-notify id message))
(when emchat-history-enabled-flag
(emchat-log-update-history id message weekday))
(when emchat-track-enable