/[cl-xmpp]/cl-xmpp/README
ViewVC logotype

Contents of /cl-xmpp/README

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations)
Fri May 12 17:45:49 2006 UTC (7 years, 11 months ago) by eenge
Branch: MAIN
CVS Tags: cl_xmpp_0_8_0, HEAD
Changes since 1.11: +4 -4 lines
commiting fixes from Robert Brown, thanks!
1 This is a Common Lisp implementation of the XMPP RFCs. Please
2 see http://common-lisp.net/project/cl-xmpp for more information.
3
4 Example:
5
6 * (require :cl-xmpp)
7
8 * (defvar *connection* (xmpp:connect :hostname "jabber.org"))
9 ;; or xmpp:connect-tls if you loaded cl-xmpp-tls
10
11 ;; note that for XMPP servers which do not have the same hostname
12 ;; as the domain-part of the user's JID you will have to pass that
13 ;; in. eg for Google Talk:
14 ;; (defvar *connection* (xmpp:connect-tls :hostname "talk.google.com"
15 :jid-domain-part "gmail.com"))
16
17 * (xmpp:auth *connection* "username" "password" "resource")
18 ;; or pass :mechanism :sasl-plain, :digest-md5 or sasl-digest-md5
19 ;; if you loaded cl-xmpp-sasl or cl-xmpp-tls.
20
21 ;; send someone a message
22 * (xmpp:message *connection* "username@hostname" "what's going on?")
23
24 ;; then sit back and watch the messages roll in:
25 * (xmpp:receive-stanza-loop *connection*)
26 <MESSAGE from=username@hostname to=me@myserver>
27 [....]
28 ;; or use xmpp:receive-stanza if you're just wanting one stanza
29 ;; (note it will still block until you have received a complete
30 ;; stanza)
31
32 ;; That's it. Interrupt the loop to issue other commands, eg:
33 * (xmpp:get-roster *connection*)
34
35 ;; or any of the other ones you may find by looking through cl-xmpp.lisp
36 ;; and package.lisp to see which ones are exported.
37
38 ;; If you wish to handle the incoming messages or other objects simply
39 ;; specify an xmpp:handle method for the objects you are interested in
40 ;; or (defmethod xmpp:handle (connection object) ...) to get them
41 ;; all. Or alternatively specify :dom-repr t to receive-stanza-loop
42 ;; to get DOM-ish objects.
43
44 ;; For example, if you wanted to create an annoying reply bot:
45
46 * (defmethod xmpp:handle ((connection xmpp:connection) (message xmpp:message))
47 (xmpp:message connection (xmpp:from message)
48 (format nil "reply to: ~a" (xmpp:message object))))
49

  ViewVC Help
Powered by ViewVC 1.1.5