Commit graph

62 commits

Author SHA1 Message Date
2a2d8cd051
Split Occupant and Session into their own module
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-12-08 12:05:28 +01:00
1463a55d3f
TestComponent: Make order of stanza unimportant across different resources
Split expected stanza by resource thus rendering order of stanza across
different resource unimportant.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-12-05 21:00:15 +01:00
2b6a151f7e
room: Remove derived Eq on Session
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-11-30 17:26:54 +01:00
1ada7f8bf4
tests/presence: todo!(): test_presence_update_not_joined, test_presence_leave_msn
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-10-16 21:39:57 +02:00
a2cc7857b7
room: test_occupant_update_presence
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-10-16 19:38:49 +02:00
fc880c7423
Occupant now takes a presence; new Session struct
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-10-16 15:08:23 +02:00
43d2697aaa
error: Add Error::Jid(Box<JidParseError>)
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-10-16 10:57:24 +02:00
4d00060817
TestComponent: Display assert errors as Display not Debug for easier xml coloring
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-10-15 19:05:12 +02:00
dc9a56857c
room/Occupant: Add docstrings
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-30 18:39:00 +02:00
d94d472b9d
error: add docstrings
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-30 17:10:52 +02:00
bcc2f7d85e room/broadcast_presence: move matches! blocks together
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-28 18:10:34 +02:00
d7c4bcd87b Broadcast presence updates
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-28 18:10:34 +02:00
222e5a1793 tests: add templates and use in tests
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-28 18:09:28 +02:00
cc1c1609e3 component: Split into submodules test/xmpp
This way I don't have to guard everything with #[cfg(test)]..

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-26 17:32:28 +02:00
1f7112616a
component: Update copyright header
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 23:11:41 +02:00
be5f5fb4e5
README: Add TODO: nick changes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:25:39 +02:00
12d23e2283 room: clippy
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:03:29 +02:00
3b59bd1312 main: Remove unused import
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:03:29 +02:00
4fff51e9a1 error: clippy; gain 128 bytes on Error
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:03:29 +02:00
55f0759d70 handlers: clippy
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:03:29 +02:00
836bfcd7dd
TestComponent: Use is_empty instead of .len == 0
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-25 16:03:20 +02:00
0252aece38
component: guard with #[cfg(test)] what's only used in tests
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 17:22:19 +02:00
b2da2495a1
CI: Add required musl-dev
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 13:51:40 +02:00
be1930c584
tests/iq: test_self_ping_answer
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 02:13:30 +02:00
da12752d50
Cargo.toml: Remove custom paths for xmpp-rs deps
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 01:57:14 +02:00
8322f5e11f cargo fmt
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 01:46:32 +02:00
1f4e6f6451 Partial XEP-0410 support
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 01:46:32 +02:00
eba5ea9773 TestComponent: rename _send_stanza method
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 01:46:32 +02:00
c438402b15 TestComponent: assert closer to callsite
Attempts to assert closer to callsite to make it easier to debug. This
requires that we also pay attention to remaining items in the
expect_buffer. This check is done on Drop.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 01:46:32 +02:00
b61766d462 CI: initial tests
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 00:50:54 +02:00
f64b809342 tests: Split into submodules
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 00:50:54 +02:00
a2de3de6d0
room: split test_broadcast_presence
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-24 00:50:50 +02:00
74214352bd
Room::broadcast_presence: change parameters again
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 23:02:44 +02:00
1b5e80529b Expect: add description alongside callback
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 22:53:39 +02:00
ee4ea6dd9a Room: simplify add_session; abstract away send_subject
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 22:53:38 +02:00
506e288b90 Add test_presence_resync
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 22:47:33 +02:00
3b49a5ae40
Add broadcast_presence method
Also add bits of the next commit because there are too many changes now
and I failed to properly dissociate with add -p :(

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 22:46:22 +02:00
4383b7de88 component: add TestElement to have a custom Debug for Element
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 18:46:48 +02:00
f2c8e74ef4
Return SessionAlreadyExists error in Occupant::add_session
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-23 18:46:42 +02:00
307a888a0b
DateTime::from_utc isn't being merged in parsers
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-17 16:31:12 +02:00
3935d68d7e
error/MismatchJids: take both jids
So it's possible to see directly which jids are conflicting

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-17 16:23:53 +02:00
92ca50abc7
Add README.md and LICENSE
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 23:06:15 +02:00
2f35111210
Broadcast new occupant presence to existing occupants
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 00:53:29 +02:00
769939be0a handlers: cargo fmt
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 00:52:33 +02:00
43c31ed1c3 TestComponent: Split expect_with into _iq, _message, _presence
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 00:52:33 +02:00
d383aa8655 We can now leave rooms!
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 00:48:04 +02:00
b7ee30c3f7
Add test for joining an existing room
- Send affiliation/role in occupant presence. Always the same for now.
- Send one presence per occupant (might changer again later on)
- Store subject in Room. Store participant/date alongside subject

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-12 00:22:36 +02:00
d1d7aea45b
tests: remove _0045 in fn name
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-11 13:11:14 +02:00
29b952a726
tests: ensure occupants count is correct
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-11 13:10:09 +02:00
afd1f23ac3
Add test_0045_join_presence_nick_already_assigned
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2022-09-11 13:10:01 +02:00