|
From: Magnus H. <leg...@us...> - 2007-09-01 02:39:05
|
Update of /cvsroot/emacs-jabber/emacs-jabber
In directory sc8-pr-cvs17:/tmp/cvs-serv27829
Modified Files:
jabber.el jabber-core.el
Log Message:
Revision: ma...@fr...--2005/emacs-jabber--cvs-head--0--patch-402
Creator: Magnus Henoch <ma...@fr...>
Make jabber-account-list into an alist, for extensibility
Index: jabber-core.el
===================================================================
RCS file: /cvsroot/emacs-jabber/emacs-jabber/jabber-core.el,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- jabber-core.el 29 Aug 2007 13:03:41 -0000 1.64
+++ jabber-core.el 1 Sep 2007 02:38:54 -0000 1.65
@@ -137,19 +137,20 @@
;; Only connect those accounts that are not yet connected.
(let ((already-connected (mapcar #'jabber-connection-bare-jid jabber-connections))
(connected-one nil))
- (flet ((nonempty
- (s)
- (unless (zerop (length s)) s)))
- (dolist (account jabber-account-list)
- (unless (member (jabber-jid-user (car account)) already-connected)
- (destructuring-bind (jid password network-server port connection-type)
- account
- (jabber-connect
- (jabber-jid-username jid)
- (jabber-jid-server jid)
- (jabber-jid-resource jid)
- nil (nonempty password) (nonempty network-server)
- port connection-type))))))))
+ (dolist (account jabber-account-list)
+ (unless (member (jabber-jid-user (car account)) already-connected)
+ (let* ((jid (car account))
+ (alist (cdr account))
+ (password (cdr (assq :password alist)))
+ (network-server (cdr (assq :network-server alist)))
+ (port (cdr (assq :port alist)))
+ (connection-type (cdr (assq :connection-type alist))))
+ (jabber-connect
+ (jabber-jid-username jid)
+ (jabber-jid-server jid)
+ (jabber-jid-resource jid)
+ nil password network-server
+ port connection-type)))))))
(defun jabber-connect (username server resource &optional
registerp password network-server
Index: jabber.el
===================================================================
RCS file: /cvsroot/emacs-jabber/emacs-jabber/jabber.el,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- jabber.el 29 Aug 2007 01:45:36 -0000 1.76
+++ jabber.el 1 Sep 2007 02:38:54 -0000 1.77
@@ -32,38 +32,42 @@
(defcustom jabber-account-list nil
"List of Jabber accounts.
-Each element of the list is a list describing a Jabber account
-of the form (JID PASSWORD NETWORK-SERVER PORT CONNECTION-TYPE).
+Each element of the list is a cons cell describing a Jabber account,
+where the car is a JID and the CDR is an alist.
JID is a full Jabber ID string (e.g. fo...@ba...). You can also
specify the resource (e.g. fo...@ba.../emacs).
-PASSWORD is a string to authenticate ourself against the server.
+The following keys can be present in the alist:
+:password is a string to authenticate ourself against the server.
It can be empty.
-NETWORK-SERVER is a string identifying the address to connect to,
+:network-server is a string identifying the address to connect to,
if it's different from the server part of the JID.
-PORT is the port to use (default depends on connection type).
-CONNECTION-TYPE is a symbol. Valid symbols are `starttls',
+:port is the port to use (default depends on connection type).
+:connection-type is a symbol. Valid symbols are `starttls',
`network' and `ssl'.
-Only JID is mandatory. The rest can be guessed at run-time.
-
-Example:
- ((\"xm...@ja.../emacs\" \"\" \"\" nil network)
- (\"xm...@gm...\" \"\" \"talk.google.com\" 5223 ssl))"
+Only JID is mandatory. The rest can be guessed at run-time."
:type '(repeat
- (list :tag "Account information"
+ (cons :tag "Account information"
(string :tag "JID")
- (string :tag "Password")
- (string :tag "Network server")
- (choice :tag "Port"
- (const :tag "Default" nil)
- (integer :tag "Override" 5222))
- (choice :tag "Connection type"
- ;; XXX: detect whether we have STARTTLS? option
- ;; for enforcing encryption?
- (const :tag "STARTTLS" starttls)
- (const :tag "Unencrypted" network)
- (const :tag "Legacy SSL/TLS" ssl))))
+ (set :format "%v"
+ (cons :format "%v"
+ (const :format "" :password)
+ (string :tag "Password"))
+ (cons :format "%v"
+ (const :format "" :network-server)
+ (string :tag "Network server"))
+ (cons :format "%v"
+ (const :format "" :port)
+ (integer :tag "Port" 5222))
+ (cons :format "%v"
+ (const :format "" :connection-type)
+ (choice :tag "Connection type"
+ ;; XXX: detect whether we have STARTTLS? option
+ ;; for enforcing encryption?
+ (const :tag "STARTTLS" starttls)
+ (const :tag "Unencrypted" network)
+ (const :tag "Legacy SSL/TLS" ssl))))))
:group 'jabber-core)
;; XXX: kill these four variables
|