--- a/libpurple/protocols/jabber/buddy.c Fri Sep 30 03:09:55 2022 -0500
+++ b/libpurple/protocols/jabber/buddy.c Fri Sep 30 03:11:02 2022 -0500
@@ -66,6 +66,7 @@
g_free(jbr->client.name);
g_free(jbr->client.version);
+ g_clear_pointer(&jbr->tz_off, g_time_zone_unref); @@ -218,7 +219,6 @@
jbr->name = g_strdup(resource);
jbr->capabilities = JABBER_CAP_NONE;
- jbr->tz_off = PURPLE_NO_TZ_OFF;
jbr->priority = priority;
@@ -727,14 +727,11 @@
- if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) {
+ if (jbr && jbr->tz_off != NULL) {
- tz = g_time_zone_new_offset(jbr->tz_off);
- dt = g_date_time_new_now(tz);
+ dt = g_date_time_new_now(jbr->tz_off); timestamp = g_date_time_format(dt, "%X %:z");
@@ -1395,15 +1392,20 @@
if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') {
+ jbr->tz_off = g_time_zone_new_offset(0); gboolean offset_positive = (tzo_data[0] == '+');
if (((*c == '+' || *c == '-') && (c = c + 1)) &&
- sscanf(c, "%02d:%02d", &hours, &minutes) == 2) {
- jbr->tz_off = 60*60*hours + 60*minutes;
+ sscanf(c, "%02d:%02d", &hours, &minutes) == 2) + gint32 tz_off = 60*60*hours + 60*minutes; + if (!offset_positive) { + jbr->tz_off = g_time_zone_new_offset(tz_off); purple_debug_info("jabber", "Ignoring malformed timezone %s",
@@ -1504,7 +1506,7 @@
- if (jbr->tz_off == PURPLE_NO_TZ_OFF &&
+ if (jbr->tz_off == NULL && jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) {
--- a/libpurple/protocols/jabber/buddy.h Fri Sep 30 03:09:55 2022 -0500
+++ b/libpurple/protocols/jabber/buddy.h Fri Sep 30 03:11:02 2022 -0500
@@ -77,8 +77,7 @@
- /* tz_off == PURPLE_NO_TZ_OFF when unset */
JabberCapsClientInfo *info;
--- a/libpurple/util.h Fri Sep 30 03:09:55 2022 -0500
+++ b/libpurple/util.h Fri Sep 30 03:11:02 2022 -0500
@@ -83,18 +83,6 @@
void purple_util_uninit(void);
/**************************************************************************/
-/* Date/Time Functions */
-/**************************************************************************/
- * Used by purple_str_to_time to indicate no timezone offset was
- * specified in the timestamp string.
-#define PURPLE_NO_TZ_OFF -500000
-/**************************************************************************/
/* Path/Filename Functions */
/**************************************************************************/