cl-xmpp is a Common Lisp client implementation of the XMPP RFCs. These are the RFCs which Jabber clients and servers use to communicate with eachother (including Google Talk). In addition cl-xmpp implements JEPs 0078, 0086, 0030 and 0070 which are all part of JEP-0073: Basic IM Protocol Suite. The author considers the library feature complete but will happily accept patches for any other reasonably stable JEPs.
Currently, you can chat, manage your contacts, roster
and presence information using this library. You can now also
use the service discovery protocol using the
The code is released under an MIT-style license.
If you have asdf-install, just:
$ asdf-install cl-xmpp
cl-xmpp can manually be downloaded from here: cl-xmpp_latest.tar.gz .
[an error occurred while processing this directive]
* (require :cl-xmpp-sasl) * (defvar *connection* (xmpp:connect :hostname "jabber.org")) ;; or xmpp:connect-tls if you loaded cl-xmpp-tls ;; note that for XMPP servers which do not have the same hostname ;; as the domain-part of the user's JID you will have to pass that ;; in. eg for Google Talk: ;; (defvar connection (xmpp:connect-tls :hostname "talk.google.com" :jid-domain-part "gmail.com")) * (xmpp:auth connection "password" "resource" :mechanism :sasl-plain) ;; or pass :mechanism :sasl-plain, :digest-md5 or sasl-digest-md5 ;; if you loaded cl-xmpp-sasl or cl-xmpp-tls. ;; send someone a message * (xmpp:message connection "username@hostname" "what's going on?") ;; then sit back and watch the messages roll in: * (xmpp:receive-stanza-loop connection)
[....] ;; or use xmpp:receive-stanza if you're just wanting one stanza ;; (note it will still block until you have received a complete ;; stanza) ;; That's it. Interrupt the loop to issue other commands, eg: * (xmpp:get-roster connection) ;; or any of the other ones you may find by looking through cl-xmpp.lisp ;; and package.lisp to see which ones are exported. ;; If you wish to handle the incoming messages or other objects simply ;; specify an xmpp:handle method for the objects you are interested in ;; or (defmethod xmpp:handle (connection object) ...) to get them ;; all. Or alternatively specify :dom-repr t to receive-stanza-loop ;; to get DOM-ish objects. ;; For example, if you wanted to create an annoying reply bot: * (defmethod xmpp:handle ((connection xmpp:connection) (message xmpp:message)) (xmpp:message connection (xmpp:from message) (format nil "reply to: ~a" (xmpp:message object))))