# HG changeset patch # User Jim Seymour # Date 1020388189 0 # Node ID fdd20785e1e1e69d98a8348903b8b90190182e42 # Parent df6981a5185396ecacc1a117a5cc5a97ac1c6429 [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 diff -r df6981a51853 -r fdd20785e1e1 configure.ac --- a/configure.ac Wed May 01 04:26:01 2002 +0000 +++ b/configure.ac Fri May 03 01:09:49 2002 +0000 @@ -51,12 +51,12 @@ #include socklen_t x; ], [], [AC_MSG_RESULT(yes)], [ -AC_TRY_COMPILE([#include +AC_TRY_COMPILE([#include #include int accept(int, struct sockaddr *, size_t *); ], [], [ AC_MSG_RESULT(size_t) -AC_DEFINE(socklen_t, size_t)]. [ +AC_DEFINE(socklen_t, size_t)], [ AC_MSG_RESULT(int) AC_DEFINE(socklen_t, int)])]) @@ -409,6 +409,7 @@ AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h) AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h) AC_CHECK_HEADERS(termios.h) +AC_VAR_TIMEZONE_EXTERNALS AC_OUTPUT([Makefile doc/Makefile diff -r df6981a51853 -r fdd20785e1e1 configure.in --- a/configure.in Wed May 01 04:26:01 2002 +0000 +++ b/configure.in Fri May 03 01:09:49 2002 +0000 @@ -49,12 +49,12 @@ #include socklen_t x; ], [], [AC_MSG_RESULT(yes)], [ -AC_TRY_COMPILE([#include +AC_TRY_COMPILE([#include #include int accept(int, struct sockaddr *, size_t *); ], [], [ AC_MSG_RESULT(size_t) -AC_DEFINE(socklen_t, size_t)]. [ +AC_DEFINE(socklen_t, size_t)], [ AC_MSG_RESULT(int) AC_DEFINE(socklen_t, int)])]) @@ -407,6 +407,7 @@ AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h) AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h) AC_CHECK_HEADERS(termios.h) +AC_VAR_TIMEZONE_EXTERNALS AC_OUTPUT([Makefile doc/Makefile diff -r df6981a51853 -r fdd20785e1e1 m4/ac_var_timezone_externals.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m4/ac_var_timezone_externals.m4 Fri May 03 01:09:49 2002 +0000 @@ -0,0 +1,38 @@ + +# Define 'timezone', 'altzone' and 'daylight' +# http://www.gnu.org/software/ac-archive/Miscellaneous/ac_var_timezone_externals.html +# Use instead of `AC_STRUCT_TIMEZONE' to determine whether the +# the external timezone variables `timezone', `altzone' and `daylight' exist, +# defining `HAVE_TIMEZONE', `HAVE_ALTZONE' and `HAVE_DAYLIGHT' respectively +# (as well as gaining the macros defined by `AC_STRUCT_TIMEZONE'). +# Mark R.Bannister +AC_DEFUN([AC_VAR_TIMEZONE_EXTERNALS], +[ AC_REQUIRE([AC_STRUCT_TIMEZONE])dnl + AC_CACHE_CHECK(for timezone external, mb_cv_var_timezone, + [ AC_TRY_LINK([#include ], [return (int)timezone;], + mb_cv_var_timezone=yes, + mb_cv_var_timezone=no) + ]) + AC_CACHE_CHECK(for altzone external, mb_cv_var_altzone, + [ AC_TRY_LINK([#include ], [return (int)altzone;], + mb_cv_var_altzone=yes, + mb_cv_var_altzone=no) + ]) + AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight, + [ AC_TRY_LINK([#include ], [return (int)daylight;], + mb_cv_var_daylight=yes, + mb_cv_var_daylight=no) + ]) + if test $mb_cv_var_timezone = yes; then + AC_DEFINE([HAVE_TIMEZONE], 1, + [Define if you have the external `timezone' variable.]) + fi + if test $mb_cv_var_altzone = yes; then + AC_DEFINE([HAVE_ALTZONE], 1, + [Define if you have the external `altzone' variable.]) + fi + if test $mb_cv_var_daylight = yes; then + AC_DEFINE([HAVE_DAYLIGHT], 1, + [Define if you have the external `daylight' variable.]) + fi +]) diff -r df6981a51853 -r fdd20785e1e1 src/protocols/jabber/jabber.c --- 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 {