diff options
author | James Booth <boothj5@gmail.com> | 2013-02-03 22:18:40 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-02-03 22:18:40 +0000 |
commit | 1cd2d6c7c9e5dc6d764d67b1b437ef7180b7d26a (patch) | |
tree | 322b1dd66f852677f7e0a7b9adc21989c88d4bfb | |
parent | 1cea320a0cff2a763a47322283886facfd9c9c29 (diff) | |
download | profani-tty-1cd2d6c7c9e5dc6d764d67b1b437ef7180b7d26a.tar.gz |
Moved function to get presence string from type to stanza.c
-rw-r--r-- | src/xmpp/presence.c | 23 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 18 | ||||
-rw-r--r-- | src/xmpp/stanza.h | 2 |
3 files changed, 22 insertions, 21 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index f30a701c..a2ec75c4 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -43,7 +43,6 @@ static int _presence_handler(xmpp_conn_t * const conn, static char* _handle_presence_caps(xmpp_stanza_t * const stanza); static int _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza); -static const char * _get_presence_stanza_string_from_type(jabber_presence_t presence_type); void presence_init(void) @@ -113,7 +112,7 @@ presence_update(jabber_presence_t presence_type, const char * const msg, xmpp_conn_t *conn = jabber_get_conn(); int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(), presence_type); - const char *show = _get_presence_stanza_string_from_type(presence_type); + const char *show = stanza_get_presence_string_from_type(presence_type); // don't send presence when disconnected if (jabber_get_connection_status() != JABBER_CONNECTED) @@ -160,7 +159,7 @@ presence_join_room(Jid *jid) xmpp_ctx_t *ctx = jabber_get_ctx(); xmpp_conn_t *conn = jabber_get_conn(); jabber_presence_t presence_type = jabber_get_presence_type(); - const char *show = _get_presence_stanza_string_from_type(presence_type); + const char *show = stanza_get_presence_string_from_type(presence_type); char *status = jabber_get_presence_message(); int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(), presence_type); @@ -463,21 +462,3 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza) return 1; } - -static const char * -_get_presence_stanza_string_from_type(jabber_presence_t presence_type) -{ - switch(presence_type) - { - case PRESENCE_AWAY: - return STANZA_TEXT_AWAY; - case PRESENCE_DND: - return STANZA_TEXT_DND; - case PRESENCE_CHAT: - return STANZA_TEXT_CHAT; - case PRESENCE_XA: - return STANZA_TEXT_XA; - default: // PRESENCE_ONLINE - return NULL; - } -} diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 5a19a576..f4824a0b 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -676,6 +676,24 @@ stanza_attach_caps(xmpp_ctx_t *ctx, xmpp_stanza_t *presence) FREE_SET_NULL(sha1); } +const char * +stanza_get_presence_string_from_type(jabber_presence_t presence_type) +{ + switch(presence_type) + { + case PRESENCE_AWAY: + return STANZA_TEXT_AWAY; + case PRESENCE_DND: + return STANZA_TEXT_DND; + case PRESENCE_CHAT: + return STANZA_TEXT_CHAT; + case PRESENCE_XA: + return STANZA_TEXT_XA; + default: // PRESENCE_ONLINE + return NULL; + } +} + static int _field_compare(FormField *f1, FormField *f2) { diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index f3d25cb2..549e951c 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -154,4 +154,6 @@ void stanza_attach_priority(xmpp_ctx_t *ctx, xmpp_stanza_t *presence, int pri); void stanza_attach_last_activity(xmpp_ctx_t *ctx, xmpp_stanza_t *presence, int idle); void stanza_attach_caps(xmpp_ctx_t *ctx, xmpp_stanza_t *presence); +const char * stanza_get_presence_string_from_type(jabber_presence_t presence_type); + #endif |