Added xml escaping to stanza module

This commit is contained in:
James Booth
2012-11-08 23:35:11 +00:00
parent 29b5abfe06
commit f90d13bd5e
2 changed files with 9 additions and 7 deletions

View File

@@ -22,6 +22,8 @@
#include <strophe.h>
#include "common.h"
xmpp_stanza_t *
stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const recipient,
const char * const state)
@@ -46,6 +48,8 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
const char * const type, const char * const message,
const char * const state)
{
char *encoded_xml = encode_xml(message);
xmpp_stanza_t *msg, *body, *text;
msg = xmpp_stanza_new(ctx);
@@ -57,7 +61,7 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
xmpp_stanza_set_name(body, "body");
text = xmpp_stanza_new(ctx);
xmpp_stanza_set_text(text, message);
xmpp_stanza_set_text(text, encoded_xml);
xmpp_stanza_add_child(body, text);
xmpp_stanza_add_child(msg, body);
@@ -68,6 +72,8 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
xmpp_stanza_add_child(msg, chat_state);
}
g_free(encoded_xml);
return msg;
}