This provides a non-copying API, which is generally favourable. The
other accessors were removed, because the intent was to provide this
"most sensible" API via the "default" (i.e. shortest, most concisely
named) functions.
If the user enables the tls-rust feature and forgets to disable
default-features (which includes tls-native), tell them and bail out.
The code was made to work anyway when both are enabled, and here it
defaults to tls-native. It does seem better to have one explicitely
choose one though hence the compile_error! message.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This needs to be a loop in order to ignore packets we don’t care about,
or those we want to handle elsewhere. Returning something isn’t correct
in those two cases because it would signal to tokio that the XMPPStream
is also done, while there could be additional packets waiting for us.
The proper solution is thus a loop which we exit once we have something
to return.
Fixes a deadlock when we ignore some packets.
The previous commit didn't fix a bug where @id would be added to
elements that didn't need it / where it was invalid (e.g., stream
management).
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit moves the code adding @id to AsyncClient and SimpleClient,
instead of on the lower level send_stanza helper, which seemed to only
be used internally.
Support is also added for Component.
This removes the addition of @id on elements like <auth/> or <bind/>,
which probably weren't required anyway?
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This bug was introduced by 2e97f4de2e, to
fix another bug where the parser would choke on whitespace.
The bug would manifest whenever a stanza was sent in different parts,
for example:
<< "<message "
<< "type='chat><body>foo</body></message>"
Would produce the following once parsed:
`<messagetype='chat'><body>foo</body></messagetype='chat'>`
This commit ensures this doesn't happen anymore (by not trimming
whitespaces before feeding the parser), and also ensures that
whitespaces are now handled at the correct layer.
The removal of xmpp_codec::test_lone_whitespace only happens because I'm
not sure if it's supposed to be here anymore. Maybe it should be at a
different layer? Or written differently?
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>