diff options
author | James Booth <boothj5@gmail.com> | 2012-11-05 22:21:03 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-11-05 22:21:03 +0000 |
commit | ad8845991cd6dcc2ec912fc991b3791242c55f1f (patch) | |
tree | 80015671d8560e5c469ea24d8e53da0432e5d90e /src/jabber.c | |
parent | 83834b96ae455f295136c44cf86b6e2f066b0d74 (diff) | |
download | profani-tty-ad8845991cd6dcc2ec912fc991b3791242c55f1f.tar.gz |
Handle chat history from groupchat
Diffstat (limited to 'src/jabber.c')
-rw-r--r-- | src/jabber.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/jabber.c b/src/jabber.c index d700255b..648df07b 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -401,8 +401,25 @@ _message_handler(xmpp_conn_t * const conn, from = xmpp_stanza_get_attribute(stanza, "from"); if (room_jid_is_room_chat(from)) { - - + xmpp_stanza_t *delay = xmpp_stanza_get_child_by_name(stanza, "delay"); + if (delay != NULL) { + char *utc_stamp = xmpp_stanza_get_attribute(delay, "stamp"); + GTimeVal tv_stamp; + if(g_time_val_from_iso8601(utc_stamp, &tv_stamp)) { + xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, "body"); + if (body != NULL) { + char *message = xmpp_stanza_get_text(body); + char **tokens = g_strsplit(from, "/", 0); + char *room_jid = tokens[0]; + char *nick = tokens[1]; + win_show_room_history(room_jid, nick, tv_stamp, message); + } + } else { + log_error("Couldn't parse datetime string receiving room history: %s", utc_stamp); + } + } else { + // handle normal groupchat messages + } cons_show("CHAT ROOM MESSAGE RECIEVED"); } else { |