(sigil xmpp)
(sigil xmpp) - XMPP Client Library
Provides a complete XMPP client with STARTTLS, SASL authentication, stanza handling, roster, presence, MUC, and cooperative I/O.
Exports
xmpp-install-featuresprocedureInstall roster, presence, and MUC feature handlers on a connection.
Call this after creating a connection to enable automatic roster push handling, presence tracking, and MUC occupant tracking.
(define conn (make-xmpp-connection ...))
(xmpp-install-features conn)
(xmpp-connect conn)jidprocedureConstruct a jid struct.
Re-exported from (sigil xmpp stanza)
jid?procedureTest if a value is a jid struct.
Re-exported from (sigil xmpp stanza)
jid-localprocedureGet the local field of a jid struct.
Re-exported from (sigil xmpp stanza)
jid-domainprocedureGet the domain field of a jid struct.
Re-exported from (sigil xmpp stanza)
jid-resourceprocedureGet the resource field of a jid struct.
Re-exported from (sigil xmpp stanza)
parse-jidprocedureParse a JID string into a jid record.
Handles formats: "local@domain/resource", "local@domain", "domain/resource", and bare "domain".
(parse-jid "user@example.com/bot")
; => #<jid local: "user" domain: "example.com" resource: "bot">Re-exported from (sigil xmpp stanza)
jid->stringprocedureConvert a jid record to its string representation.
(jid->string (parse-jid "user@example.com/bot"))
; => "user@example.com/bot"Re-exported from (sigil xmpp stanza)
jid-bareprocedureReturn the bare JID (without resource) as a string.
(jid-bare "user@example.com/bot") ; => "user@example.com"
(jid-bare (parse-jid "user@example.com/bot")) ; => "user@example.com"Re-exported from (sigil xmpp stanza)
xmpp-messagevariableConstruct an XMPP message stanza as SXML.
(xmpp-message to: "user@ex.com" body: "Hello")
; => (message (@ (to "user@ex.com") (id "s1-...")) (body "Hello"))Re-exported from (sigil xmpp stanza)
xmpp-presencevariableConstruct an XMPP presence stanza as SXML.
(xmpp-presence show: "away" status: "Be right back")Re-exported from (sigil xmpp stanza)
xmpp-iqvariableConstruct an XMPP IQ stanza as SXML.
(xmpp-iq type: "get" to: "example.com"
children: (list '(query (@ (xmlns "jabber:iq:roster")))))Re-exported from (sigil xmpp stanza)
stanza-typeprocedureGet the type of a stanza (message, presence, iq) as a symbol.
Re-exported from (sigil xmpp stanza)
stanza-attrprocedureGet an attribute value from a stanza.
(stanza-attr msg 'to) ; => "user@example.com"Re-exported from (sigil xmpp stanza)
stanza-toprocedureGet the 'to' attribute of a stanza.
Re-exported from (sigil xmpp stanza)
stanza-fromprocedureGet the 'from' attribute of a stanza.
Re-exported from (sigil xmpp stanza)
stanza-idprocedureGet the 'id' attribute of a stanza.
Re-exported from (sigil xmpp stanza)
message-bodyprocedureGet the body text from a message stanza.
(message-body '(message (@ (to "a@b")) (body "Hello")))
; => "Hello"Re-exported from (sigil xmpp stanza)
stanza-childprocedureFind the first child element with the given tag name.
(stanza-child msg 'body) ; => (body "Hello")Re-exported from (sigil xmpp stanza)
stanza-childrenprocedureFind all child elements with the given tag name.
Re-exported from (sigil xmpp stanza)
sxml-textprocedureExtract text content from an SXML element.
Returns the concatenation of all string children, or #f if none.
Re-exported from (sigil xmpp stanza)
generate-stanza-idprocedureGenerate a unique stanza ID.
Uses a counter combined with random bytes for uniqueness.
Re-exported from (sigil xmpp stanza)
stanza->xmlprocedureConvert a stanza (SXML) to an XML string.
(stanza->xml (xmpp-message to: "user@ex.com" body: "Hi"))
; => "<message to=\"user@ex.com\" ...><body>Hi</body></message>"Re-exported from (sigil xmpp stanza)
select-sasl-mechanismprocedureSelect the best SASL mechanism from a list of server-offered mechanisms.
Returns a symbol: 'scram-sha-1, 'plain, or #f if none supported.
Re-exported from (sigil xmpp sasl)
make-xmpp-connectionvariableCreate a new XMPP connection (does not connect yet).
(make-xmpp-connection
server: "example.com"
jid: "bot@example.com"
password: "secret"
resource: "bot")Re-exported from (sigil xmpp connection)
xmpp-connection?procedureTest if a value is a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connection-serverprocedureGet the server field of a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connection-portprocedureGet the port field of a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connection-jidprocedureGet the jid field of a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connection-stateprocedureGet the state field of a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connection-bound-jidprocedureGet the bound-jid field of a xmpp-connection struct.
Re-exported from (sigil xmpp connection)
xmpp-connectprocedureConnect to the XMPP server.
Performs the full XMPP connection sequence: TCP connect -> stream open -> STARTTLS -> SASL auth -> bind
Returns #t on success, #f on failure.
Re-exported from (sigil xmpp connection)
xmpp-disconnectprocedureDisconnect from the XMPP server.
Re-exported from (sigil xmpp connection)
xmpp-connected?procedureCheck if connection is in connected state.
Re-exported from (sigil xmpp connection)
xmpp-on-stanzaprocedureRegister a handler for all incoming stanzas.
Re-exported from (sigil xmpp connection)
xmpp-onprocedureRegister a handler for a specific event type.
Event types: 'message, 'presence, 'iq, 'connected, 'disconnected, 'error
Re-exported from (sigil xmpp connection)
xmpp-send-iqprocedureSend an IQ stanza and register a callback for the response.
The callback receives the response stanza.
(xmpp-send-iq conn
(xmpp-iq type: "get" children: '((query (@ (xmlns "jabber:iq:roster")))))
(lambda (response) (display "Got roster\n")))Re-exported from (sigil xmpp connection)
xmpp-channelprocedureGet a channel for receiving events of a given type.
Creates a broadcast subscription. Use with channel-receive or for-channel.
(let ((msgs (xmpp-channel conn 'message)))
(for-channel msgs
(lambda (stanza)
(display (message-body stanza)))))Re-exported from (sigil xmpp connection)
xmpp-sendprocedureSend a stanza (SXML) to the server.
(xmpp-send conn (xmpp-message to: "user@ex.com" body: "Hi"))Re-exported from (sigil xmpp connection)
xmpp-send-rawprocedureSend raw XML string to the server.
Re-exported from (sigil xmpp connection)
xmpp-process-inputprocedureProcess available input from the XMPP connection.
Returns #t if connection is alive, #f if disconnected.
Re-exported from (sigil xmpp connection)
xmpp-runprocedureRun the XMPP connection event loop.
Processes stanzas until disconnected. When running inside a with-async context, cooperates with other tasks via await-readable. Otherwise blocks in a traditional event loop.
Re-exported from (sigil xmpp connection)
xmpp-tickprocedureProcess one tick of the XMPP connection (non-blocking).
Returns #t if connection is alive, #f if disconnected.
Re-exported from (sigil xmpp connection)
xmpp-send-presenceprocedureSend initial presence to indicate availability.
Re-exported from (sigil xmpp connection)
roster-itemprocedureConstruct a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item?procedureTest if a value is a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item-jidprocedureGet the jid field of a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item-nameprocedureGet the name field of a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item-subscriptionprocedureGet the subscription field of a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item-groupsprocedureGet the groups field of a roster-item struct.
Re-exported from (sigil xmpp roster)
roster-item-askprocedureGet the ask field of a roster-item struct.
Re-exported from (sigil xmpp roster)
xmpp-request-rosterprocedureRequest the roster from the server.
Calls callback with a list of roster-item records.
(xmpp-request-roster conn
(lambda (items)
(for-each (lambda (item)
(display (roster-item-jid item)))
items)))Re-exported from (sigil xmpp roster)
xmpp-rosterprocedureGet the cached roster as a list of roster-items.
Returns #f if the roster hasn't been fetched yet.
Re-exported from (sigil xmpp roster)
xmpp-roster-itemprocedureLook up a specific contact in the cached roster.
Re-exported from (sigil xmpp roster)
xmpp-roster-addvariableAdd or update a contact in the roster.
(xmpp-roster-add conn "friend@example.com" name: "Friend")Re-exported from (sigil xmpp roster)
xmpp-roster-removeprocedureRemove a contact from the roster.
Re-exported from (sigil xmpp roster)
xmpp-subscribeprocedureSend a subscription request to a JID.
Re-exported from (sigil xmpp roster)
xmpp-accept-subscriptionprocedureAccept a subscription request from a JID.
Re-exported from (sigil xmpp roster)
xmpp-deny-subscriptionprocedureDeny a subscription request from a JID.
Re-exported from (sigil xmpp roster)
xmpp-unsubscribeprocedureUnsubscribe from a JID's presence.
Re-exported from (sigil xmpp roster)
presence-infoprocedureConstruct a presence-info struct.
Re-exported from (sigil xmpp presence)
presence-info?procedureTest if a value is a presence-info struct.
Re-exported from (sigil xmpp presence)
presence-info-jidprocedureGet the jid field of a presence-info struct.
Re-exported from (sigil xmpp presence)
presence-info-showprocedureGet the show field of a presence-info struct.
Re-exported from (sigil xmpp presence)
presence-info-statusprocedureGet the status field of a presence-info struct.
Re-exported from (sigil xmpp presence)
presence-info-priorityprocedureGet the priority field of a presence-info struct.
Re-exported from (sigil xmpp presence)
xmpp-set-statusvariableSet own presence status.
(xmpp-set-status conn show: "away" status: "Be right back")Re-exported from (sigil xmpp presence)
xmpp-go-offlineprocedureGo offline (send unavailable presence and disconnect).
Re-exported from (sigil xmpp presence)
xmpp-presence-ofprocedureGet the cached presence info for a JID.
Returns a presence-info record or #f.
Re-exported from (sigil xmpp presence)
xmpp-resources-ofprocedureGet all available resources for a bare JID.
Returns a list of full JID strings that are currently available.
Re-exported from (sigil xmpp presence)
muc-roomprocedureConstruct a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room?procedureTest if a value is a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room-jidprocedureGet the jid field of a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room-nickprocedureGet the nick field of a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room-subjectprocedureGet the subject field of a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room-occupantsprocedureGet the occupants field of a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-room-joined?procedureGet the joined? field of a muc-room struct.
Re-exported from (sigil xmpp muc)
muc-occupantprocedureConstruct a muc-occupant struct.
Re-exported from (sigil xmpp muc)
muc-occupant?procedureTest if a value is a muc-occupant struct.
Re-exported from (sigil xmpp muc)
muc-occupant-nickprocedureGet the nick field of a muc-occupant struct.
Re-exported from (sigil xmpp muc)
muc-occupant-jidprocedureGet the jid field of a muc-occupant struct.
Re-exported from (sigil xmpp muc)
muc-occupant-affiliationprocedureGet the affiliation field of a muc-occupant struct.
Re-exported from (sigil xmpp muc)
muc-occupant-roleprocedureGet the role field of a muc-occupant struct.
Re-exported from (sigil xmpp muc)
xmpp-muc-joinprocedureJoin a MUC room.
(xmpp-muc-join conn "room@conference.example.com" "mynick")Re-exported from (sigil xmpp muc)
xmpp-muc-leavevariableLeave a MUC room.
Re-exported from (sigil xmpp muc)
xmpp-muc-messageprocedureSend a message to a MUC room.
(xmpp-muc-message conn "room@conference.example.com" "Hello room!")Re-exported from (sigil xmpp muc)
xmpp-muc-private-messageprocedureSend a private message to a MUC occupant.
Re-exported from (sigil xmpp muc)
xmpp-muc-set-subjectprocedureSet the subject of a MUC room.
Re-exported from (sigil xmpp muc)
xmpp-muc-occupantsprocedureGet the occupants of a MUC room.
Returns a list of muc-occupant records, or '() if not in the room.
Re-exported from (sigil xmpp muc)
xmpp-muc-kickvariableKick an occupant from a MUC room (requires moderator role).
Re-exported from (sigil xmpp muc)
xmpp-muc-invitevariableSend a mediated invitation to a user.
Re-exported from (sigil xmpp muc)