fix: Fix XMPP stream parsing and add stbbr_for_presence_to helper #1

Merged
jabber.developer2 merged 4 commits from fix/xmpp-parsing into master 2025-12-15 08:45:39 +00:00
Collaborator

This PR fixes critical issues with XMPP stream parsing and adds a new helper function for MUC testing.

Changes

1. Fix XMPP stream parsing for multiple stanzas

The XML parser was not correctly handling multiple consecutive stanzas in the stream. Fixed depth tracking to properly detect stanza boundaries.

2. Fix XMPP stream parsing depth tracking

Added proper depth tracking for nested XML elements to correctly identify when a complete stanza has been received.

3. Remove debug logging that interfered with expect tests

Removed verbose debug output that was causing expect-based functional tests to fail due to unexpected output in the stream.

4. Add stbbr_for_presence_to for MUC join presence matching

New helper function that registers a canned response for presence stanzas based on the to attribute. This is essential for testing MUC (Multi-User Chat) join flows where the response must be triggered by presence to a specific room JID.

API:

void stbbr_for_presence_to(const char *to, const char *response);
This PR fixes critical issues with XMPP stream parsing and adds a new helper function for MUC testing. ## Changes ### 1. Fix XMPP stream parsing for multiple stanzas The XML parser was not correctly handling multiple consecutive stanzas in the stream. Fixed depth tracking to properly detect stanza boundaries. ### 2. Fix XMPP stream parsing depth tracking Added proper depth tracking for nested XML elements to correctly identify when a complete stanza has been received. ### 3. Remove debug logging that interfered with expect tests Removed verbose debug output that was causing expect-based functional tests to fail due to unexpected output in the stream. ### 4. Add `stbbr_for_presence_to` for MUC join presence matching New helper function that registers a canned response for presence stanzas based on the `to` attribute. This is essential for testing MUC (Multi-User Chat) join flows where the response must be triggered by presence to a specific room JID. **API:** ```c void stbbr_for_presence_to(const char *to, const char *response);
jabber.developer2 added 4 commits 2025-12-08 14:52:06 +00:00
- Add special handling for <stream:stream> (unclosed root element)
- Feed virtual <wrapper> element to allow multiple root stanzas
- Support non-<query/> IQ payloads like <ping/> (XEP-0199)
- Relax stanza matching: allow extra attrs/children in received
- Add legacy auth feature in stream:features
- Use larger read buffer (1024 bytes) for efficiency
- Clear curr_string buffer after each stanza
- Reset depth counter in parser_init() to fix stanza parsing between connections
- Properly track depth for virtual wrapper element
- Add debug logging in stanzas_verify_any() to trace stanza matching
- Add prime_for_presence_to() and prime_get_for_presence_to() in prime.c
- Add presence_to_callback() in server.c to handle MUC join presence
- Export stbbr_for_presence_to() in stabber.h
- Add stanzas_debug_last() for debugging failed verifications
jabber.developer2 changed title from }gk}wjJeuMF3*)t to fix: Fix XMPP stream parsing and add stbbr_for_presence_to helper 2025-12-08 14:52:25 +00:00
jabber.developer2 merged commit 00f47a1598 into master 2025-12-15 08:45:39 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devs/stabber#1
No description provided.