diff options
author | James Booth <boothj5@gmail.com> | 2015-01-07 00:17:54 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-01-07 00:17:54 +0000 |
commit | 8bbf126e83205f942ec2bfdc1a9597c82a2c811d (patch) | |
tree | 70c17dd4100db3d3ca3bb3953b0273d5acd6a9c8 /src | |
parent | 95ad5643725d1cc857454d47460091ca18cbb807 (diff) | |
download | profani-tty-8bbf126e83205f942ec2bfdc1a9597c82a2c811d.tar.gz |
Refactored chat sessions in _chat_handler
Diffstat (limited to 'src')
-rw-r--r-- | src/xmpp/message.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c index e436dbc1..b104bdb3 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -465,23 +465,19 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, // standard chat message, use jid without resource } else { - // determine chatstate support of recipient - gboolean recipient_supports = FALSE; - if (stanza_contains_chat_state(stanza)) { - recipient_supports = TRUE; - } - - // create or update chat session - if (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ACTIVE) != NULL) { - chat_session_on_incoming_message(jid->barejid, jid->resourcepart, recipient_supports); - } - // determine if the notifications happened whilst offline GTimeVal tv_stamp; gboolean delayed = stanza_get_delay(stanza, &tv_stamp); // deal with chat states if recipient supports them - if (recipient_supports && (!delayed)) { + if (!delayed) { + // determine chatstate support of recipient + if (stanza_contains_chat_state(stanza)) { + chat_session_on_incoming_message(jid->barejid, jid->resourcepart, TRUE); + } else { + chat_session_on_incoming_message(jid->barejid, jid->resourcepart, FALSE); + } + if (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_COMPOSING) != NULL) { handle_typing(jid->barejid); } else if (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_GONE) != NULL) { @@ -490,7 +486,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, // do something } else if (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL) { // do something - } else { // <active/> + } else if (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ACTIVE) != NULL) { // do something } } |