diff options
author | James Booth <boothj5@gmail.com> | 2012-10-31 23:08:26 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-31 23:08:26 +0000 |
commit | 5792cd597dc7a7de6d1b7127cb99d7d36adb50c2 (patch) | |
tree | 4f8fee990a9b869208d8476cc3800d09bc2f7e9a /src/jabber.c | |
parent | 81dd0a1556398b636b036fc4e8dff015a2670968 (diff) | |
download | profani-tty-5792cd597dc7a7de6d1b7127cb99d7d36adb50c2.tar.gz |
Handling paused status
Diffstat (limited to 'src/jabber.c')
-rw-r--r-- | src/jabber.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/jabber.c b/src/jabber.c index 1a24be47..150f7c6f 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -164,6 +164,7 @@ jabber_send(const char * const msg, const char * const recipient) // always send <active/> with messages when recipient supports chat states if (chat_session_get_recipient_supports(recipient)) { + chat_session_set_active(recipient); active = xmpp_stanza_new(jabber_conn.ctx); xmpp_stanza_set_name(active, "active"); xmpp_stanza_set_ns(active, "http://jabber.org/protocol/chatstates"); @@ -203,6 +204,48 @@ jabber_send_inactive(const char * const recipient) } void +jabber_send_composing(const char * const recipient) +{ + xmpp_stanza_t *message, *composing; + + message = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(message, "message"); + xmpp_stanza_set_type(message, "chat"); + xmpp_stanza_set_attribute(message, "to", recipient); + + composing = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(composing, "composing"); + xmpp_stanza_set_ns(composing, "http://jabber.org/protocol/chatstates"); + xmpp_stanza_add_child(message, composing); + + xmpp_send(jabber_conn.conn, message); + xmpp_stanza_release(message); + + chat_session_set_sent(recipient); +} + +void +jabber_send_paused(const char * const recipient) +{ + xmpp_stanza_t *message, *paused; + + message = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(message, "message"); + xmpp_stanza_set_type(message, "chat"); + xmpp_stanza_set_attribute(message, "to", recipient); + + paused = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(paused, "paused"); + xmpp_stanza_set_ns(paused, "http://jabber.org/protocol/chatstates"); + xmpp_stanza_add_child(message, paused); + + xmpp_send(jabber_conn.conn, message); + xmpp_stanza_release(message); + + chat_session_set_sent(recipient); +} + +void jabber_send_gone(const char * const recipient) { xmpp_stanza_t *message, *gone; |