oscar: Remove dead usage of tm.tm_gmtoff and HAVE_TM_GMTOFF config

Wed, 12 Dec 2018 16:43:40 -0600

author
Mike Ruprecht <cmaiku@gmail.com>
date
Wed, 12 Dec 2018 16:43:40 -0600
changeset 39376
e15e1d67b37c
parent 39369
16beed8a98fb
child 39377
c84d810de0a4

oscar: Remove dead usage of tm.tm_gmtoff and HAVE_TM_GMTOFF config

Oscar at one time used tm.tm_gmtoff in order to offset a timestamp.
Now, the function is always passed 0 for the timestamp, which avoids
this code path. Therefore, this patch removes the timestamp argument
from the function, removes the dead code path which included the only
usage of tm.tm_gmtoff, and gets rid of the check/setting in meson for
HAVE_TM_GMTOFF.

libpurple/protocols/oscar/oscar.c file | annotate | diff | comparison | revisions
meson.build file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/oscar/oscar.c	Sun Dec 09 03:56:30 2018 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Wed Dec 12 16:43:40 2018 -0600
@@ -1689,7 +1689,8 @@
 }
 
 static int
-incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t)
+incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo,
+		struct aim_incomingim_ch4_args *args)
 {
 	PurpleConnection *gc = od->gc;
 	PurpleAccount *account = purple_connection_get_account(gc);
@@ -1734,24 +1735,8 @@
 				/* If the message came from an ICQ user then escape any HTML */
 				tmp = g_markup_escape_text(msg2[0], -1);
 
-				if (t) { /* This is an offline message */
-					/* The timestamp is UTC-ish, so we need to get the offset */
-#ifdef HAVE_TM_GMTOFF
-					time_t now;
-					struct tm *tm;
-					now = time(NULL);
-					tm = localtime(&now);
-					t += tm->tm_gmtoff;
-#else
-#	ifdef HAVE_TIMEZONE
-					tzset();
-					t -= timezone;
-#	endif
-#endif
-					purple_serv_got_im(gc, uin, tmp, 0, t);
-				} else { /* This is a message from MacICQ/Miranda */
-					purple_serv_got_im(gc, uin, tmp, 0, time(NULL));
-				}
+				purple_serv_got_im(gc, uin, tmp, 0, time(NULL));
+
 				g_free(uin);
 				g_free(tmp);
 			}
@@ -1982,7 +1967,7 @@
 		case 4: { /* ICQ */
 			struct aim_incomingim_ch4_args *args;
 			args = va_arg(ap, struct aim_incomingim_ch4_args *);
-			ret = incomingim_chan4(od, conn, userinfo, args, 0);
+			ret = incomingim_chan4(od, conn, userinfo, args);
 		} break;
 
 		default: {
--- a/meson.build	Sun Dec 09 03:56:30 2018 +0000
+++ b/meson.build	Wed Dec 12 16:43:40 2018 -0600
@@ -982,10 +982,6 @@
     compiler.has_header('sys/socket.h'))
 #AC_VAR_TIMEZONE_EXTERNALS
 
-conf.set('HAVE_TM_GMTOFF',
-    compiler.has_member('struct tm', 'tm_gmtoff',
-        prefix : '#include<time.h>'))
-
 #######################################################################
 # Disable pixmap installation
 #######################################################################

mercurial