jid
8.18
top
← prev up next →

XMPP Core FunctionsπŸ”— i

Navlost <racket at navlost dot eu>

(require xmpp/core ) package: XMPP

This package implements core elements required by other higher-level XMPP packages.

procedure

( xmpp-id )(string? )

Generates a string suitable for use as a stanza ID.

struct

(struct jid (localpartdomainpartresourcepart))

localpart:string?
domainpart:string?
resourcepart:string?
Representation of a JID, an XMPP address.

A JID consists of a localpart, a domainpart and a resourcepart, in that order. The localpart is optional and if present, it must precede the domainpart and is separated from it by an @ sign. Likewise, the resourcepart is also optional, follows the domainpart and is separated from it by a / (slash) character. A valid JID always has at least a domainpart.

procedure

( invalid-jid )(jid? )

Creates an instance of jid representing an invalid JID.

This is mainly useful when populating other data structures that require jid values, before we are able to obtain a valid JID from the user.

procedure

( valid-jid? jid)(boolean? )

jid:jid?
Predicate returning #t if jid is a valid JID, #f otherwise.

Examples:
> (valid-jid? (jid"user""example.net""laptop"))

#t

#f

procedure

( bare-jid jid)(jid? )

jid:jid?
Given a JID, return the bare JID.

Example:
> (bare-jid (jid"user""example.net""laptop"))

(jid "user" "example.net" "")

procedure

( bare-jid-equal? jid0jid1)(boolean? )

jid0:jid?
jid1:jid?
Compare two JIDs for equality, disregarding their resource part.

To compare two full JIDs for equality, use equal? .

Examples:
> (equal? (jid "user""example.net""laptop")
(jid "user""example.net""workstation"))

#f

> (bare-jid-equal? (jid "user""example.net""laptop")
(jid "user""example.net""workstation"))

#t

> (bare-jid-equal? (jid "user""example.net""laptop")
(jid "user""example.com""laptop"))

#f

procedure

( jid/string? v)(boolean? )

v:any/c
Predicate returning #t if v is either a jid or a string , whether or not it can be parsed into a valid JID.

Examples:
> (jid/string? (jid "user""example.net""laptop"))

#t

#t

> (jid/string? "user@example.net/laptop")

#t

> (jid/string? "")

#t

> (jid/string? 33)

#f

procedure

( jid->string jid)(string? )

jid:jid?
Return a string representation of a jid.

Example:
> (jid->string (jid"user""example.net""resource"))

"user@example.net/resource"

procedure

( jid→string jid)(string? )

jid:jid?
An alias for jid->string .

procedure

( jid/string->string v)(string? )

v:(or/cjid? string? )
Return a string representation of a jid , or v if it is already a string.

This can be used to provide some flexibility when accepting inputs into procedures requiring JIDs as strings.

procedure

( jid/string→string v)(string? )

v:(or/cjid? string? )
An alias for jid/string->string .

procedure

( string->jid str)(jid? )

str:(and/cstring? non-empty-string?)
Try to parse a string into a jid .

Example:
> (string->jid "user@example.net/resource")

(jid "user" "example.net" "resource")

procedure

( string→jid str)(jid? )

str:(and/cstring? non-empty-string?)
An alias for string->jid .

struct

port
jid
passwd
i-port
o-port
custodian
buffer
encryption))
host:string?
jid:jid?
passwd:string?
i-port:input-port?
o-port:output-port?
custodian:custodian?
buffer:(listofxexpr/c )
encryption:symbol?
Mutable structure that holds the details of an XMPP session.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /