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-2018 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
36pub use minidom::Element;
37
38/// Error type returned by every parser on failure.
39pub mod error;
40/// XML namespace definitions used through XMPP.
41pub mod ns;
42
43/// Various helpers.
44mod helpers;
45/// Helper macros to parse and serialise more easily.
46#[macro_use]
47mod macros;
48
49#[cfg(test)]
50/// Namespace-aware comparison for tests
51mod compare_elements;
52
53/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
54pub mod message;
55/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
56pub mod presence;
57/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
58pub mod iq;
59/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
60pub mod stanza_error;
61/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
62pub mod stream;
63/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
64pub mod sasl;
65/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
66pub mod bind;
67
68/// RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence
69pub mod roster;
70
71/// RFC 7395: An Extensible Messaging and Presence Protocol (XMPP) Subprotocol for WebSocket
72pub mod websocket;
73
74/// XEP-0004: Data Forms
75pub mod data_forms;
76
77/// XEP-0030: Service Discovery
78pub mod disco;
79
80/// XEP-0045: Multi-User Chat
81pub mod muc;
82
83/// XEP-0047: In-Band Bytestreams
84pub mod ibb;
85
86/// XEP-0048: Bookmarks
87pub mod bookmarks;
88
89/// XEP-0059: Result Set Management
90pub mod rsm;
91
92/// XEP-0060: Publish-Subscribe
93pub mod pubsub;
94
95/// XEP-0077: In-Band Registration
96pub mod ibr;
97
98/// XEP-0082: XMPP Date and Time Profiles
99pub mod date;
100
101/// XEP-0085: Chat State Notifications
102pub mod chatstates;
103
104/// XEP-0092: Software Version
105pub mod version;
106
107/// XEP-0107: User Mood
108pub mod mood;
109
110/// XEP-0114: Jabber Component Protocol
111pub mod component;
112
113/// XEP-0115: Entity Capabilities
114pub mod caps;
115
116/// XEP-0166: Jingle
117pub mod jingle;
118
119/// XEP-0172: User Nickname
120pub mod nick;
121
122/// XEP-0184: Message Delivery Receipts
123pub mod receipts;
124
125/// XEP-0191: Blocking Command
126pub mod blocking;
127
128/// XEP-0198: Stream Management
129pub mod sm;
130
131/// XEP-0199: XMPP Ping
132pub mod ping;
133
134/// XEP-0203: Delayed Delivery
135pub mod delay;
136
137/// XEP-0221: Data Forms Media Element
138pub mod media_element;
139
140/// XEP-0224: Attention
141pub mod attention;
142
143/// XEP-0234: Jingle File Transfer
144pub mod jingle_ft;
145
146/// XEP-0260: Jingle SOCKS5 Bytestreams Transport Method
147pub mod jingle_s5b;
148
149/// XEP-0261: Jingle In-Band Bytestreams Transport Method
150pub mod jingle_ibb;
151
152/// XEP-0297: Stanza Forwarding
153pub mod forwarding;
154
155/// XEP-0300: Use of Cryptographic Hash Functions in XMPP
156pub mod hashes;
157
158/// XEP-0308: Last Message Correction
159pub mod message_correct;
160
161/// XEP-0313: Message Archive Management
162pub mod mam;
163
164/// XEP-0319: Last User Interaction in Presence
165pub mod idle;
166
167/// XEP-0353: Jingle Message Initiation
168pub mod jingle_message;
169
170/// XEP-0359: Unique and Stable Stanza IDs
171pub mod stanza_id;
172
173/// XEP-0380: Explicit Message Encryption
174pub mod eme;
175
176/// XEP-0390: Entity Capabilities 2.0
177pub mod ecaps2;