_handle_groupchat(): get correct origin-id stanza
The problem is that in _handle_groupchat() we look for STANZA_NS_STABLE_ID which will result in origin-id or stanza-id. It seems like prosody servers send origin-id first, so this worked in all my tests. But actually we cannot be sure of the order. So far we stopped after the first element was found. I only found xmpp_stanza_get_child_by_ns() and xmpp_stanza_get_child_by_name() in libstrophe. But we need a combination of both. So I created stanza_get_child_by_name_and_ns() for Profanity. I need to remember to upstream this to libstrophe later (if they really don't have such a function). Fix https://github.com/profanity-im/profanity/issues/1223
This commit is contained in:
@@ -755,8 +755,8 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
|
||||
const char *id = xmpp_stanza_get_id(stanza);
|
||||
char *originid = NULL;
|
||||
|
||||
xmpp_stanza_t *origin = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_STABLE_ID);
|
||||
if (origin && g_strcmp0(xmpp_stanza_get_name(origin), STANZA_NAME_ORIGIN_ID) == 0) {
|
||||
xmpp_stanza_t *origin = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID);
|
||||
if (origin) {
|
||||
originid = (char*)xmpp_stanza_get_attribute(origin, STANZA_ATTR_ID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user