comparison src/protocols/jabber/si.c @ 13806:25e63008d3bb

[gaim-migrate @ 16229] Use libxml2 for XML parsing, if available. The biggest benefit from this is actual support for XML namespaces. This fixes a handful of Google Talk integration problems, including typing notifications and buddy icons. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 08 Jun 2006 01:03:51 +0000
parents 5ddde4ad1ca2
children 10e8eb6a4910
comparison
equal deleted inserted replaced
13805:853fefb07c79 13806:25e63008d3bb
137 xmlnode_set_attrib(iq->node, "to", xfer->who); 137 xmlnode_set_attrib(iq->node, "to", xfer->who);
138 error = xmlnode_new_child(iq->node, "error"); 138 error = xmlnode_new_child(iq->node, "error");
139 xmlnode_set_attrib(error, "code", "404"); 139 xmlnode_set_attrib(error, "code", "404");
140 xmlnode_set_attrib(error, "type", "cancel"); 140 xmlnode_set_attrib(error, "type", "cancel");
141 condition = xmlnode_new_child(error, "condition"); 141 condition = xmlnode_new_child(error, "condition");
142 xmlnode_set_attrib(condition, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas"); 142 xmlnode_set_namespace(condition, "urn:ietf:params:xml:ns:xmpp-stanzas");
143 xmlnode_new_child(condition, "item-not-found"); 143 xmlnode_new_child(condition, "item-not-found");
144 144
145 jabber_iq_send(iq); 145 jabber_iq_send(iq);
146 146
147 gaim_xfer_cancel_local(xfer); 147 gaim_xfer_cancel_local(xfer);
635 xfer->filename = g_path_get_basename(xfer->local_filename); 635 xfer->filename = g_path_get_basename(xfer->local_filename);
636 636
637 iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); 637 iq = jabber_iq_new(jsx->js, JABBER_IQ_SET);
638 xmlnode_set_attrib(iq->node, "to", xfer->who); 638 xmlnode_set_attrib(iq->node, "to", xfer->who);
639 si = xmlnode_new_child(iq->node, "si"); 639 si = xmlnode_new_child(iq->node, "si");
640 xmlnode_set_attrib(si, "xmlns", "http://jabber.org/protocol/si"); 640 xmlnode_set_namespace(si, "http://jabber.org/protocol/si");
641 jsx->stream_id = jabber_get_next_id(jsx->js); 641 jsx->stream_id = jabber_get_next_id(jsx->js);
642 xmlnode_set_attrib(si, "id", jsx->stream_id); 642 xmlnode_set_attrib(si, "id", jsx->stream_id);
643 xmlnode_set_attrib(si, "profile", 643 xmlnode_set_attrib(si, "profile",
644 "http://jabber.org/protocol/si/profile/file-transfer"); 644 "http://jabber.org/protocol/si/profile/file-transfer");
645 645
646 file = xmlnode_new_child(si, "file"); 646 file = xmlnode_new_child(si, "file");
647 xmlnode_set_attrib(file, "xmlns", 647 xmlnode_set_namespace(file,
648 "http://jabber.org/protocol/si/profile/file-transfer"); 648 "http://jabber.org/protocol/si/profile/file-transfer");
649 xmlnode_set_attrib(file, "name", xfer->filename); 649 xmlnode_set_attrib(file, "name", xfer->filename);
650 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); 650 g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size);
651 xmlnode_set_attrib(file, "size", buf); 651 xmlnode_set_attrib(file, "size", buf);
652 /* maybe later we'll do hash and date attribs */ 652 /* maybe later we'll do hash and date attribs */
653 653
654 feature = xmlnode_new_child(si, "feature"); 654 feature = xmlnode_new_child(si, "feature");
655 xmlnode_set_attrib(feature, "xmlns", 655 xmlnode_set_namespace(feature,
656 "http://jabber.org/protocol/feature-neg"); 656 "http://jabber.org/protocol/feature-neg");
657 x = xmlnode_new_child(feature, "x"); 657 x = xmlnode_new_child(feature, "x");
658 xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); 658 xmlnode_set_namespace(x, "jabber:x:data");
659 xmlnode_set_attrib(x, "type", "form"); 659 xmlnode_set_attrib(x, "type", "form");
660 field = xmlnode_new_child(x, "field"); 660 field = xmlnode_new_child(x, "field");
661 xmlnode_set_attrib(field, "var", "stream-method"); 661 xmlnode_set_attrib(field, "var", "stream-method");
662 xmlnode_set_attrib(field, "type", "list-single"); 662 xmlnode_set_attrib(field, "type", "list-single");
663 option = xmlnode_new_child(field, "option"); 663 option = xmlnode_new_child(field, "option");
769 jabber_iq_set_id(iq, jsx->iq_id); 769 jabber_iq_set_id(iq, jsx->iq_id);
770 770
771 jsx->accepted = TRUE; 771 jsx->accepted = TRUE;
772 772
773 si = xmlnode_new_child(iq->node, "si"); 773 si = xmlnode_new_child(iq->node, "si");
774 xmlnode_set_attrib(si, "xmlns", "http://jabber.org/protocol/si"); 774 xmlnode_set_namespace(si, "http://jabber.org/protocol/si");
775 775
776 feature = xmlnode_new_child(si, "feature"); 776 feature = xmlnode_new_child(si, "feature");
777 xmlnode_set_attrib(feature, "xmlns", "http://jabber.org/protocol/feature-neg"); 777 xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg");
778 778
779 x = xmlnode_new_child(feature, "x"); 779 x = xmlnode_new_child(feature, "x");
780 xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); 780 xmlnode_set_namespace(x, "jabber:x:data");
781 xmlnode_set_attrib(x, "type", "submit"); 781 xmlnode_set_attrib(x, "type", "submit");
782 782
783 field = xmlnode_new_child(x, "field"); 783 field = xmlnode_new_child(x, "field");
784 xmlnode_set_attrib(field, "var", "stream-method"); 784 xmlnode_set_attrib(field, "var", "stream-method");
785 785