comparison libpurple/protocols/jabber/presence.c @ 29031:9ae3e70a327b

jabber: More namespaces! This is a good stopping point for now.
author Paul Aurich <paul@darkrain42.org>
date Fri, 27 Nov 2009 17:07:19 +0000
parents 96ba7fd24177
children 31497213393c 5b449584fead c4f836780e1c
comparison
equal deleted inserted replaced
29030:8d8a1afc4268 29031:9ae3e70a327b
295 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { 295 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) {
296 xmlnode *query = xmlnode_new_child(presence, "query"); 296 xmlnode *query = xmlnode_new_child(presence, "query");
297 gchar seconds[10]; 297 gchar seconds[10];
298 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); 298 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));
299 299
300 xmlnode_set_namespace(query, "jabber:iq:last"); 300 xmlnode_set_namespace(query, NS_LAST_ACTIVITY);
301 xmlnode_set_attrib(query, "seconds", seconds); 301 xmlnode_set_attrib(query, "seconds", seconds);
302 } 302 }
303 303
304 /* JEP-0115 */ 304 /* JEP-0115 */
305 /* calculate hash */ 305 /* calculate hash */
460 460
461 if (info == NULL) 461 if (info == NULL)
462 goto out; 462 goto out;
463 463
464 if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) { 464 if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) {
465 JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items"); 465 JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS);
466 xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#items"); 466 xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS);
467 xmlnode_set_attrib(iq->node, "to", userdata->from); 467 xmlnode_set_attrib(iq->node, "to", userdata->from);
468 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); 468 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
469 jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); 469 jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
470 jabber_iq_send(iq); 470 jabber_iq_send(iq);
471 471
653 g_free(avatar_hash); 653 g_free(avatar_hash);
654 avatar_hash = xmlnode_get_data(photo); 654 avatar_hash = xmlnode_get_data(photo);
655 } 655 }
656 } 656 }
657 } else if (!strcmp(y->name, "query") && 657 } else if (!strcmp(y->name, "query") &&
658 !strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) { 658 !strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) {
659 /* resource has specified idle */ 659 /* resource has specified idle */
660 const gchar *seconds = xmlnode_get_attrib(y, "seconds"); 660 const gchar *seconds = xmlnode_get_attrib(y, "seconds");
661 if (seconds) { 661 if (seconds) {
662 /* we may need to take "delayed" into account here */ 662 /* we may need to take "delayed" into account here */
663 idle = atoi(seconds); 663 idle = atoi(seconds);