forked from j4yk/cl-xmpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
49 lines (36 loc) · 1.89 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
This is a Common Lisp implementation of the XMPP RFCs. Please
see http://common-lisp.net/project/cl-xmpp for more information.
Example:
* (require :cl-xmpp)
* (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* "username" "password" "resource")
;; 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*)
<MESSAGE from=username@hostname to=me@myserver>
[....]
;; 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))))