comparison mcabber/src/jabglue.c @ 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 afc2bd38b15c
comparison
equal deleted inserted replaced
568:eb1df2371581 569:69afee8e1232
648 // room syntax: "room@server" 648 // room syntax: "room@server"
649 // reason can be null. 649 // reason can be null.
650 void jb_room_invite(const char *room, const char *jid, const char *reason) 650 void jb_room_invite(const char *room, const char *jid, const char *reason)
651 { 651 {
652 xmlnode x, y, z; 652 xmlnode x, y, z;
653 gchar *utf8_reason;
654 653
655 if (!online || !room || !jid) return; 654 if (!online || !room || !jid) return;
656
657 if (!reason) reason = "";
658 655
659 x = jutil_msgnew(NULL, (char*)room, NULL, NULL); 656 x = jutil_msgnew(NULL, (char*)room, NULL, NULL);
660 657
661 y = xmlnode_insert_tag(x, "x"); 658 y = xmlnode_insert_tag(x, "x");
662 xmlnode_put_attrib(y, "xmlns", "http://jabber.org/protocol/muc#user"); 659 xmlnode_put_attrib(y, "xmlns", "http://jabber.org/protocol/muc#user");
663 660
664 z = xmlnode_insert_tag(y, "invite"); 661 z = xmlnode_insert_tag(y, "invite");
665 xmlnode_put_attrib(z, "to", jid); 662 xmlnode_put_attrib(z, "to", jid);
666 663
667 utf8_reason = to_utf8(reason); 664 if (reason) {
668 y = xmlnode_insert_tag(z, "reason"); 665 gchar *utf8_reason = to_utf8(reason);
669 xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1); 666 y = xmlnode_insert_tag(z, "reason");
670 g_free(utf8_reason); 667 xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1);
668 g_free(utf8_reason);
669 }
671 670
672 jab_send(jc, x); 671 jab_send(jc, x);
673 xmlnode_free(x); 672 xmlnode_free(x);
674 jb_reset_keepalive(); 673 jb_reset_keepalive();
675 } 674 }