diff src/protocols/msn/msn.c @ 13104:e1e5462b7d81

[gaim-migrate @ 15466] Rework lots of date parsing. I either introduced a whole lot of bugs, or I've made sure all dates are localized properly now. Only time will tell which it is... ;) committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 02 Feb 2006 19:50:51 +0000
parents 72300c551dc2
children fcde3faa1f57
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Thu Feb 02 19:39:12 2006 +0000
+++ b/src/protocols/msn/msn.c	Thu Feb 02 19:50:51 2006 +0000
@@ -1422,6 +1422,15 @@
 
 #endif
 
+static char *msn_info_date_reformat(const char *field, size_t len)
+{
+	char *tmp = g_strndup(field, len);
+	time_t t = gaim_str_to_time(tmp, FALSE);
+
+	g_free(tmp);
+	return g_strdup(gaim_date_format_short(localtime(&t)));
+}
+
 static void
 msn_got_info(void *data, const char *url_text, size_t len)
 {
@@ -1512,14 +1521,14 @@
 
 	/* Extract their Name and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
-			"\nName\n", 0, "\t", 0, "Undisclosed", _("Name"), 0, NULL);
+			"\nName\n", 0, "\t", 0, "Undisclosed", _("Name"), 0, NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
 
 	/* Extract their Age and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
-			"\tAge\n", 0, "\n", 0, "Undisclosed", _("Age"), 0, NULL);
+			"\tAge\n", 0, "\n", 0, "Undisclosed", _("Age"), 0, NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
@@ -1527,7 +1536,7 @@
 	/* Extract their Gender and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			"\nGender\n", 0, "\t", 0, "Undisclosed", _("Gender"), 0,
-			NULL);
+			NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
@@ -1535,7 +1544,7 @@
 	/* Extract their MaritalStatus and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			"\tMarital Status\n", 0, "\n", 0, "Undisclosed",
-			_("Marital Status"), 0, NULL);
+			_("Marital Status"), 0, NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
@@ -1543,7 +1552,7 @@
 	/* Extract their Location and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			"\nLocation\n", 0, "\n", 0, "Undisclosed", _("Location"), 0,
-			NULL);
+			NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
@@ -1551,7 +1560,7 @@
 	/* Extract their Occupation and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			" Occupation\n", 6, "\n", 0, "Undisclosed", _("Occupation"),
-			0, NULL);
+			0, NULL, NULL);
 
 	if (found)
 		has_info = TRUE;
@@ -1567,20 +1576,20 @@
 	/* Check if they have A Little About Me */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			" A Little About Me \n\n", 0, "Favorite Things", '\n', NULL,
-			_("A Little About Me"), 0, NULL);
+			_("A Little About Me"), 0, NULL, NULL);
 
 	if (!found)
 	{
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" A Little About Me \n\n", 0, "Hobbies and Interests", '\n',
-				NULL, _("A Little About Me"), 0, NULL);
+				NULL, _("A Little About Me"), 0, NULL, NULL);
 	}
 
 	if (!found)
 	{
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL,
-				_("A Little About Me"), 0, NULL);
+				_("A Little About Me"), 0, NULL, NULL);
 	}
 
 	if (!found)
@@ -1588,14 +1597,14 @@
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" A Little About Me \n\n", 0, "My Homepage \n\nTake a look",
 				'\n',
-				NULL, _("A Little About Me"), 0, NULL);
+				NULL, _("A Little About Me"), 0, NULL, NULL);
 	}
 
 	if (!found)
 	{
 		gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" A Little About Me \n\n", 0, "last updated", '\n', NULL,
-				_("A Little About Me"), 0, NULL);
+				_("A Little About Me"), 0, NULL, NULL);
 	}
 
 	if (found)
@@ -1604,27 +1613,27 @@
 	/* Check if they have Favorite Things */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			" Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL,
-			_("Favorite Things"), 0, NULL);
+			_("Favorite Things"), 0, NULL, NULL);
 
 	if (!found)
 	{
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL,
-				_("Favorite Things"), 0, NULL);
+				_("Favorite Things"), 0, NULL, NULL);
 	}
 
 	if (!found)
 	{
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n',
-				NULL, _("Favorite Things"), 0, NULL);
+				NULL, _("Favorite Things"), 0, NULL, NULL);
 	}
 
 	if (!found)
 	{
 		gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" Favorite Things \n\n", 0, "last updated", '\n', NULL,
-				_("Favorite Things"), 0, NULL);
+				_("Favorite Things"), 0, NULL, NULL);
 	}
 
 	if (found)
@@ -1633,20 +1642,20 @@
 	/* Check if they have Hobbies and Interests */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			" Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL,
-			_("Hobbies and Interests"), 0, NULL);
+			_("Hobbies and Interests"), 0, NULL, NULL);
 
 	if (!found)
 	{
 		found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look",
-				'\n', NULL, _("Hobbies and Interests"), 0, NULL);
+				'\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL);
 	}
 
 	if (!found)
 	{
 		gaim_markup_extract_info_field(stripped, stripped_len, s,
 				" Hobbies and Interests \n\n", 0, "last updated", '\n', NULL,
-				_("Hobbies and Interests"), 0, NULL);
+				_("Hobbies and Interests"), 0, NULL, NULL);
 	}
 
 	if (found)
@@ -1655,13 +1664,13 @@
 	/* Check if they have Favorite Quote */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			"Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL,
-			_("Favorite Quote"), 0, NULL);
+			_("Favorite Quote"), 0, NULL, NULL);
 
 	if (!found)
 	{
 		gaim_markup_extract_info_field(stripped, stripped_len, s,
 				"Favorite Quote \n\n", 0, "last updated", '\n', NULL,
-				_("Favorite Quote"), 0, NULL);
+				_("Favorite Quote"), 0, NULL, NULL);
 	}
 
 	if (found)
@@ -1670,7 +1679,7 @@
 	/* Extract the last updated date and put it in */
 	found = gaim_markup_extract_info_field(stripped, stripped_len, s,
 			" last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0,
-			NULL);
+			NULL, msn_info_date_reformat);
 
 	if (found)
 		has_info = TRUE;