From a7c7768778f005aec8b11512743924d5270b3e07 Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 15 Aug 2012 23:52:54 +0100 Subject: [PATCH] Simple incoming typing notification --- src/jabber.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/jabber.c b/src/jabber.c index 966c6b3b..1d8a3dde 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -256,8 +256,20 @@ _jabber_message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, "body"); - if(body == NULL) + + // if no message, check for chatstates + if (body == NULL) { + if (xmpp_stanza_get_child_by_name(stanza, "active") != NULL) { + // active + } else if (xmpp_stanza_get_child_by_name(stanza, "composing") != NULL) { + // composing + char *from = xmpp_stanza_get_attribute(stanza, "from"); + cons_show(from); + cons_show("is composing a message"); + } + return 1; + } char *type = xmpp_stanza_get_attribute(stanza, "type"); if(strcmp(type, "error") == 0)