Commit graph

1594 commits

Author SHA1 Message Date
Astro
c13712b158 tokio-xmpp client: condense fn connect(), refactor out into stream_features 2020-05-30 00:43:35 +02:00
Astro
4d24e6bebb tokio-xmpp: name Event::Online fields, add resumed flag 2020-05-29 18:21:31 +02:00
f8cb643590
xmpp: Add ChatMessage and GroupMessage events; API likely to change
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-05-12 19:55:21 +02:00
597f5a3ccb
Update Changelogs re jid / serde
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-05-07 21:39:37 +02:00
8bf643a84f
jid: implement custom (De)Serializer for a prettier visual
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-05-01 02:26:58 +02:00
91c8045329
jid: impl &{Bare,Full}Jid for String
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-05-01 02:25:30 +02:00
36aaa3e681
jid: Add serde support behind feature
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-30 23:24:48 +02:00
df47130823
README: add lib descriptions
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-23 23:19:37 +02:00
36d77bcae4
Add README
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-22 00:06:50 +02:00
47ab4446d1
parsers: remove unused imports
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-22 00:02:54 +02:00
d4bbeb2c6c minidom: Add todo in Prefixes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
33ee71bcb4 tokio-xmpp: update for minidom changes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
eca44f5602 jid: update for minidom changes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
fd158d9a08 parsers: rustfmt
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
fa8b9ed199 minidom: rustfmt
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
3d71e37e0c minidom: Ensure there is no colon in name when creating element
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
937e2380b9 minidom: Make ElementBuilder::prefix fail on adding duplicate prefix
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
770dff7cb0 minidom: Don't borrow prefix in Prefixes.get
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
1f2d7aa99d minidom: Rework Prefixes internal structure
Change the mapping in Prefixes to Prefix -> Namespace instead of
Namespace -> Prefix. This allows us to not have duplicate prefixes
anymore, but requires us to store the prefix on Element. This prefix is
only taken as a hint anyway and used only when coming from the reader.

This commits also partially removes the possibility to add prefixes
when creating an Element via `Element::new`, `Element::builder` or
`Element::bare`. Proper errors should be added in the following commits.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
429949102d minidom: remove unused Rc
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
6308250c17 parsers: update for minidom API changes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
40b92d64e2 minidom: clarify meaning of Element.name (being the local name)
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
171e7f1f34 minidom: ensure prefix is extracted out of provided name when creating Element
I would have liked to handle all of this in `Element::new` only, but I
also have to do it in `Element::builder` unfortunately because then
element builder then pushes prefixes it gathered itself.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
f151306fbe minidom: forcing a namespace on Element. Stop requiring prefixes.
Below is what I think I did.

A few changes:
- Change prefixes to be something less important in the API.
- Rework the Element struct to force a namespace. In XMPP everything is
  namespaced.
- Remove parent ref on what was previously NamespaceSet and is now
  Prefixes.

More specifically this means `Element::new` has changed to require
`Element`'s new new properties as parameters. `Element::builder` and
`Element::bare` now require a namespace unconditionally.
`Element::prefix` has been removed.

This new API is based on the fact that prefixes are non-essential
(really just an implementation detail) and shouldn't be visible to the
user. It is possible nonetheless to set custom prefixes for
compatibility reasons with `ElementBuilder::prefix`. **A prefix is
firstly mapped to a namespace, and then attached to an element**, there
cannot be a prefix without a namespace.

Prefix inheritance is used if possible but for the case with no
prefix ("xmlns") to be reused, we only check custom prefixes declared on
the tag itself and not ascendants. If it's already used then we generate
prefixes (ns0, ns1, ..) checking on what has been declared on all
ascendants (plus of course those already set on the current tag).

Example API:

```rust
let mut elem = ElementBuilder("stream", "http://etherx.jabber.org/streams")
  .prefix(Some(String::from("stream")), "http://etherx.jabber.org/streams)
  .prefix(None, "jabber:client")
  .attr(..)
  .build();

assert_eq!(elem.ns(), String::from("http://etherx.jabber.org/streams"));
```

See also the few tests added in src/tests.

TODO: Fix inconsistencies wrt. "prefix:name" format provided as a name
when creating an Element with `Element::new` or `Element::bare`.
`Element::builder` already handles this as it should, splitting name and
prefix.
TODO: Change `Element::name` method to `Element::local_name` to make it
more explicit.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-21 22:23:36 +02:00
0b680a18e5
parsers: Fix jingle and jingle_rtp test_size for 32bit
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-05 19:05:12 +02:00
080c7b8c95 CI: Remove build stage
`cargo test` rebuilds all of it anyway.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-05 15:05:16 +02:00
5eeac93f67 CI: rename jobs to make it easier to read in gitlab
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-04-05 15:05:16 +02:00
20b224855c minidom: Remove NSChoice::None
Although it is still possible to create such elements, this is not a a
case that should happen in XMPP. Changing to API to prevent the creation
of these elements is next on the list.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-27 18:32:57 +00:00
Emmanuel Gil Peyrot
9737194b5e xmpp-parsers: Add MIX to the supported XEPs. 2020-03-27 19:19:43 +01:00
Emmanuel Gil Peyrot
048e49f786 xmpp-parsers: Add a MIX serialisation test. 2020-03-27 19:19:43 +01:00
Emmanuel Gil Peyrot
820fbbf08e xmpp-parsers: Add helper constructors for MIX. 2020-03-27 19:19:43 +01:00
Emmanuel Gil Peyrot
ad4c1f5b15 xmpp-parsers: Add a MIX parser. 2020-03-27 19:19:07 +01:00
5e7701f334
minidom: Remove remaining Comment bits in node
They were hidden behind the flag and not showing up in tests.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-26 23:21:50 +01:00
015d0007fc
minidom: Remove comments support. Forbid them as per XMPP RFC.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-26 20:50:30 +01:00
Emmanuel Gil Peyrot
c154593fe5 Bump dependencies 2020-03-26 18:28:50 +01:00
f41b6bfd32
Use stable rustfmt
And install it as the container doesn't have it. Fortunately it's rather
quick (few seconds).

The previous nightly container apparently dropped rustfmt, which is
understandable as not all tools are available all the time. That's on
us.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-26 18:09:59 +01:00
476813a10a
CI: Allow nightly to fail
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-26 18:04:21 +01:00
Astro
a4325c787a tokio-xmpp: doc 2020-03-16 00:34:46 +01:00
Astro
b6828b9674 tokio-xmpp: remove obsolete TODOs 2020-03-16 00:11:52 +01:00
4ae9ab41ab
xmpp-rs: add env_logger in example
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-03-13 23:25:06 +01:00
Astro
7f25b4ef56 tokio-xmpp: update for futures-0.3 (100% API breakage) 2020-03-08 20:39:35 +01:00
Astro
23cb34e026 tokio-xmpp: rewrite for futures-0.3 2020-03-06 18:01:31 +01:00
Astro
bded964c38 tokio-xmpp: update dependency xml5ever 2020-03-01 00:40:45 +01:00
Emmanuel Gil Peyrot
04df9fde63 xmpp-parsers: Bump base64 to 0.11. 2020-02-28 01:28:57 +01:00
Emmanuel Gil Peyrot
944c4a0815 minidom: quick-xml::Error now implements Error without failure, so use it
Thanks pep.!
2020-02-28 01:28:54 +01:00
280ce6c458
Readd global LICENSE file
Remove in 9c1654f59b by mistake.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-02-25 22:13:34 +01:00
89d92ced73 parsers: 0.17.0 release
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-02-15 02:27:26 +01:00
c5a813f6c5 jid: 0.9.0 release
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-02-15 02:27:26 +01:00
18d66edfe0 jid: Update Changelog
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-02-15 02:27:26 +01:00
043a0f257b
parsers: Update Changelog
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-02-15 01:50:09 +01:00