2efef5c
xso-proc: add support for string literals for namespaces
Click to expand commit body
Makes it easier to use ad-hoc.
Jonas Schäfer created
2efef5c
xso-proc: add support for string literals for namespaces
Makes it easier to use ad-hoc.
Jonas Schäfer created
4d1166b
xso-proc: allow paths as XML names
Not sure if this is something useful to have, but it feels consistent with `namespace`.
Jonas Schäfer created
1611c5f
xso-proc: validate XML names against rxml_validation::NcName
That way we avoid a fallible conversion at runtime.
Jonas Schäfer created
bc785fd
parsers: replace generate_empty_element with derive
Jonas Schäfer created
0adfd12
xso-proc: start making derive macros for FromXml and IntoXml
For now, these macros only support empty elements. Everything else will be rejected with a compile-time error.
Jonas Schäfer created
9ec9a0f
xso: introduce xso::from_bytes
This is useful both for doctests and other scenarios where you just want to parse a bit of XML you already have.
Jonas Schäfer created
6ef8dbe
parsers: use Error type from xso
This is a large change and as such, it needs good motivation. Let me remind you of the ultimate goal: we want a derive macro which allows us to FromXml/IntoXml, and that derive macro should be usable from `xmpp_parsers` and other crates. For that, any code generated by the derive macro mustn't depend on any code in the `xmpp_parsers` crate, because you cannot name the crate you are in portably (`xmpp_parsers::..` wouldn't resolve within `xmpp_parsers`, and `crate::..` would point at other crates if the macro was used in other crates). We also want to interoperate with code already implementing `TryFrom<Element>` and `Into<Element>` on structs. This ultimately requires that we have an error type which is shared by the two implementations and that error type must be declared in the `xso` crate to be usable by the macros. Thus, we port the error type over to use the type declared in `xso`. This changes the structure of the error type greatly; I do not think that `xso` should have to know about all the different types we are parsing there and they don't deserve special treatment. Wrapping them in a `Box<dyn ..>` seems more appropriate.
Jonas Schäfer created
b3e6e08
CI: display rustfmt version
Signed-off-by: Maxime âpepâ Buquet <pep@bouah.net>
Maxime âpepâ Buquet created
a39a233
Revert "tokio-xmpp: rustfmt pass in examples"
This reverts commit 46fdd9cdfa86ff9362af51fc01db483ac36a46ac.
Maxime âpepâ Buquet created
46fdd9c
tokio-xmpp: rustfmt pass in examples
Signed-off-by: Maxime âpepâ Buquet <pep@bouah.net>
Maxime âpepâ Buquet created
2af07f4
xmpp-parsers: Simplify DataForm creation using constructors
The redundancy made it harder to review changes to the Field struct, for instance in a1bee56ee11d29ff3e9b6276391506a9413f07a5.
Emmanuel Gil Peyrot created
3d52905
fix check for childen and attributes in desc element
mb created
49adbc4
xso: make newlines after module comments consistent with other crates
Jonas Schäfer created
dd76a62
xso: only warn on missing docs
The CI makes that an error anyway, and this allows developers to start sketching stuff without running into errors all the time (and then adding `/// TODO` to work around them).
Jonas Schäfer created
6d642ba
xso: pull fmt from core
We don't mark this crate as no_std for now, because its dependencies aren't no_std, but we want to be prepared.
Jonas Schäfer created
17a38f1
xso: mark iterator type as non-breaking to change
Just like with the builder type, the concrete iterator type on IntoXml is supposed to be an implementation detail. That allows switching freely between various ways to generate such a type.
Jonas Schäfer created
a1bee56
Support desc element in field
From [XEP-0004: Data Forms](https://xmpp.org/extensions/xep-0004.html#protocol-field): > ... > The <field/> element MAY contain any of the following child elements: > > <desc/> > The XML character data of this element provides a natural-language > description of the field, intended for presentation in a > user-agent (e.g., as a "tool-tip", help button, or explanatory text > provided near the field). The <desc/> element SHOULD NOT contain > newlines (the \n and \r characters), since layout is the > responsibility of a user agent, and any handling of > newlines (e.g., presentation in a user interface) is unspecified > herein. (Note: To provide a description of a field, it > is RECOMMENDED to use a <desc/> element rather than > a separate <field/> element of type "fixed".) > ...
mb created
cb3da52
parsers: add streamable parsing
This adds shims which provide FromXml and IntoXml implementations to *all* macro-generated types in `xmpp_parsers`. Mind that this does not cover all types in `xmpp_parsers`, but a good share of them. This is another first step toward real, fully streamed parsing.
Jonas Schäfer created
14a1d66
xso: create library for streamed XML parsing
This library provides the traits to parse structs from XML and serialise them into XML without having to buffer the document object model in memory. The only implementations it provides are for minidom, basically providing a lower-level interface to `minidom::Element::from_reader` and `minidom::Element::to_writer`. This is the first stepping stone into a world where `xmpp_parsers` can parse the structs directly from XML.
Jonas Schäfer created
998d282
Add alternate_address to StanzaError
[gone](https://datatracker.ietf.org/doc/html/rfc6120#section-8.3.3.5) and [redirect](https://datatracker.ietf.org/doc/html/rfc6120#section-8.3.3.14) errors may include an alternative address. > gone > > The recipient or server can no longer be contacted at this address, > typically on a permanent basis (as opposed to the <redirect/> error > condition, which is used for temporary addressing failures); the > associated error type SHOULD be "cancel" and the error stanza SHOULD > include a new address (if available) as the XML character data of the > <gone/> element (which MUST be a Uniform Resource Identifier [URI] or > Internationalized Resource Identifier [IRI] at which the entity can > be contacted, typically an XMPP IRI as specified in [XMPP-URI]). â > redirect > > The recipient or server is redirecting requests for this information > to another entity, typically in a temporary fashion (as opposed to > the <gone/> error condition, which is used for permanent addressing > failures); the associated error type SHOULD be "modify" and the error > stanza SHOULD contain the alternate address in the XML character data > of the <redirect/> element (which MUST be a URI or IRI with which the > sender can communicate, typically an XMPP IRI as specified in > [XMPP-URI](https://datatracker.ietf.org/doc/html/rfc6120#ref-XMPP-URI)).
mb created
ac0707e
Make âvarâ attribute of a Field optional
Looking at [the spec](https://xmpp.org/extensions/xep-0004.html#protocol-field) it seems valid not to have a `var` attribute set, at least for fields of type `fixed` that is: > If the element type is anything other than "fixed" (see below), it MUST > possess a 'var' attribute that uniquely identifies the field in the context > of the form (if it is "fixed", it MAY possess a 'var' attribute). The element > MAY possess a 'label' attribute that defines a human-readable name for the field.
mb created
079379a
Fix build with nightly rust
Nightly rust complains about `cfg(..)` tests against undeclared features and other unknown cfgs. They need to be explicitly declared now. The nightly/stable features don't exist, so I removed them and substitutes the currently correct number for the single test where they were used. The `xmpprs_doc_build` cfg flag is now declared as expectable.
Jonas Schäfer created
44029c9
Derive PartialEq for PubSub elements
mb created
80efd2e
Ignore missing disco#info feature in disco#info responses
xmpp-rs normally has the stance to get buggy implementations fixed rather than dropping checks. In this particular case I think this is not a good use of resources: - The disco#info feature var conveys no actual information: If an implementation replies properly to a disco#info query, it is already implied that it supports the protocol. - There are broken server implementations out there. A lot of them (all recent (>= 0.10 && < 0.13 AFAICT) Prosody IM instances). At this point in time, xmpp-rs is unable to query disco#info from MUCs hosted on such prosody versions, except by workarounds (such as the one removed in this diff). - XEP-0030 now features a note which reads: > Note: Some entities are known not to advertise the > `http://jabber.org/protocol/disco#info` feature within their > responses, contrary to this specification. Entities receiving > otherwise valid responses which do not include this feature SHOULD > infer the support. The case would be different if there were no (deployed) implementations which had this bug or if the bug actually had an effect on clients. Especially the latter is not the case though, as pointed out above. Hence, I conclude that this check is overly pedantic and the resources (time, emotional energy of dealing with bugs, punching patches through to stable distributions, etc. etc.) spent on getting this fixed would be better invested elsewhere. In addition, the workaround is extremely ugly and, even in the xmpp-rs implementation, has no test coverage. Without test coverage of such an implementation, it is bound to break in funny ways when xmpp-rs changes the strings of its error messages (which is something one might do even outside a breaking release).
Jonas Schäfer created
eb0bc1b
Changed name to XmppCodec
Parker created
56dc1c6
Added `XmppCodec` usage example
Parker created
6d449e9
Make XmppCodec public
Parker created
84de007
Update rxml to 0.11.0
Jonas Schäfer created
2097b96
Update rxml to 0.10.1
rxml 0.10.0 (and earlier) had a bug which caused it to reject valid XML documents if an UTF-8 sequence straddled the token size boundary (8192 bytes by default) of a text event.
Jonas Schäfer created
aabd19f
State is disconnected, not invalid
xmppftw created
0349767
Add serde feature for xmpp crate
xmppftw created
aee4c79
Add syntax-hightlighting feature for xmpp crate
xmppftw created
cde6450
OpenSSL is optional
xmppftw created
9b2663a
Add more specific `into_*` conversion functions to specific JID subtypes
This is necessary because `into_inner()` as implemented on Jid consumes the value. That means it cannot be called through Deref (because that only takes a reference).
Jonas Schäfer created
002c280
Fix typos across the codebase (thanks codespell!)
Emmanuel Gil Peyrot created
ccd4604
Add OOB
Paul Fariello created
8bdd19b
Add SCRAM client extensions support
The SCRAM RFC describes extensions that can be used to add extra data into the protocol. This commit adds support for the client scram mechanism to insert extension data into the client messages at the locations specified by the SCRAM RFC. Kafka utilizes these extensions when authenticating delegation tokens over scram. Since I am writing a kafka client I would like access to these extensions so I can support delegation tokens. I've only added them to Scram::new not Mechanism::from_credentials since they do not apply to other mechanisms. For my purposes this is fine since I only need to work with scram. However it would be limiting for other use cases, so I'm quite happy to add the extension fields into Credentials if that was desired. For now I've left it out since the fields would be scram exclusive and everything else in Credentials is currently generic.
Lucas Kent created
4853776
data_forms: ignore incorrect `FORM_TYPE` fields as per XEP-0068
XEP-0068 is rather explicit that `FORM_TYPE` fields which are not `type='hidden'` MUST be ignored (in most cases, see comments inside the code for exceptions). The previous implementation returned an error instead (and aborted parsing with that), which is obviously not "ignoring".
Jonas Schäfer created
675907b
pubsub: provide accessor function for event's source node's name
Handy if you want to prefilter or distribute events based on the source node's name.
Jonas Schäfer created
1449d30
Fix clippy lints for sasl crate
Lucas Kent created
f4c3238
Swap sasl crate from sha-1 crate -> sha1 crate
sha-1 has been deprecated in favor of sha1 and has an identical API.
Lucas Kent created
384b366
Add Message::extract_payload function
This should simplify access to message payloads significantly.
Jonas Schäfer created
a291ab2
Remove an allocation in client::mechanisms::scram::Scram::initial
Lucas Kent created
f725994
Bump all dependencies but rustls and webpki-roots
The latter have changed their API a bit, while everything else is still compatible.
Emmanuel Gil Peyrot created
48f77ac
jid: Make the crate no_std
Only std::error::Error is missing in this mode, but thatâs only waiting for its stabilisation, see this issue: https://github.com/rust-lang/rust/issues/103765
Emmanuel Gil Peyrot created
fcadccf
parsers::vcard: allow linebreaks in binval data
[RFC 2426][1] says: > The binary data MUST be encoded using the "B" encoding format. > Long lines of encoded binary data SHOULD BE folded to 75 characters > using the folding method defined in [MIME-DIR]. That implies that whitespace may occur in binval data and we thus must be able to parse this correctly. [1]: https://datatracker.ietf.org/doc/html/rfc2426#section-2.4.1
Jonas Schäfer created
6c3081d
tokio-xmpp: let happy_eyeballs connect to records in parallel
Astro created
598ffdb
tokio-xmpp: set resolve ip_strategy to Ipv4AndIpv6
The happy_eyeballs implementation should try to connect on both address families. The default of Ipv4thenIpv6 wouldn't query for AAAA if it got A.
Astro created
37481fb
parsers: do not do extensive XEP-0030 validation with disable-validation
Other additional checks are already gated by the absence of this feature. As the MR to remove these checks altogether is still blocked, this should serve as at least as an intermediate solution to anyone affected by buggy remote implementations.
Jonas Schäfer created
0298caf
tokio-xmpp: allow docs build with --all-features
This affects only the docs and is quite an ugly hack, but seems to be the only way for now.
Jonas Schäfer created