Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 599:fb67bf62f4eb
Add "/room destroy"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 13 Dec 2005 23:40:17 +0100 |
parents | a3db3ee8b99e |
children | 483a87c99990 |
comparison
equal
deleted
inserted
replaced
598:a3db3ee8b99e | 599:fb67bf62f4eb |
---|---|
573 xmlnode_put_attrib(x, "to", room); | 573 xmlnode_put_attrib(x, "to", room); |
574 y = xmlnode_get_tag(x, "query"); | 574 y = xmlnode_get_tag(x, "query"); |
575 z = xmlnode_insert_tag(y, "x"); | 575 z = xmlnode_insert_tag(y, "x"); |
576 xmlnode_put_attrib(z, "xmlns", "jabber:x:data"); | 576 xmlnode_put_attrib(z, "xmlns", "jabber:x:data"); |
577 xmlnode_put_attrib(z, "type", "submit"); | 577 xmlnode_put_attrib(z, "type", "submit"); |
578 | |
579 jab_send(jc, x); | |
580 xmlnode_free(x); | |
581 jb_reset_keepalive(); | |
582 } | |
583 | |
584 // Destroy a MUC room | |
585 // room syntax: "room@server" | |
586 void jb_room_destroy(const char *room, const char *venue, const char *reason) | |
587 { | |
588 xmlnode x, y, z; | |
589 | |
590 if (!online || !room) return; | |
591 | |
592 x = jutil_iqnew(JPACKET__SET, "http://jabber.org/protocol/muc#owner"); | |
593 xmlnode_put_attrib(x, "id", "destroy1"); // XXX | |
594 xmlnode_put_attrib(x, "to", room); | |
595 y = xmlnode_get_tag(x, "query"); | |
596 z = xmlnode_insert_tag(y, "destroy"); | |
597 | |
598 if (venue && *venue) | |
599 xmlnode_put_attrib(z, "jid", venue); | |
600 | |
601 if (reason) { | |
602 gchar *utf8_reason = to_utf8(reason); | |
603 y = xmlnode_insert_tag(z, "reason"); | |
604 xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1); | |
605 g_free(utf8_reason); | |
606 } | |
578 | 607 |
579 jab_send(jc, x); | 608 jab_send(jc, x); |
580 xmlnode_free(x); | 609 xmlnode_free(x); |
581 jb_reset_keepalive(); | 610 jb_reset_keepalive(); |
582 } | 611 } |
977 | 1006 |
978 g_free(mbuf_end); | 1007 g_free(mbuf_end); |
979 } else { | 1008 } else { |
980 // Natural leave | 1009 // Natural leave |
981 if (we_left) { | 1010 if (we_left) { |
982 mbuf = g_strdup_printf("You have left %s", roomjid); | 1011 if (xmlnode_get_tag(xmldata, "destroy")) |
1012 mbuf = g_strdup_printf("You have left %s, " | |
1013 "the room has been destroyed", roomjid); | |
1014 else | |
1015 mbuf = g_strdup_printf("You have left %s", roomjid); | |
983 } else { | 1016 } else { |
984 if (ustmsg) | 1017 if (ustmsg) |
985 mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg); | 1018 mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg); |
986 else | 1019 else |
987 mbuf = g_strdup_printf("%s has left", rname); | 1020 mbuf = g_strdup_printf("%s has left", rname); |