Revision: mange@freemail.hu--2005/emacs-jabber--cvs-head--0--patch-556
[emacs-jabber.git] / jabber.el
blobae6755258d0ee11b26f929a4bbb81d5895f1a9aa
1 ;; jabber.el - a minimal jabber client
3 ;; Copyright (C) 2003, 2004, 2007, 2008 - Magnus Henoch - mange@freemail.hu
4 ;; Copyright (C) 2002, 2003, 2004 - tom berger - object@intelectronica.net
6 ;; SSL - Support, mostly inspired by Gnus
7 ;; Copyright (C) 2005 - Georg Lehner - jorge@magma.com.ni
9 ;; This file is a part of jabber.el.
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2 of the License, or
14 ;; (at your option) any later version.
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, write to the Free Software
23 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 ;;; load Unicode tables if this needed
26 (when (and (featurep 'xemacs) (not (emacs-version>= 21 5 5)))
27 (require 'un-define))
29 ;;; these customize fields should come first
30 (defgroup jabber nil "Jabber instant messaging"
31 :group 'applications)
33 ;;;###autoload
34 (defcustom jabber-account-list nil
35 "List of Jabber accounts.
36 Each element of the list is a cons cell describing a Jabber account,
37 where the car is a JID and the CDR is an alist.
39 JID is a full Jabber ID string (e.g. foo@bar.tld). You can also
40 specify the resource (e.g. foo@bar.tld/emacs).
41 The following keys can be present in the alist:
42 :password is a string to authenticate ourself against the server.
43 It can be empty.
44 :network-server is a string identifying the address to connect to,
45 if it's different from the server part of the JID.
46 :port is the port to use (default depends on connection type).
47 :connection-type is a symbol. Valid symbols are `starttls',
48 `network' and `ssl'.
50 Only JID is mandatory. The rest can be guessed at run-time.
52 Examples:
54 Two accounts without any special configuration:
55 \((\"foo@example.com\") (\"bar@example.net\"))
57 One disabled account with a non-standard port:
58 \((\"romeo@montague.net\" (:port . 5242) (:disabled . t)))
60 If you don't have SRV and STARTTLS capabilities in your Emacs,
61 configure a Google Talk account like this:
62 \((\"username@gmail.com\"
63 (:network-server . \"talk.google.com\")
64 (:connection-type . ssl)))"
65 :type '(repeat
66 (cons :tag "Account information"
67 (string :tag "JID")
68 (set :format "%v"
69 (cons :format "%v"
70 (const :format "" :disabled)
71 (const :tag "Disabled" t))
72 (cons :format "%v"
73 (const :format "" :password)
74 (string :tag "Password"))
75 (cons :format "%v"
76 (const :format "" :network-server)
77 (string :tag "Network server"))
78 (cons :format "%v"
79 (const :format "" :port)
80 (integer :tag "Port" 5222))
81 (cons :format "%v"
82 (const :format "" :connection-type)
83 (choice :tag "Connection type"
84 ;; XXX: detect whether we have STARTTLS? option
85 ;; for enforcing encryption?
86 (const :tag "STARTTLS" starttls)
87 (const :tag "Unencrypted" network)
88 (const :tag "Legacy SSL/TLS" ssl))))))
89 :group 'jabber)
91 ;;;###autoload
92 (defcustom jabber-default-show ""
93 "default show state"
94 :type '(choice (const :tag "Online" "")
95 (const :tag "Chatty" "chat")
96 (const :tag "Away" "away")
97 (const :tag "Extended away" "xa")
98 (const :tag "Do not disturb" "dnd"))
99 :group 'jabber)
101 ;;;###autoload
102 (defcustom jabber-default-status ""
103 "default status string"
104 :type 'string
105 :group 'jabber)
107 ;;;###autoload
108 (defcustom jabber-default-priority 10
109 "default priority"
110 :type 'integer
111 :group 'jabber)
113 ;;; guess internal dependencies!
114 (require 'jabber-util)
115 (require 'jabber-menu)
116 (require 'jabber-xml)
117 (require 'jabber-conn)
118 (require 'jabber-core)
119 (require 'jabber-logon)
120 (require 'jabber-roster)
121 (require 'jabber-presence)
122 (require 'jabber-alert)
123 (require 'jabber-chat)
124 (require 'jabber-disco)
125 (require 'jabber-iq)
126 (require 'jabber-widget)
127 (require 'jabber-register)
128 (require 'jabber-search)
129 (require 'jabber-browse)
130 (require 'jabber-muc)
131 (require 'jabber-muc-nick-completion)
132 (require 'jabber-version)
133 (require 'jabber-ahc-presence)
134 (require 'jabber-modeline)
135 (require 'jabber-keepalive)
136 (require 'jabber-watch)
137 (require 'jabber-activity)
138 (require 'jabber-vcard)
139 (require 'jabber-events)
140 (require 'jabber-chatstates)
141 (require 'jabber-vcard-avatars)
142 (require 'jabber-autoaway)
143 (require 'jabber-time)
144 (require 'jabber-truncate)
146 (require 'jabber-ft-client)
147 (require 'jabber-ft-server)
148 (require 'jabber-socks5)
150 ;; External notifiers
151 (require 'jabber-screen)
152 (require 'jabber-ratpoison)
153 (require 'jabber-sawfish)
154 (require 'jabber-festival)
155 (require 'jabber-xmessage)
156 (require 'jabber-wmii)
157 (require 'jabber-osd)
159 (require 'jabber-autoloads)
161 ;;;###autoload
162 (defvar *jabber-current-status* nil
163 "the users current presence staus")
165 ;;;###autoload
166 (defvar *jabber-current-show* nil
167 "the users current presence show")
169 ;;;###autoload
170 (defvar *jabber-current-priority* nil
171 "the user's current priority")
173 (defvar *jabber-status-history* nil
174 "history of status messages")
176 (defgroup jabber-faces nil "faces for displaying jabber instant messaging"
177 :group 'jabber)
179 (defface jabber-title-small
180 '((t (:weight bold :width semi-expanded :height 1.0 :inherit variable-pitch)))
181 "face for small titles"
182 :group 'jabber-faces)
184 (defface jabber-title-medium
185 '((t (:weight bold :width expanded :height 2.0 :inherit variable-pitch)))
186 "face for medium titles"
187 :group 'jabber-faces)
189 (defface jabber-title-large
190 '((t (:weight bold :width ultra-expanded :height 3.0 :inherit variable-pitch)))
191 "face for large titles"
192 :group 'jabber-faces)
194 (defgroup jabber-debug nil "debugging options"
195 :group 'jabber)
197 ;;;###autoload
198 (defcustom jabber-debug-log-xml nil
199 "log all XML i/o in *-jabber-xml-log-*"
200 :type 'boolean
201 :group 'jabber-debug)
203 ;;;###autoload
204 (defcustom jabber-debug-keep-process-buffers nil
205 "If nil, kill process buffers when the process dies.
206 Contents of process buffers might be useful for debugging."
207 :type 'boolean
208 :group 'jabber-debug)
210 ;;;###autoload
211 (defconst jabber-presence-faces
212 '(("" . jabber-roster-user-online)
213 ("away" . jabber-roster-user-away)
214 ("xa" . jabber-roster-user-xa)
215 ("dnd" . jabber-roster-user-dnd)
216 ("chat" . jabber-roster-user-chatty)
217 ("error" . jabber-roster-user-error)
218 (nil . jabber-roster-user-offline))
219 "Mapping from presence types to faces")
221 ;;;###autoload
222 (defconst jabber-presence-strings
223 '(("" . "Online")
224 ("away" . "Away")
225 ("xa" . "Extended Away")
226 ("dnd" . "Do not Disturb")
227 ("chat" . "Chatty")
228 ("error" . "Error")
229 (nil . "Offline"))
230 "Mapping from presence types to readable strings")
232 ;;;###autoload
233 (defun jabber-customize ()
234 "customize jabber options"
235 (interactive)
236 (customize-group 'jabber))
238 ;;;###autoload
239 (defun jabber-info ()
240 "open jabber.el manual"
241 (interactive)
242 (info "jabber"))
244 (provide 'jabber)
246 ;;; arch-tag: 5145153e-4d19-4dc2-800c-b1282feb155d