Mercurial > pidgin.yaz
diff src/protocols/jabber/jabber.c @ 3194:fdd20785e1e1
[gaim-migrate @ 3211]
jabber.c
Repaired iso8601_to_time() to work properly for HAVE_TIMEZONE. (jseymour)
Removed signon time code as it didn't produce the desired results (faceprint).
configure.ac
configure.in
Added AC_VAR_TIMEZONE_EXTERNALS macro for HAVE_TIMEZONE, HAVE_ALTZONE and
HAVE_DAYLIGHT defines. (jseymour)
Fixed socklen_t (fingolfin)
c_var_timezone_externals.m4
Added file. (jseymour)
committer: Tailor Script <tailor@pidgin.im>
author | Jim Seymour <jseymour> |
---|---|
date | Fri, 03 May 2002 01:09:49 +0000 |
parents | 1fde0667976e |
children | e3cba5bb2d69 |
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c Wed May 01 04:26:01 2002 +0000 +++ b/src/protocols/jabber/jabber.c Fri May 03 01:09:49 2002 +0000 @@ -734,23 +734,26 @@ static time_t iso8601_to_time(char *timestamp) { struct tm t; - if(sscanf(timestamp,"%04d%02d%02dT%02d:%02d:%02d", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec)) + time_t retval = 0; + + if(sscanf(timestamp,"%04d%02d%02dT%02d:%02d:%02d", + &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec)) { t.tm_year -= 1900; t.tm_mon -= 1; - return mktime(&t) + + t.tm_isdst = 0; + retval = mktime(&t); #ifdef HAVE_TM_GMTOFF - t.tm_gmtoff + retval += t.tm_gmtoff; #else # ifdef HAVE_TIMEZONE - timezone -# else - 0 + tzset(); /* making sure */ + retval -= timezone; # endif #endif ; } - return 0; + return retval; } static void jabber_handlemessage(gjconn gjc, jpacket p) @@ -929,32 +932,18 @@ struct buddy *b = NULL; jid who; char *buddy; - xmlnode y,z; + xmlnode y; char *show; int state = 0; GSList *resources; char *res; struct conversation *cnv = NULL; struct jabber_chat *jc = NULL; - time_t signon = time(NULL); - to = xmlnode_get_attrib(p->x, "to"); from = xmlnode_get_attrib(p->x, "from"); type = xmlnode_get_attrib(p->x, "type"); - z = xmlnode_get_firstchild(p->x); - - while(z) - { - if(NSCHECK(z,NS_DELAY)) - { - char *timestamp = xmlnode_get_attrib(z,"stamp"); - signon = iso8601_to_time(timestamp); - } - z = xmlnode_get_nextsibling(z); - } - if ((y = xmlnode_get_tag(p->x, "show"))) { show = xmlnode_get_data(y); if (!show) { @@ -1021,7 +1010,7 @@ b->proto_data = g_slist_append(b->proto_data, g_strdup(res)); } - serv_got_update(GJ_GC(gjc), buddy, 1, 0, b->signon ? b->signon : signon, b->idle, state, 0); + serv_got_update(GJ_GC(gjc), buddy, 1, 0, b->signon, b->idle, state, 0); } } else {