diff options
author | James Booth <boothj5@gmail.com> | 2012-11-10 00:43:09 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-11-10 00:43:09 +0000 |
commit | 7512d70ff519434215b7e8d40c7aa8d678e5c1a7 (patch) | |
tree | a2a11b4faf93479df5097e1d37c4d4bd131a5cf0 /src/stanza.c | |
parent | 0da40a34d5da95008578133980bcbc005b74346e (diff) | |
download | profani-tty-7512d70ff519434215b7e8d40c7aa8d678e5c1a7.tar.gz |
Moved ping iq creation to stanza
Diffstat (limited to 'src/stanza.c')
-rw-r--r-- | src/stanza.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/stanza.c b/src/stanza.c index eb4bbc67..5644d0ff 100644 --- a/src/stanza.c +++ b/src/stanza.c @@ -168,3 +168,32 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx) return iq; } + +gboolean +stanza_contains_chat_state(xmpp_stanza_t *stanza) +{ + return ((xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ACTIVE) != NULL) || + (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_COMPOSING) != NULL) || + (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_PAUSED) != NULL) || + (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_GONE) != NULL) || + (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL)); +} + +xmpp_stanza_t * +stanza_create_ping_iq(xmpp_ctx_t *ctx) +{ + xmpp_stanza_t *iq = xmpp_stanza_new(ctx); + xmpp_stanza_set_name(iq, STANZA_NAME_IQ); + xmpp_stanza_set_type(iq, STANZA_TYPE_GET); + xmpp_stanza_set_id(iq, "c2s1"); + + xmpp_stanza_t *ping = xmpp_stanza_new(ctx); + xmpp_stanza_set_name(ping, STANZA_NAME_PING); + + xmpp_stanza_set_ns(ping, STANZA_NS_PING); + + xmpp_stanza_add_child(iq, ping); + xmpp_stanza_release(ping); + + return iq; +} |