changeset 569:69afee8e1232

"/room invite": Do not send epty reason
author Mikael Berthe <mikael@lilotux.net>
date Sat, 03 Dec 2005 13:47:52 +0100
parents eb1df2371581
children 29806b0fe830
files mcabber/src/jabglue.c
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Sat Dec 03 13:32:29 2005 +0100
+++ b/mcabber/src/jabglue.c	Sat Dec 03 13:47:52 2005 +0100
@@ -650,12 +650,9 @@
 void jb_room_invite(const char *room, const char *jid, const char *reason)
 {
   xmlnode x, y, z;
-  gchar *utf8_reason;
 
   if (!online || !room || !jid) return;
 
-  if (!reason) reason = "";
-
   x = jutil_msgnew(NULL, (char*)room, NULL, NULL);
 
   y = xmlnode_insert_tag(x, "x");
@@ -664,10 +661,12 @@
   z = xmlnode_insert_tag(y, "invite");
   xmlnode_put_attrib(z, "to", jid);
 
-  utf8_reason = to_utf8(reason);
-  y = xmlnode_insert_tag(z, "reason");
-  xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1);
-  g_free(utf8_reason);
+  if (reason) {
+    gchar *utf8_reason = to_utf8(reason);
+    y = xmlnode_insert_tag(z, "reason");
+    xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1);
+    g_free(utf8_reason);
+  }
 
   jab_send(jc, x);
   xmlnode_free(x);