comparison src/protocols/jabber/chat.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 967ef719cb62
children
comparison
equal deleted inserted replaced
13805:853fefb07c79 13806:25e63008d3bb
160 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); 160 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server);
161 161
162 if(chat->muc) { 162 if(chat->muc) {
163 xmlnode_set_attrib(message, "to", room_jid); 163 xmlnode_set_attrib(message, "to", room_jid);
164 x = xmlnode_new_child(message, "x"); 164 x = xmlnode_new_child(message, "x");
165 xmlnode_set_attrib(x, "xmlns", "http://jabber.org/protocol/muc#user"); 165 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user");
166 invite = xmlnode_new_child(x, "invite"); 166 invite = xmlnode_new_child(x, "invite");
167 xmlnode_set_attrib(invite, "to", name); 167 xmlnode_set_attrib(invite, "to", name);
168 body = xmlnode_new_child(invite, "reason"); 168 body = xmlnode_new_child(invite, "reason");
169 xmlnode_insert_data(body, msg, -1); 169 xmlnode_insert_data(body, msg, -1);
170 } else { 170 } else {
171 xmlnode_set_attrib(message, "to", name); 171 xmlnode_set_attrib(message, "to", name);
172 body = xmlnode_new_child(message, "body"); 172 body = xmlnode_new_child(message, "body");
173 xmlnode_insert_data(body, msg, -1); 173 xmlnode_insert_data(body, msg, -1);
174 x = xmlnode_new_child(message, "x"); 174 x = xmlnode_new_child(message, "x");
175 xmlnode_set_attrib(x, "jid", room_jid); 175 xmlnode_set_attrib(x, "jid", room_jid);
176 xmlnode_set_attrib(x, "xmlns", "jabber:x:conference"); 176 xmlnode_set_namespace(x, "jabber:x:conference");
177 } 177 }
178 178
179 jabber_send(js, message); 179 jabber_send(js, message);
180 xmlnode_free(message); 180 xmlnode_free(message);
181 g_free(room_jid); 181 g_free(room_jid);
265 full_jid = g_strdup_printf("%s/%s", room_jid, handle); 265 full_jid = g_strdup_printf("%s/%s", room_jid, handle);
266 xmlnode_set_attrib(presence, "to", full_jid); 266 xmlnode_set_attrib(presence, "to", full_jid);
267 g_free(full_jid); 267 g_free(full_jid);
268 268
269 x = xmlnode_new_child(presence, "x"); 269 x = xmlnode_new_child(presence, "x");
270 xmlnode_set_attrib(x, "xmlns", "http://jabber.org/protocol/muc"); 270 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc");
271 271
272 if(passwd && *passwd) { 272 if(passwd && *passwd) {
273 xmlnode *password = xmlnode_new_child(x, "password"); 273 xmlnode *password = xmlnode_new_child(x, "password");
274 xmlnode_insert_data(password, passwd, -1); 274 xmlnode_insert_data(password, passwd, -1);
275 } 275 }
378 if(!(query = xmlnode_get_child(packet, "query"))) 378 if(!(query = xmlnode_get_child(packet, "query")))
379 return; 379 return;
380 380
381 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { 381 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) {
382 const char *xmlns; 382 const char *xmlns;
383 if(!(xmlns = xmlnode_get_attrib(x, "xmlns"))) 383 if(!(xmlns = xmlnode_get_namespace(x)))
384 continue; 384 continue;
385 385
386 if(!strcmp(xmlns, "jabber:x:data")) { 386 if(!strcmp(xmlns, "jabber:x:data")) {
387 chat->config_dialog_type = GAIM_REQUEST_FIELDS; 387 chat->config_dialog_type = GAIM_REQUEST_FIELDS;
388 chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); 388 chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat);
449 query = xmlnode_get_child(iq->node, "query"); 449 query = xmlnode_get_child(iq->node, "query");
450 x = xmlnode_new_child(query, "x"); 450 x = xmlnode_new_child(query, "x");
451 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); 451 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server);
452 452
453 xmlnode_set_attrib(iq->node, "to", room_jid); 453 xmlnode_set_attrib(iq->node, "to", room_jid);
454 xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); 454 xmlnode_set_namespace(x, "jabber:x:data");
455 xmlnode_set_attrib(x, "type", "submit"); 455 xmlnode_set_attrib(x, "type", "submit");
456 456
457 jabber_iq_send(iq); 457 jabber_iq_send(iq);
458 458
459 g_free(room_jid); 459 g_free(room_jid);
522 return; 522 return;
523 523
524 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { 524 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) {
525 const char *xmlns; 525 const char *xmlns;
526 526
527 if(!(xmlns = xmlnode_get_attrib(x, "xmlns"))) 527 if(!(xmlns = xmlnode_get_namespace(x)))
528 continue; 528 continue;
529 529
530 if(!strcmp(xmlns, "jabber:x:data")) { 530 if(!strcmp(xmlns, "jabber:x:data")) {
531 jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); 531 jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat);
532 return; 532 return;