Merge remote-tracking branch 'sourceforge/master'
[emacs-jabber.git] / jabber-xmessage.el
blobcf942d5186a831ec0c1da3acd6b01566ca4edc3c
1 ;; jabber-xmessage.el - emacs-jabber interface to xmessage
3 ;; Copyright (C) 2008 - Magnus Henoch
4 ;; Copyright (C) 2005 - Mario Domenech Goulart
6 ;; This file is a part of jabber.el.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program; if not, write to the Free Software
20 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 (eval-when-compile (require 'jabber-alert))
24 (defcustom jabber-xmessage-timeout 15
25 "Timeout in seconds for xmessage alerts.
26 Set this to nil to have no timeout."
27 :type '(choice (integer :tag "Seconds")
28 (const :tag "No timeout" nil))
29 :group 'jabber-alerts)
31 (defun jabber-xmessage-display-message (text &optional title)
32 "Displays MESSAGE using the xmessage program."
33 (let* ((process-connection-type nil)
34 (timeout-args (when jabber-xmessage-timeout
35 (list "-timeout" (number-to-string jabber-xmessage-timeout))))
36 (args (append timeout-args (list (or title text)))))
37 (apply 'start-process "xmessage" nil "xmessage" args)))
39 (define-jabber-alert xmessage "Display a message using the xmessage program."
40 'jabber-xmessage-display-message)
42 (provide 'jabber-xmessage)
43 ;; arch-tag: 10A74D00-5D2C-11D9-A294-000A95C2FCD0