lib.rs

  1//! A crate parsing common XMPP elements into Rust structures.
  2//!
  3//! Each module implements the [`TryFrom<Element>`] trait, which takes a
  4//! minidom [`Element`] and returns a `Result` whose value is `Ok` if the
  5//! element parsed correctly, `Err(error::Error)` otherwise.
  6//!
  7//! The returned structure can be manipuled as any Rust structure, with each
  8//! field being public.  You can also create the same structure manually, with
  9//! some having `new()` and `with_*()` helper methods to create them.
 10//!
 11//! Once you are happy with your structure, you can serialise it back to an
 12//! [`Element`], using either `From` or `Into<Element>`, which give you what
 13//! you want to be sending on the wire.
 14//!
 15//! [`TryFrom<Element>`]: ../try_from/trait.TryFrom.html
 16//! [`Element`]: ../minidom/element/struct.Element.html
 17
 18// Copyright (c) 2017 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
 19// Copyright (c) 2017 Maxime “pep” Buquet <pep+code@bouah.net>
 20//
 21// This Source Code Form is subject to the terms of the Mozilla Public
 22// License, v. 2.0. If a copy of the MPL was not distributed with this
 23// file, You can obtain one at http://mozilla.org/MPL/2.0/.
 24
 25extern crate minidom;
 26extern crate jid;
 27extern crate base64;
 28extern crate digest;
 29extern crate sha1;
 30extern crate sha2;
 31extern crate sha3;
 32extern crate blake2;
 33extern crate chrono;
 34extern crate try_from;
 35
 36/// Error type returned by every parser on failure.
 37pub mod error;
 38/// XML namespace definitions used through XMPP.
 39pub mod ns;
 40/// Various helpers.
 41pub mod helpers;
 42/// Helper macros to parse and serialise more easily.
 43#[macro_use]
 44pub mod macros;
 45
 46#[cfg(test)]
 47/// Namespace-aware comparison for tests
 48mod compare_elements;
 49
 50/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 51pub mod message;
 52/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 53pub mod presence;
 54/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 55pub mod iq;
 56/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 57pub mod stanza_error;
 58/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 59pub mod sasl;
 60/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
 61pub mod bind;
 62
 63/// RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence
 64pub mod roster;
 65
 66/// RFC 7395: An Extensible Messaging and Presence Protocol (XMPP) Subprotocol for WebSocket
 67pub mod websocket;
 68
 69/// XEP-0004: Data Forms
 70pub mod data_forms;
 71
 72/// XEP-0030: Service Discovery
 73pub mod disco;
 74
 75/// XEP-0045: Multi-User Chat
 76pub mod muc;
 77
 78/// XEP-0047: In-Band Bytestreams
 79pub mod ibb;
 80
 81/// XEP-0059: Result Set Management
 82pub mod rsm;
 83
 84/// XEP-0060: Publish-Subscribe
 85pub mod pubsub;
 86
 87/// XEP-0077: In-Band Registration
 88pub mod ibr;
 89
 90/// XEP-0082: XMPP Date and Time Profiles
 91pub mod date;
 92
 93/// XEP-0085: Chat State Notifications
 94pub mod chatstates;
 95
 96/// XEP-0092: Software Version
 97pub mod version;
 98
 99/// XEP-0107: User Mood
100pub mod mood;
101
102/// XEP-0115: Entity Capabilities
103pub mod caps;
104
105/// XEP-0166: Jingle
106pub mod jingle;
107
108/// XEP-0184: Message Delivery Receipts
109pub mod receipts;
110
111/// XEP-0191: Blocking Command
112pub mod blocking;
113
114/// XEP-0199: XMPP Ping
115pub mod ping;
116
117/// XEP-0203: Delayed Delivery
118pub mod delay;
119
120/// XEP-0221: Data Forms Media Element
121pub mod media_element;
122
123/// XEP-0224: Attention
124pub mod attention;
125
126/// XEP-0234: Jingle File Transfer
127pub mod jingle_ft;
128
129/// XEP-0260: Jingle SOCKS5 Bytestreams Transport Method
130pub mod jingle_s5b;
131
132/// XEP-0261: Jingle In-Band Bytestreams Transport Method
133pub mod jingle_ibb;
134
135/// XEP-0297: Stanza Forwarding
136pub mod forwarding;
137
138/// XEP-0300: Use of Cryptographic Hash Functions in XMPP
139pub mod hashes;
140
141/// XEP-0308: Last Message Correction
142pub mod message_correct;
143
144/// XEP-0313: Message Archive Management
145pub mod mam;
146
147/// XEP-0319: Last User Interaction in Presence
148pub mod idle;
149
150/// XEP-0353: Jingle Message Initiation
151pub mod jingle_message;
152
153/// XEP-0359: Unique and Stable Stanza IDs
154pub mod stanza_id;
155
156/// XEP-0380: Explicit Message Encryption
157pub mod eme;
158
159/// XEP-0390: Entity Capabilities 2.0
160pub mod ecaps2;