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)))
29 ;;; these customize fields should come first
30 (defgroup jabber nil
"Jabber instant messaging"
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.
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',
50 Only JID is mandatory. The rest can be guessed at run-time.
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)))"
66 (cons :tag
"Account information"
70 (const :format
"" :disabled
)
71 (const :tag
"Disabled" t
))
73 (const :format
"" :password
)
74 (string :tag
"Password"))
76 (const :format
"" :network-server
)
77 (string :tag
"Network server"))
79 (const :format
"" :port
)
80 (integer :tag
"Port" 5222))
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
))))))
92 (defcustom jabber-default-show
""
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"))
102 (defcustom jabber-default-status
""
103 "default status string"
108 (defcustom jabber-default-priority
10
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
)
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-watch
)
136 (require 'jabber-activity
)
137 (require 'jabber-vcard
)
138 (require 'jabber-events
)
139 (require 'jabber-chatstates
)
140 (require 'jabber-vcard-avatars
)
141 (require 'jabber-autoaway
)
142 (require 'jabber-time
)
143 (require 'jabber-truncate
)
145 (require 'jabber-ft-client
)
146 (require 'jabber-ft-server
)
147 (require 'jabber-socks5
)
149 ;; External notifiers
150 (require 'jabber-screen
)
151 (require 'jabber-ratpoison
)
152 (require 'jabber-sawfish
)
153 (require 'jabber-festival
)
154 (require 'jabber-xmessage
)
155 (require 'jabber-wmii
)
156 (require 'jabber-osd
)
157 (require 'jabber-awesome
)
158 (require 'jabber-libnotify
)
160 (require 'jabber-autoloads
)
163 (defvar *jabber-current-status
* nil
164 "the users current presence status")
167 (defvar *jabber-current-show
* nil
168 "the users current presence show")
171 (defvar *jabber-current-priority
* nil
172 "the user's current priority")
174 (defvar *jabber-status-history
* nil
175 "history of status messages")
177 (defgroup jabber-faces nil
"faces for displaying jabber instant messaging"
180 (defface jabber-title-small
181 '((t (:weight bold
:width semi-expanded
:height
1.0 :inherit variable-pitch
)))
182 "face for small titles"
183 :group
'jabber-faces
)
185 (defface jabber-title-medium
186 '((t (:weight bold
:width expanded
:height
2.0 :inherit variable-pitch
)))
187 "face for medium titles"
188 :group
'jabber-faces
)
190 (defface jabber-title-large
191 '((t (:weight bold
:width ultra-expanded
:height
3.0 :inherit variable-pitch
)))
192 "face for large titles"
193 :group
'jabber-faces
)
195 (defgroup jabber-debug nil
"debugging options"
199 (defcustom jabber-debug-log-xml nil
200 "Set to non-nil to log all XML i/o in *-jabber-console-JID-* buffer. Set to string to also dump XML i/o in specified file."
201 :type
'(choice (const :tag
"Do not dump XML i/o" nil
)
202 (const :tag
"Dump XML i/o in console" t
)
203 (string :tag
"Dump XML i/o in console and this file"))
205 :require
'jabber-console
)
208 (defcustom jabber-debug-keep-process-buffers nil
209 "If nil, kill process buffers when the process dies.
210 Contents of process buffers might be useful for debugging."
212 :group
'jabber-debug
)
214 (defcustom jabber-silent-mode nil
215 "Silent mode switch. Not ask confirmanions for some operations. DANGEROUS!"
220 (defconst jabber-presence-faces
221 '(("" . jabber-roster-user-online
)
222 ("away" . jabber-roster-user-away
)
223 ("xa" . jabber-roster-user-xa
)
224 ("dnd" . jabber-roster-user-dnd
)
225 ("chat" . jabber-roster-user-chatty
)
226 ("error" . jabber-roster-user-error
)
227 (nil . jabber-roster-user-offline
))
228 "Mapping from presence types to faces")
230 (defconst jabber-presence-strings
231 `(("" .
,(jabber-propertize "Online" 'face
'jabber-roster-user-online
))
232 ("away" .
,(jabber-propertize "Away" 'face
'jabber-roster-user-away
))
233 ("xa" .
,(jabber-propertize "Extended Away" 'face
'jabber-roster-user-xa
))
234 ("dnd" .
,(jabber-propertize "Do not Disturb" 'face
'jabber-roster-user-dnd
))
235 ("chat" .
,(jabber-propertize "Chatty" 'face
'jabber-roster-user-chatty
))
236 ("error" .
,(jabber-propertize "Error" 'face
'jabber-roster-user-error
))
237 (nil .
,(jabber-propertize "Offline" 'face
'jabber-roster-user-offline
)))
238 "Mapping from presence types to readable, colorized strings")
241 (defun jabber-customize ()
242 "customize jabber options"
244 (customize-group 'jabber
))
247 (defun jabber-info ()
248 "open jabber.el manual"
254 ;;; arch-tag: 5145153e-4d19-4dc2-800c-b1282feb155d