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

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);

Reviewed-on: jabber.developer2/stabber#1
Co-authored-by: jabber.developer2 <jabber.developer2@jabber.space>
Co-committed-by: jabber.developer2 <jabber.developer2@jabber.space>
This commit is contained in:
2025-12-15 08:45:38 +00:00
committed by jabber.developer2
parent 3e5c220071
commit 00f47a1598
11 changed files with 207 additions and 24 deletions

View File

@@ -100,6 +100,8 @@ verify_last(char *stanza_text)
log_println(STBBR_LOGINFO, "VERIFY LAST SUCCESS: %s", stanza_text);
} else {
log_println(STBBR_LOGINFO, "VERIFY LAST FAIL: %s", stanza_text);
// Debug: show what was actually received
stanzas_debug_last();
}
return result;