comparison mcabber/src/jab_iq.c @ 703:8cbcbff8de7d

Fix UTC time in IQ:version queries
author Mikael Berthe <mikael@lilotux.net>
date Wed, 15 Feb 2006 23:00:49 +0100
parents ee03b56b93ee
children 4118a66f2c02
comparison
equal deleted inserted replaced
702:3e34bd8e073d 703:8cbcbff8de7d
477 char *buf, *utf8_buf; 477 char *buf, *utf8_buf;
478 time_t now_t; 478 time_t now_t;
479 struct tm *now; 479 struct tm *now;
480 480
481 time(&now_t); 481 time(&now_t);
482 now = localtime(&now_t);
483 482
484 // "from" has already been converted to user locale 483 // "from" has already been converted to user locale
485 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", from); 484 scr_LogPrint(LPRINT_LOGNORM, "Received an IQ time request from <%s>", from);
486 485
487 buf = g_new0(char, 512); 486 buf = g_new0(char, 512);
490 x = jutil_iqnew(JPACKET__RESULT, NS_TIME); 489 x = jutil_iqnew(JPACKET__RESULT, NS_TIME);
491 xmlnode_put_attrib(x, "id", id); 490 xmlnode_put_attrib(x, "id", id);
492 xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from")); 491 xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from"));
493 myquery = xmlnode_get_tag(x, "query"); 492 myquery = xmlnode_get_tag(x, "query");
494 493
494 now = gmtime(&now_t);
495
495 strftime(buf, 512, "%Y%m%dT%T", now); 496 strftime(buf, 512, "%Y%m%dT%T", now);
496 xmlnode_insert_cdata(xmlnode_insert_tag(myquery, "utc"), buf, -1); 497 xmlnode_insert_cdata(xmlnode_insert_tag(myquery, "utc"), buf, -1);
498
499 now = localtime(&now_t);
497 500
498 strftime(buf, 512, "%Z", now); 501 strftime(buf, 512, "%Z", now);
499 if ((utf8_buf = to_utf8(buf))) { 502 if ((utf8_buf = to_utf8(buf))) {
500 xmlnode_insert_cdata(xmlnode_insert_tag(myquery, "tz"), utf8_buf, -1); 503 xmlnode_insert_cdata(xmlnode_insert_tag(myquery, "tz"), utf8_buf, -1);
501 g_free(utf8_buf); 504 g_free(utf8_buf);