--- a/libpurple/log.c Wed Nov 06 04:54:32 2019 +0000
+++ b/libpurple/log.c Sat Nov 09 22:05:20 2019 +0300
@@ -1704,31 +1704,7 @@
purple_debug_warning("log", "invalid date format\n");
/* Ugly hack, in case current locale is not English */
- if (purple_strequal(month_str, "Jan")) {
- } else if (purple_strequal(month_str, "Feb")) {
- } else if (purple_strequal(month_str, "Mar")) {
- } else if (purple_strequal(month_str, "Apr")) {
- } else if (purple_strequal(month_str, "May")) {
- } else if (purple_strequal(month_str, "Jun")) {
- } else if (purple_strequal(month_str, "Jul")) {
- } else if (purple_strequal(month_str, "Aug")) {
- } else if (purple_strequal(month_str, "Sep")) {
- } else if (purple_strequal(month_str, "Oct")) {
- } else if (purple_strequal(month_str, "Nov")) {
- } else if (purple_strequal(month_str, "Dec")) {
+ month = purple_get_month(month_str); g_date_time_unref(lasttime);
lasttime = g_date_time_new_local(year, month, day,
--- a/libpurple/plugins/log_reader.c Wed Nov 06 04:54:32 2019 +0000
+++ b/libpurple/plugins/log_reader.c Sat Nov 09 22:05:20 2019 +0300
@@ -32,19 +32,6 @@
-/* Some common functions. */
-static int get_month(const char *month)
- const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
- for (iter = 0; months[iter]; iter++) {
- if (purple_strequal(month, months[iter]))
/*****************************************************************************
@@ -1222,7 +1209,7 @@
- month = get_month(month_str);
+ month = purple_get_month(month_str); struct trillian_logger_data, 1);
@@ -2026,7 +2013,7 @@
"Error parsing start date for %s\n",
- month = get_month(month_str);
+ month = purple_get_month(month_str); --- a/libpurple/util.c Wed Nov 06 04:54:32 2019 +0000
+++ b/libpurple/util.c Sat Nov 09 22:05:20 2019 +0300
@@ -561,6 +561,20 @@
+gint purple_get_month(const char *month_abbr) + const char *months[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + for (gint month = 0; months[month] != NULL; month++) { + if (purple_strequal(month_abbr, months[month])) { /**************************************************************************
**************************************************************************/
--- a/libpurple/util.h Wed Nov 06 04:54:32 2019 +0000
+++ b/libpurple/util.h Sat Nov 09 22:05:20 2019 +0300
@@ -314,6 +314,17 @@
GDateTime *purple_str_to_date_time(const char *timestamp, gboolean utc);
+ * @month_abbr: The 3-letter month abbreviation + * Get month number suitable for GDateTime. If @month_abbr is unknown, + * Returns: A month number or 0. +gint purple_get_month(const char *month_abbr); /**************************************************************************/
/**************************************************************************/