changeset 20535:a9ee3fbabf81

fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test this also has a failed attempt to fix duplicate oim
author Ka-Hing Cheung <khc@hxbc.us>
date Wed, 03 Oct 2007 02:43:16 +0000
parents 7e69275a4eef
children d52d299cfde3
files libpurple/protocols/msn/oim.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/oim.c	Mon Oct 01 07:20:35 2007 +0000
+++ b/libpurple/protocols/msn/oim.c	Wed Oct 03 02:43:16 2007 +0000
@@ -292,9 +292,13 @@
 		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
 		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL
 	};
+	time_t tval = 0;
 	struct tm t;
 	memset(&t, 0, sizeof(t));
 
+	time(&tval);
+	localtime_r(&tval, &t);
+
 	if (sscanf(timestamp, "%02d %03s %04d %02d:%02d:%02d %05s",
 					&t.tm_mday, month_str, &t.tm_year,
 					&t.tm_hour, &t.tm_min, &t.tm_sec, tz_str) == 7) {
@@ -323,14 +327,13 @@
 					tzoff *= -1;
 
 				t.tm_year -= 1900;
-				t.tm_isdst = 0;
 
 #ifdef _WIN32
 				if ((sys_tzoff = wpurple_get_tz_offset()) != -1)
 					tzoff += sys_tzoff;
 #else
 #ifdef HAVE_TM_GMTOFF
-				tzoff += t.tm_gmtoff;
+				tzoff -= t.tm_gmtoff;
 #else
 #	ifdef HAVE_TIMEZONE
 				tzset();    /* making sure */
@@ -345,7 +348,7 @@
 	}
 
 	purple_debug_info("MSNP14:OIM", "Can't parse timestamp %s\n", timestamp);
-	return time(NULL);
+	return tval;
 }
 
 /*Post the Offline Instant Message to User Conversation*/
@@ -486,9 +489,11 @@
 		}
 /*		purple_debug_info("msnoim","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */
 
-		oim->oim_list = g_list_append(oim->oim_list, msgid);
-		msn_oim_post_single_get_msg(oim, msgid);
-		msgid = NULL;
+		if (!g_list_find_custom(oim->oim_list, msgid, g_str_equal)) {
+			oim->oim_list = g_list_append(oim->oim_list, msgid);
+			msn_oim_post_single_get_msg(oim, msgid);
+			msgid = NULL;
+		}
 
 		g_free(passport);
 		g_free(msgid);