about summary refs log tree commit diff stats
path: root/jabber.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-04-19 22:26:12 +0100
committerJames Booth <boothj5@gmail.com>2012-04-19 22:26:12 +0100
commit366eecc19569f14a6081e1acb6efd72a372982da (patch)
tree7778440a1210f49a21b10a10e142030a17cb1f30 /jabber.c
parent9805b2b2b22e277ee150ddaabe8f542b267e3e4b (diff)
downloadprofani-tty-366eecc19569f14a6081e1acb6efd72a372982da.tar.gz
Handle ampersand
Replaced with &amp; in messages
Diffstat (limited to 'jabber.c')
-rw-r--r--jabber.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/jabber.c b/jabber.c
index fbd0ccdd..8244c257 100644
--- a/jabber.c
+++ b/jabber.c
@@ -27,6 +27,7 @@
 #include "log.h"
 #include "contact_list.h"
 #include "windows.h"
+#include "util.h"
 
 #define PING_INTERVAL 120000 // 2 minutes
 
@@ -133,6 +134,8 @@ void jabber_process_events(void)
 
 void jabber_send(const char * const msg, const char * const recipient)
 {
+    char *coded_msg = str_replace(msg, "&", "&amp;");
+
     xmpp_stanza_t *reply, *body, *text;
 
     reply = xmpp_stanza_new(jabber_conn.ctx);
@@ -144,7 +147,7 @@ void jabber_send(const char * const msg, const char * const recipient)
     xmpp_stanza_set_name(body, "body");
 
     text = xmpp_stanza_new(jabber_conn.ctx);
-    xmpp_stanza_set_text(text, msg);
+    xmpp_stanza_set_text(text, coded_msg);
     xmpp_stanza_add_child(body, text);
     xmpp_stanza_add_child(reply, body);