gibberish/README.md

80 lines
2.2 KiB
Markdown
Raw Normal View History

2009-04-02 15:49:11 +00:00
2009-04-03 14:57:08 +00:00
# XMPP
2009-04-02 15:49:11 +00:00
A basic module for IM using the Jabber/XMPP protocol with PLT Scheme.
## Protocol Support
2009-04-02 16:02:30 +00:00
Should eventually implement XMPP-Core and XMPP-IM to conform with RFCs
3920 and 3921. Progress toward supporting the full protocol is
2009-04-16 15:33:06 +00:00
currently documented in the file `xmpp.ss`
2009-04-03 08:48:50 +00:00
## Installation
2009-04-18 16:59:49 +00:00
(require (planet zzkt/xmpp))
2009-04-16 13:18:01 +00:00
## Session
It is necessary to establish a session with a Jabber server before
sending any messages or presence updates. This can be done manually,
2009-04-16 15:33:06 +00:00
or with the help of `with-xmpp-session`.
2009-04-16 13:18:01 +00:00
## Sending
2009-04-16 15:33:06 +00:00
Once a session is established, the `send` function can be used to send
messages, presence updates or queries.
2009-04-16 13:18:01 +00:00
(with-xmpp-session jid pass
2009-04-16 15:33:06 +00:00
(send (message "user@host" "some random message")))
2009-04-16 13:18:01 +00:00
2009-04-18 16:59:49 +00:00
Where `jid` is the senders jid and `pass` is the password. A presence
update can be sent as `(send (presence #:status "garden path"))` and
queries are similar `(send (iq #:type get))`
2009-04-16 13:18:01 +00:00
## Response Handlers
2009-04-16 15:33:06 +00:00
A handler can be registered to respond to `'message` `'presence` `'iq` or
`'other` stanzas. Note that an `'iq` handler will receive any error
2009-04-16 13:18:01 +00:00
messages from the server
(set-xmpp-handler 'message print-message)
2009-04-03 08:48:50 +00:00
## Example Chat Client
2009-04-02 15:49:11 +00:00
2009-04-02 16:02:30 +00:00
(require xmpp)
2009-04-02 15:49:11 +00:00
2009-04-02 16:02:30 +00:00
(define (read-input prompt)
(display prompt)
(read-line (current-input-port)))
2009-04-02 15:49:11 +00:00
2009-04-02 16:02:30 +00:00
(define (chat)
(let ((jid (read-input "jid: "))
(pass (read-input "password: "))
(to (read-input "chat with: ")))
(with-xmpp-session jid pass
(set-xmpp-handler 'message print-message)
(let loop ()
(let ((msg (read-line (current-input-port))))
(send (message to msg))
(loop))))))
2009-04-02 15:49:11 +00:00
2009-04-03 08:48:50 +00:00
2009-04-16 15:33:06 +00:00
## possibly interesting extensions to implement.
2009-04-02 15:59:27 +00:00
see http://xmpp.org/extensions/
2009-04-02 15:49:11 +00:00
* XEP-0047: In-Band Bytestreams
* XEP-0066: Out of Band Data
* XEP-0030: Service Discovery
* XEP-0060: Publish-Subscribe
* XEP-0045: Multi-User Chat
* XEP-0149: Time Periods
* XEP-0166: Jingle
* XEP-0174: Serverless Messaging
* XEP-0199: XMPP Ping
* XEP-0224: Attention
* XEP-0077: In-Band Registration