#xmpp #protocols #struct #part #node #bare #jabber-id

no-std jid

A crate which provides a Jid struct for Jabber IDs

25 releases

0.11.1 Jul 23, 2024
0.10.0 Aug 20, 2023
0.9.4 Jul 13, 2022
0.9.3 Mar 7, 2022
0.1.0 Feb 27, 2017

#220 in Network programming

Download history 61/week @ 2024-08-12 36/week @ 2024-08-19 68/week @ 2024-08-26 25/week @ 2024-09-02 44/week @ 2024-09-09 31/week @ 2024-09-16 150/week @ 2024-09-23 68/week @ 2024-09-30 27/week @ 2024-10-07 83/week @ 2024-10-14 48/week @ 2024-10-21 50/week @ 2024-10-28 82/week @ 2024-11-04 18/week @ 2024-11-11 46/week @ 2024-11-18 38/week @ 2024-11-25

188 downloads per month
Used in 14 crates (4 directly)

MPL-2.0 license

76KB
1.5K SLoC

jid

What's this?

A crate which provides a struct Jid for Jabber IDs. It's used in xmpp-rs but other XMPP libraries can of course use this.

What license is it under?

MPL-2.0 or later, see the LICENSE file.

Notes

This library does not yet implement RFC7622.


lib.rs:

Represents XMPP addresses, also known as JabberIDs (JIDs) for the XMPP protocol. A [Jid] can have between one and three parts in the form node@domain/resource:

  • the (optional) node part designates a specific account/service on a server, for example username@server.com
  • the domain part designates a server, for example irc.jabberfr.org
  • the (optional) resource part designates a more specific client, such as a participant in a groupchat (jabberfr@chat.jabberfr.org/user) or a specific client device associated with an account (user@example.com/dino)

The [Jid] enum can be one of two variants, containing a more specific type:

  • BareJid (Jid::Bare variant): a JID without a resource
  • FullJid (Jid::Full variant): a JID with a resource

Jids as per the XMPP protocol only ever contain valid UTF-8. However, creating any form of Jid can fail in one of the following cases:

  • wrong syntax: creating a Jid with an empty (yet declared) node or resource part, such as @example.com or user@example.com/
  • stringprep error: some characters were invalid according to the stringprep algorithm, such as mixing left-to-write and right-to-left characters

Dependencies

~1.6–2.1MB
~54K SLoC