diff options
author | James Booth <boothj5@gmail.com> | 2012-05-27 22:33:28 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-05-27 22:33:28 +0100 |
commit | fadf841d1f7930f701379caf49b7f39128ae3c65 (patch) | |
tree | d29462cc203b7ee28282c4a27968b1b6c112ae2f | |
parent | dd9f6f825ea7b602f3064ca4a6099dfb5cd9910d (diff) | |
download | profani-tty-fadf841d1f7930f701379caf49b7f39128ae3c65.tar.gz |
Implemented presence function
-rw-r--r-- | jabber.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/jabber.c b/jabber.c index 37a049f7..731b1f35 100644 --- a/jabber.c +++ b/jabber.c @@ -183,6 +183,25 @@ void jabber_roster_request(void) void jabber_update_presence(jabber_presence_t status) { jabber_conn.presence = status; + + xmpp_stanza_t *pres, *show; + + pres = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(pres, "presence"); + + if (status == PRESENCE_AWAY) { + show = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_name(show, "show"); + xmpp_stanza_t *text = xmpp_stanza_new(jabber_conn.ctx); + xmpp_stanza_set_text(text, "away"); + xmpp_stanza_add_child(show, text); + xmpp_stanza_add_child(pres, show); + xmpp_stanza_release(text); + xmpp_stanza_release(show); + } + + xmpp_send(jabber_conn.conn, pres); + xmpp_stanza_release(pres); } static int _jabber_message_handler(xmpp_conn_t * const conn, |