From cecd6b20e8d1df5330e3dfb94afea33eb7c033fd Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Tue, 7 Jan 2020 22:13:39 +0200 Subject: [PATCH] stanza: add xmpp_stanza_get_context() This function is backported from UnrealEngine project. --- ChangeLog | 1 + src/stanza.c | 13 +++++++++++++ strophe.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 20275ae..e3f02f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ - xmpp_conn_is_connecting() - xmpp_conn_is_connected() - xmpp_conn_is_disconnected() + - xmpp_stanza_get_context() 0.9.3 - PLAIN mechanism is used only when no other mechanisms are supported diff --git a/src/stanza.c b/src/stanza.c index d7f8696..6a025d3 100644 --- a/src/stanza.c +++ b/src/stanza.c @@ -188,6 +188,19 @@ int xmpp_stanza_release(xmpp_stanza_t * const stanza) return released; } +/** Get the strophe context that the stanza is associated with. + * + * @param stanza a Strophe stanza object + * + * @return a Strophe context + * + * @ingroup Stanza + */ +xmpp_ctx_t *xmpp_stanza_get_context(const xmpp_stanza_t * const stanza) +{ + return stanza->ctx; +} + /** Determine if a stanza is a text node. * * @param stanza a Strophe stanza object diff --git a/strophe.h b/strophe.h index 17b8dd5..2aa8ed6 100644 --- a/strophe.h +++ b/strophe.h @@ -326,6 +326,8 @@ xmpp_stanza_t *xmpp_stanza_copy(const xmpp_stanza_t * const stanza); /* free a stanza object and it's contents */ int xmpp_stanza_release(xmpp_stanza_t * const stanza); +xmpp_ctx_t *xmpp_stanza_get_context(const xmpp_stanza_t * const stanza); + int xmpp_stanza_is_text(xmpp_stanza_t * const stanza); int xmpp_stanza_is_tag(xmpp_stanza_t * const stanza);