diff options
author | James Booth <boothj5@gmail.com> | 2012-11-09 00:51:32 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-11-09 00:51:32 +0000 |
commit | d2497b2e92080bf56d33aed29ef28ce6f5715857 (patch) | |
tree | 953308abc5d82d50e4bb03c6c7ca5f4a5da30677 /src/stanza.c | |
parent | f167fdd55d68586c4b590e11f28997d4ee906579 (diff) | |
download | profani-tty-d2497b2e92080bf56d33aed29ef28ce6f5715857.tar.gz |
Added stanza constants
Diffstat (limited to 'src/stanza.c')
-rw-r--r-- | src/stanza.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/stanza.c b/src/stanza.c index 5cb09d3e..3757ea7c 100644 --- a/src/stanza.c +++ b/src/stanza.c @@ -23,6 +23,7 @@ #include <strophe.h> #include "common.h" +#include "stanza.h" xmpp_stanza_t * stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const recipient, @@ -31,13 +32,13 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const recipient, xmpp_stanza_t *msg, *chat_state; msg = xmpp_stanza_new(ctx); - xmpp_stanza_set_name(msg, "message"); - xmpp_stanza_set_type(msg, "chat"); - xmpp_stanza_set_attribute(msg, "to", recipient); + xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); + xmpp_stanza_set_type(msg, STANZA_TYPE_CHAT); + xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient); chat_state = xmpp_stanza_new(ctx); xmpp_stanza_set_name(chat_state, state); - xmpp_stanza_set_ns(chat_state, "http://jabber.org/protocol/chatstates"); + xmpp_stanza_set_ns(chat_state, STANZA_NS_CHATSTATES); xmpp_stanza_add_child(msg, chat_state); return msg; @@ -53,12 +54,12 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, xmpp_stanza_t *msg, *body, *text; msg = xmpp_stanza_new(ctx); - xmpp_stanza_set_name(msg, "message"); + xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); xmpp_stanza_set_type(msg, type); - xmpp_stanza_set_attribute(msg, "to", recipient); + xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient); body = xmpp_stanza_new(ctx); - xmpp_stanza_set_name(body, "body"); + xmpp_stanza_set_name(body, STANZA_NAME_BODY); text = xmpp_stanza_new(ctx); xmpp_stanza_set_text(text, encoded_xml); @@ -68,7 +69,7 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, if (state != NULL) { xmpp_stanza_t *chat_state = xmpp_stanza_new(ctx); xmpp_stanza_set_name(chat_state, state); - xmpp_stanza_set_ns(chat_state, "http://jabber.org/protocol/chatstates"); + xmpp_stanza_set_ns(chat_state, STANZA_NS_CHATSTATES); xmpp_stanza_add_child(msg, chat_state); } |