| 275 /* if we are idle and not offline, include idle */ |
275 /* if we are idle and not offline, include idle */ |
| 276 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { |
276 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { |
| 277 xmlnode *query = xmlnode_new_child(presence, "query"); |
277 xmlnode *query = xmlnode_new_child(presence, "query"); |
| 278 gchar seconds[10]; |
278 gchar seconds[10]; |
| 279 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); |
279 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); |
| 280 |
280 |
| 281 xmlnode_set_namespace(query, "jabber:iq:last"); |
281 xmlnode_set_namespace(query, "jabber:iq:last"); |
| 282 xmlnode_set_attrib(query, "seconds", seconds); |
282 xmlnode_set_attrib(query, "seconds", seconds); |
| 283 } |
283 } |
| 284 |
284 |
| 285 /* JEP-0115 */ |
285 /* JEP-0115 */ |
| 359 nickname = xmlnode_get_data(fn); |
359 nickname = xmlnode_get_data(fn); |
| 360 |
360 |
| 361 if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { |
361 if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { |
| 362 char *tmp = xmlnode_get_data(nick); |
362 char *tmp = xmlnode_get_data(nick); |
| 363 char *bare_jid = jabber_get_bare_jid(from); |
363 char *bare_jid = jabber_get_bare_jid(from); |
| 364 if (strstr(bare_jid, tmp) == NULL) { |
364 if (tmp && strstr(bare_jid, tmp) == NULL) { |
| 365 g_free(nickname); |
365 g_free(nickname); |
| 366 nickname = tmp; |
366 nickname = tmp; |
| 367 } else |
367 } else if (tmp) |
| 368 g_free(tmp); |
368 g_free(tmp); |
| 369 |
369 |
| 370 g_free(bare_jid); |
370 g_free(bare_jid); |
| 371 } |
371 } |
| 372 |
372 |
| 624 if(photo) { |
624 if(photo) { |
| 625 g_free(avatar_hash); |
625 g_free(avatar_hash); |
| 626 avatar_hash = xmlnode_get_data(photo); |
626 avatar_hash = xmlnode_get_data(photo); |
| 627 } |
627 } |
| 628 } |
628 } |
| 629 } else if (!strcmp(y->name, "query") && |
629 } else if (!strcmp(y->name, "query") && |
| 630 !strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) { |
630 !strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) { |
| 631 /* resource has specified idle */ |
631 /* resource has specified idle */ |
| 632 const gchar *seconds = xmlnode_get_attrib(y, "seconds"); |
632 const gchar *seconds = xmlnode_get_attrib(y, "seconds"); |
| 633 if (seconds) { |
633 if (seconds) { |
| 634 /* we may need to take "delayed" into account here */ |
634 /* we may need to take "delayed" into account here */ |
| 642 value */ |
642 value */ |
| 643 time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL, |
643 time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL, |
| 644 NULL); |
644 NULL); |
| 645 purple_debug_info("jabber", "got delay %s yielding %ld s offset\n", |
645 purple_debug_info("jabber", "got delay %s yielding %ld s offset\n", |
| 646 stamp, offset); |
646 stamp, offset); |
| 647 idle += offset; |
647 idle += offset; |
| 648 } |
648 } |
| 649 |
649 |
| 650 if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) { |
650 if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) { |
| 651 static int i = 1; |
651 static int i = 1; |
| 652 |
652 |