Mercurial > pidgin
changeset 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 | df6981a51853 |
children | 92a763567ddc |
files | configure.ac configure.in m4/ac_var_timezone_externals.m4 src/protocols/jabber/jabber.c |
diffstat | 4 files changed, 56 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sys/socket.h> socklen_t x; ], [], [AC_MSG_RESULT(yes)], [ -AC_TRY_COMPILE([#include <sys/types> +AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> 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
--- 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 <sys/socket.h> socklen_t x; ], [], [AC_MSG_RESULT(yes)], [ -AC_TRY_COMPILE([#include <sys/types> +AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h> 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
--- /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 <markb@freedomware.co.uk> +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 <time.h>], [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 <time.h>], [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 <time.h>], [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 +])
--- 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 {