about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-08-15 23:52:54 +0100
committerJames Booth <boothj5@gmail.com>2012-08-15 23:52:54 +0100
commita7c7768778f005aec8b11512743924d5270b3e07 (patch)
treed48a804692cbd698694307a04085756d4093d921 /src
parentfa38ec40194856756a3f3e55300f40d7ea4239d4 (diff)
downloadprofani-tty-a7c7768778f005aec8b11512743924d5270b3e07.tar.gz
Simple incoming typing notification
Diffstat (limited to 'src')
-rw-r--r--src/jabber.c14
1 files changed, 13 insertions, 1 deletions
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)