Commit graph

447 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
32e373be03 helpers: Add a plain text codec. 2017-11-23 16:19:04 +00:00
Emmanuel Gil Peyrot
cb6eb55686 macros: Uniformise trailing commas handling. 2017-11-23 16:06:35 +00:00
Emmanuel Gil Peyrot
3f57edfc27 hashes: Use the new helpers. 2017-11-23 15:52:06 +00:00
Emmanuel Gil Peyrot
ad17c877f5 Move Base64 codec into a helper module. 2017-11-23 16:00:47 +00:00
Rust Cambridge Mob
3e37beffe2 Implement macro for elements containing children 2017-11-16 21:00:01 +00:00
Rust Cambridge Mob
77e150c63d Implement macro for elements containing text 2017-11-16 20:17:11 +00:00
Emmanuel Gil Peyrot
9c9ffe70a7 caps: Do the same fixes, unbreak blake2 and simplify code. 2017-11-15 23:16:37 +00:00
Emmanuel Gil Peyrot
702c4d2932 ecaps2: Use the digest() facility to simplify hashing. 2017-11-15 23:15:12 +00:00
Emmanuel Gil Peyrot
c1ff291c11 Update all crypto crates to their latest release; un-break blake2b. 2017-11-15 18:37:28 +00:00
Emmanuel Gil Peyrot
8aa51bd047 eme: Restore docstrings. 2017-11-01 00:24:23 +00:00
Emmanuel Gil Peyrot
4fb909cfd1 data_forms: Simplify serialisation using .map(). 2017-10-31 23:33:34 +00:00
Emmanuel Gil Peyrot
1e39a4cdd7 jingle_s5b: Actually use the Candidate parser. 2017-10-31 22:31:57 +00:00
Emmanuel Gil Peyrot
35258482ba delay: Simplify parsing and add more checks. 2017-10-31 22:27:13 +00:00
Emmanuel Gil Peyrot
7950fe8f52 rsm: Simplify serialisation. 2017-10-31 22:21:50 +00:00
Emmanuel Gil Peyrot
86eb65b829 mam: Bump jid to 0.3.1, to serialise it directly to a text node. 2017-10-31 22:21:27 +00:00
Emmanuel Gil Peyrot
6e48d0f65a media_element: Also check for unknown attributes. 2017-10-31 22:04:13 +00:00
Emmanuel Gil Peyrot
4875f15201 media_element: Parse URI separately from MediaElement. 2017-10-31 22:01:52 +00:00
Emmanuel Gil Peyrot
fb27b6225c jingle_ft: Correctly insert <range/> in <file/>. 2017-10-31 21:44:43 +00:00
Emmanuel Gil Peyrot
bd9aa01ad5 Split macros into their own module. 2017-10-31 21:17:24 +00:00
Emmanuel Gil Peyrot
df069ac6c6 mam: Simplify parsing. 2017-10-31 21:10:04 +00:00
Emmanuel Gil Peyrot
6eba0e7d87 Simplify check_self macro. 2017-10-31 20:35:25 +00:00
Emmanuel Gil Peyrot
5cdb2d77ab Split out DateTime parsing into its own module (implement XEP-0082). 2017-10-31 19:41:45 +00:00
Emmanuel Gil Peyrot
82fcf3bad5 ecaps2: Simplify parsing. 2017-10-31 19:07:49 +00:00
Emmanuel Gil Peyrot
47c9263b86 blocking: Merge get_children_items into the try_from. 2017-10-31 18:53:51 +00:00
Emmanuel Gil Peyrot
649286d59e disco: Use generate_element_with_only_attributes. 2017-10-31 18:49:22 +00:00
Emmanuel Gil Peyrot
61badccf8b Add meta support to macros. 2017-10-31 18:37:32 +00:00
Emmanuel Gil Peyrot
929bd577f3 Add a generate_element_with_only_attributes macro, and use it wherever it makes sense. 2017-10-31 17:58:11 +00:00
Emmanuel Gil Peyrot
ed53f452c3 ping: Add a serialise test. 2017-10-31 17:57:49 +00:00
Emmanuel Gil Peyrot
b5e41a7074 Fix the name in create_empty_element. 2017-10-31 17:55:27 +00:00
Emmanuel Gil Peyrot
7fa889f46e jingle: Import the disposition attribute values. 2017-10-31 17:17:06 +00:00
Emmanuel Gil Peyrot
97abc37f1a jingle_ft: Improve <range/> parsing. 2017-10-31 17:02:24 +00:00
Emmanuel Gil Peyrot
667ae4c40f jingle_ft: Implement checksum parsers. 2017-10-31 16:41:22 +00:00
Emmanuel Gil Peyrot
cf31506580 jingle_ft: Split Description::try_from into File::try_from. 2017-10-31 16:25:01 +00:00
Emmanuel Gil Peyrot
db9ef3ef30 jingle_ft: Use jingle’s ContentId type to identify content names. 2017-10-31 16:11:09 +00:00
Emmanuel Gil Peyrot
0200ced3e5 jingle_ft: Finish implementation of received. 2017-10-31 16:09:28 +00:00
Emmanuel Gil Peyrot
b7b3340c9f Add a blocking command parser (XEP-0191). 2017-10-31 15:48:11 +00:00
Emmanuel Gil Peyrot
f85b451fcf Add a new check_no_attributes macro, to avoid the empty list. 2017-10-31 15:47:38 +00:00
Emmanuel Gil Peyrot
1892e1ca04 disco: Check for children ordering in disco#info. 2017-10-29 00:36:36 +01:00
Emmanuel Gil Peyrot
a8cfc8e62e pubsub::event: Add more type safety. 2017-10-10 19:45:08 +01:00
Emmanuel Gil Peyrot
e1477f146b pubsub::event: Use the new helper macros to simplify parsing. 2017-10-10 19:27:29 +01:00
Emmanuel Gil Peyrot
5f6f6a5e91 disco: Use the new helper macros to simplify parsing. 2017-10-10 19:00:42 +01:00
Emmanuel Gil Peyrot
9f27f200ca data_forms: Use the new helper macros to simplify parsing. 2017-10-10 18:26:05 +01:00
Emmanuel Gil Peyrot
a2c7529668 eme: Use the new helper macros to simplify parsing. 2017-10-10 18:10:52 +01:00
Emmanuel Gil Peyrot
ee243c4720 chatstates: Use the new helper macros to simplify parsing. 2017-10-10 18:09:58 +01:00
Emmanuel Gil Peyrot
a2b6033336 caps: Use the new helper macros to simplify parsing. 2017-10-10 18:04:27 +01:00
Emmanuel Gil Peyrot
66fb8fea74 message_correct: Use the new helper macros to simplify parsing. 2017-10-10 18:00:15 +01:00
Emmanuel Gil Peyrot
cfbfce512e lib, ping, attention: Add a macro for singleton elements. 2017-10-10 17:53:25 +01:00
Emmanuel Gil Peyrot
6add31b526 lib: Add check macros, to simplify code. 2017-10-10 17:52:14 +01:00
Emmanuel Gil Peyrot
33018a5c09 roster: Make subscription="none" the default, see RFC6121 §2.1.2.5. 2017-10-10 17:40:29 +01:00
Emmanuel Gil Peyrot
92277ccde0 jingle_ft: Add support for empty range elements.
These can be used to indicate support for ranged transfers.
2017-08-27 02:33:37 +01:00
Emmanuel Gil Peyrot
f51fa15b68 jingle_ft: Add forgotten xml:lang support for <desc/>. 2017-08-27 01:22:15 +01:00
Emmanuel Gil Peyrot
833ef068c6 message: Fix wrong element for xml:lang. 2017-08-27 01:21:07 +01:00
Emmanuel Gil Peyrot
f69f567448 Use minidom 0.6.1’s Element::has_ns(), to simplify namespace comparisons. 2017-08-27 01:04:56 +01:00
Emmanuel Gil Peyrot
c853a1ff4b compare_elements: Add missing license notice. 2017-08-27 01:32:15 +01:00
Astro
1b1661fd82 Introduce comparing with namespace support. 2017-08-19 00:04:18 +01:00
Emmanuel Gil Peyrot
1af06fdf6d Add an iq version parser (XEP-0092). 2017-07-29 11:45:45 +01:00
Emmanuel Gil Peyrot
69cc83c456 message, iq, presence, stanza_error, forwarded: Add support for components hidden behind the component feature flag. 2017-07-29 06:49:02 +01:00
Emmanuel Gil Peyrot
99b9525e6f Update to jid-rs 0.2.3, which implements IntoAttributeValue on Jid. 2017-07-29 06:28:20 +01:00
Emmanuel Gil Peyrot
d55fa8e5dd chatstates: Prevent compilation if the module isn’t properly documented. 2017-07-29 06:26:50 +01:00
Emmanuel Gil Peyrot
a04c395122 roster: Document most structs and their fields. 2017-07-29 06:22:35 +01:00
Emmanuel Gil Peyrot
56a66f8c4b message: Enforce more type safety on Body, Subject and Thread. 2017-07-29 06:11:48 +01:00
Emmanuel Gil Peyrot
6ec1e46953 roster: Make Group a proper struct. 2017-07-29 05:36:59 +01:00
Emmanuel Gil Peyrot
5388696b95 lib: Remove erroneous “reference” mention in the module docstring. 2017-07-29 05:24:20 +01:00
Emmanuel Gil Peyrot
45d196463c disco: Document every struct and their fields. 2017-07-29 04:51:51 +01:00
Emmanuel Gil Peyrot
67e72b009e disco: Fix serialisation of extensions, and add a test. 2017-07-29 04:39:50 +01:00
Emmanuel Gil Peyrot
4d3717d170 disco: Split Feature and Identity parsing out of DiscoQueryResult. 2017-07-29 04:35:15 +01:00
Emmanuel Gil Peyrot
5ece20a029 disco: Create a mutable DiscoInfoResult at the beginning of its parsing. 2017-07-29 04:25:55 +01:00
Emmanuel Gil Peyrot
58760fc28d data_forms: Split field parsing into its own TryFrom impl. 2017-07-29 04:19:58 +01:00
Emmanuel Gil Peyrot
37d1ae64ad receipts: Split the stupid enum into two different structs. 2017-07-29 04:00:25 +01:00
Emmanuel Gil Peyrot
a0b1d93ff0 stanza_id: Split the stupid enum into two different structs. 2017-07-29 03:51:41 +01:00
Emmanuel Gil Peyrot
db35d28c9c ibb: Split the stupid enum into three different structs. 2017-07-29 03:44:35 +01:00
Emmanuel Gil Peyrot
dfb736a973 rsm: Change if .is_some() { .unwrap() } into if let Some(). 2017-07-29 03:03:45 +01:00
Emmanuel Gil Peyrot
f83fe92244 jingle: Wrap the disposition in a struct, to get better type safety. 2017-07-29 02:47:33 +01:00
Emmanuel Gil Peyrot
75ae6100b4 data_forms: Remove unneccessary swallowing of an error. 2017-07-29 02:41:42 +01:00
Emmanuel Gil Peyrot
4b3ced042e ecaps2, jingle_s5b: Replace drain() with into_iter(). 2017-07-26 00:04:20 +01:00
Emmanuel Gil Peyrot
83c9713ab9 caps, ecaps2: Make Blake2b panic and update the blake2 crate to 0.6.1.
See https://github.com/RustCrypto/hashes/issues/34 for more information.
2017-07-24 23:11:10 +01:00
Emmanuel Gil Peyrot
4454da15b6 disco: Implement disco#items. 2017-07-21 17:33:58 +01:00
Emmanuel Gil Peyrot
3b6733f38b Upgrade to minidom 0.4.4 to avoid having to redefine IntoElements for each Into<Element>. 2017-07-21 01:20:29 +01:00
Emmanuel Gil Peyrot
21cee25b27 Replace .and_then() with .map() wherever it makes sense. 2017-07-21 01:19:34 +01:00
Emmanuel Gil Peyrot
7612c53f9a attention, chatstates, eme, ping: Add a docstring on the structs. 2017-07-20 23:47:21 +01:00
Emmanuel Gil Peyrot
fd31e691af lib: Improve the wording of the docstring. 2017-07-20 23:46:44 +01:00
Emmanuel Gil Peyrot
87af0f3615 message, presence, iq: Improve documentation. 2017-07-20 23:10:13 +01:00
Emmanuel Gil Peyrot
5df585ca40 data_forms, ibr, message, presence, roster: Always use into_iter. 2017-07-20 23:09:22 +01:00
Emmanuel Gil Peyrot
f6f6faeb77 iq, jingle_ft: Simplify item counting with Iterator::count(). 2017-07-20 23:08:23 +01:00
Maxime “pep” Buquet
2571aa7666 presence: Add with_ helpers to build a Presence 2017-07-19 00:21:44 +01:00
Emmanuel Gil Peyrot
5543d71599 attention: Use super::* in tests like every other module. 2017-07-20 20:53:59 +01:00
Emmanuel Gil Peyrot
cc563b46d2 ecaps2, forwarding, jingle_s5b, mam: Replace complex into expressions with .map(Element::from). 2017-07-20 20:52:25 +01:00
Emmanuel Gil Peyrot
487dbdc6de Replace Into<Element> with From<…> for Element.
This allows Element::from() to work, and since Into<Element> is
automatically implemented for any type implementing From there is no
change to existing code.
2017-07-20 20:36:13 +01:00
Emmanuel Gil Peyrot
5ec921fa6f attention: Add missing unknown attribute check. 2017-07-20 20:11:00 +01:00
Emmanuel Gil Peyrot
1f43cd934b Use TryFrom from the try_from crate, instead of the unstable feature.
This makes xmpp-parsers usable on stable.
2017-07-20 20:03:15 +01:00
Emmanuel Gil Peyrot
0fcbf11644 iq: Split IqPayload into all three possible types. 2017-07-20 18:31:17 +01:00
Emmanuel Gil Peyrot
76a46559b8 disco: Split query and result. 2017-07-20 17:39:59 +01:00
Emmanuel Gil Peyrot
945ae350ac Add a jingle message parser and serialiser. 2017-07-15 11:38:44 +01:00
Emmanuel Gil Peyrot
161e5dcc9b jingle: Type Content::name better. 2017-07-15 11:37:29 +01:00
Emmanuel Gil Peyrot
244c9b2710 presence: Remove unused import in tests. 2017-06-27 22:21:35 +01:00
Maxime “pep” Buquet
98878042dd Use the generate_attribute macro in muc::user 2017-06-27 00:14:40 +01:00
Maxime “pep” Buquet
27cf9a6298 muc::Muc and muc::MucUser 2017-06-26 23:07:12 +01:00
Emmanuel Gil Peyrot
8ac4602240 presence: Add a simpler way to create a Presence. 2017-06-26 19:49:16 +01:00
Emmanuel Gil Peyrot
ad1d4adcec message: Add a simpler way to create a Message. 2017-06-26 19:47:26 +01:00
Emmanuel Gil Peyrot
96fe2d200e roster: Fix group serialisation and add a test. 2017-06-25 23:27:38 +01:00
Emmanuel Gil Peyrot
4338d9d638 jingle_s5b: Make jid a Jid and not a String. 2017-06-25 22:20:24 +01:00
Emmanuel Gil Peyrot
f6b222f49a jingle_ibb: Strengthen sid’s type safety. 2017-06-25 22:15:18 +01:00
Emmanuel Gil Peyrot
a219501fed jingle, jingle_ft: Use the new generate_id! macro to simplify Sid/Cid generation. 2017-06-25 22:14:51 +01:00
Emmanuel Gil Peyrot
95a19b4bb4 lib: Implement a generate_id! macro. 2017-06-25 22:14:21 +01:00
Emmanuel Gil Peyrot
3ea0c45337 jingle_s5b: Strengthen type safety for ids. 2017-06-25 21:38:58 +01:00
Emmanuel Gil Peyrot
f428ee070d Add an IBR parser. 2017-06-25 21:03:48 +01:00
Emmanuel Gil Peyrot
a48565e171 data_forms: Fix FORM_TYPE, <title/> and <instructions/> serialisation. 2017-06-25 20:13:43 +01:00
Emmanuel Gil Peyrot
13e8507848 chatstates: Improve parsing. 2017-06-25 19:55:55 +01:00
Emmanuel Gil Peyrot
17798190cf error: Implement fmt::Display and error::Error. 2017-06-17 03:36:12 +01:00
Emmanuel Gil Peyrot
6f69f2d7d9 jingle_ft: Parse <date/> into a proper DateTime. 2017-06-16 20:37:48 +01:00
Emmanuel Gil Peyrot
e7f0c45da5 jingle: Fix sid test. 2017-06-14 09:19:06 +01:00
Emmanuel Gil Peyrot
48d340120c jingle: Specialise Sid to get an increased type safety. 2017-06-14 02:28:42 +01:00
Emmanuel Gil Peyrot
216f6f8389 Fix build and compilation. 2017-06-14 01:57:02 +01:00
Emmanuel Gil Peyrot
393402032c jingle: Add a comment. 2017-06-14 00:59:37 +01:00
Emmanuel Gil Peyrot
ebc7582250 Move the Default implementation into more generate_attribute!. 2017-06-14 00:53:18 +01:00
Emmanuel Gil Peyrot
0f297d2d2d Add a generate_attribute! macro, and use it for the common case. 2017-06-14 00:50:57 +01:00
Emmanuel Gil Peyrot
9955c1131b ns: Remove now useless 'static lifetime. 2017-06-12 22:49:27 +01:00
Emmanuel Gil Peyrot
6c1c9d0851 Add a PubSub event parser and serialiser. 2017-06-11 14:48:31 +01:00
Emmanuel Gil Peyrot
334f2f78f8 data_forms: Implement IntoElements. 2017-06-11 14:42:11 +01:00
Emmanuel Gil Peyrot
88a3f507f6 idle, delay: Don’t import * from chrono::prelude. 2017-06-08 22:46:27 +02:00
Maxime “pep” Buquet
bd19341f69 Muc <x xmlns='http://jabber.org/protocol/muc#user'/> and <status /> parser 2017-05-31 02:54:47 +01:00
Maxime “pep” Buquet
c4c6528197 Muc <x xmlns='http://jabber.org/protocol/muc'/> parser 2017-05-30 22:02:56 +01:00
Emmanuel Gil Peyrot
33994c1042 hashes: Implement Eq and Hash. 2017-05-29 05:14:49 +01:00
Emmanuel Gil Peyrot
08ba164073 roster: Add a test for empty name == no name. 2017-05-29 03:42:11 +01:00
Emmanuel Gil Peyrot
7395e4b88f roster: Make an empty name be None instead.
RFC 6121 §2.4.1:
“Implementation Note: Including an empty 'name' attribute is equivalent
to including no 'name' attribute; both actions set the name to the
empty string.”
2017-05-29 03:40:34 +01:00
Emmanuel Gil Peyrot
073e208f06 iq: Wire up Roster. 2017-05-28 17:12:46 +01:00
Emmanuel Gil Peyrot
9eb8f39a38 presence: Make Show handle the None case, and rename PresenceType to Type. 2017-05-28 17:10:12 +01:00
Emmanuel Gil Peyrot
32bfa84551 presence: Rename Available to None, since that’s what it is. 2017-05-28 16:33:43 +01:00
Emmanuel Gil Peyrot
aae435c4d9 Add a roster parser/serialiser. 2017-05-28 16:30:43 +01:00
Emmanuel Gil Peyrot
ee34bc1a86 jingle_s5b: Remove unused .to_owned() during serialisation. 2017-05-28 01:47:12 +01:00
Emmanuel Gil Peyrot
6794b34714 Cargo.toml: Update minidom to 0.4.3 to use its new IntoAttributeValue implementation on numbers. 2017-05-27 23:18:15 +01:00
Emmanuel Gil Peyrot
8e1d5e7983 disco: Make xml:lang a proper Option and rename it to lang. 2017-05-27 22:10:00 +01:00
Emmanuel Gil Peyrot
d1a7d222f0 delay: Use chrono to parse the stamp. 2017-05-27 12:29:21 +01:00
Emmanuel Gil Peyrot
bdaced7603 caps, ecaps2: Add a function to create a Disco query from a hash. 2017-05-27 12:22:50 +01:00
Emmanuel Gil Peyrot
42235c42fb hashes: Implement From<Hash> for String. 2017-05-27 12:22:11 +01:00
Emmanuel Gil Peyrot
357568813d presence: Wire up legacy caps. 2017-05-27 12:21:32 +01:00
Emmanuel Gil Peyrot
2c77c4f701 idle: Add the chrono dependency to actually parse dates. 2017-05-27 12:20:19 +01:00
Emmanuel Gil Peyrot
dfdfd8cf71 Add a legacy caps parser and serialiser. 2017-05-25 02:34:03 +01:00
Emmanuel Gil Peyrot
764a7190e9 stanza_error: Simplify with IntoElements. 2017-05-25 01:14:36 +01:00
Emmanuel Gil Peyrot
56b7785942 delay: Remove clones. 2017-05-25 01:04:51 +01:00
Emmanuel Gil Peyrot
f08c81382c data_forms, media_element: Implement forgotten serialisation. 2017-05-25 01:00:17 +01:00
Emmanuel Gil Peyrot
b4e47e9a78 mam: Improve serialisation. 2017-05-25 00:41:13 +01:00
Emmanuel Gil Peyrot
a6b3152add hashes: Make the hash a Vec<u8>, to avoid base64 issues. 2017-05-25 00:30:29 +01:00
Emmanuel Gil Peyrot
070227ea03 eme: Remove two clones. 2017-05-25 00:30:00 +01:00
Emmanuel Gil Peyrot
b172a6e05c ecaps2: Remove the last clone. 2017-05-25 00:04:37 +01:00
Emmanuel Gil Peyrot
9bb65ea8fb jingle_ibb: Simplify parsing and remove clones. 2017-05-24 23:59:45 +01:00
Emmanuel Gil Peyrot
3678d9f0d3 stanza_error: Simplify attribute handling. 2017-05-24 23:56:35 +01:00
Emmanuel Gil Peyrot
898baddd3f disco: Split Into<Element> for Identity and Feature. 2017-05-24 23:47:27 +01:00
Emmanuel Gil Peyrot
17d6959606 jingle: Remove unused clones. 2017-05-24 23:38:44 +01:00
Emmanuel Gil Peyrot
9bd1e7f295 jingle_s5b: Remove the clones. 2017-05-24 23:00:38 +01:00