pidgin/pidgin

Remove PURPLE_NO_TZ_OFF

18 months ago, Elliott Sales de Andrade
5d2bc2736da2
Parents 4a51008d3f64
Children 6b1dc67b861d
Remove PURPLE_NO_TZ_OFF

There is no `purple_str_to_time` any more, and Jabber can use a NULL pointer
instead for the same meaning.

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/1870/
--- 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_free(jbr->client.os);
+ g_clear_pointer(&jbr->tz_off, g_time_zone_unref);
g_free(jbr);
}
@@ -218,7 +219,6 @@
jbr->jb = jb;
jbr->name = g_strdup(resource);
jbr->capabilities = JABBER_CAP_NONE;
- jbr->tz_off = PURPLE_NO_TZ_OFF;
}
jbr->priority = priority;
jbr->state = state;
@@ -727,14 +727,11 @@
}
}
- if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) {
+ if (jbr && jbr->tz_off != NULL) {
GDateTime *dt = NULL;
- GTimeZone *tz = NULL;
char *timestamp = NULL;
- tz = g_time_zone_new_offset(jbr->tz_off);
- dt = g_date_time_new_now(tz);
- g_time_zone_unref(tz);
+ dt = g_date_time_new_now(jbr->tz_off);
timestamp = g_date_time_format(dt, "%X %:z");
g_date_time_unref(dt);
@@ -1395,15 +1392,20 @@
char *c = tzo_data;
int hours, minutes;
if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') {
- jbr->tz_off = 0;
+ jbr->tz_off = g_time_zone_new_offset(0);
} else {
gboolean offset_positive = (tzo_data[0] == '+');
/* [+-]HH:MM */
if (((*c == '+' || *c == '-') && (c = c + 1)) &&
- sscanf(c, "%02d:%02d", &hours, &minutes) == 2) {
- jbr->tz_off = 60*60*hours + 60*minutes;
- if (!offset_positive)
- jbr->tz_off *= -1;
+ sscanf(c, "%02d:%02d", &hours, &minutes) == 2)
+ {
+ gint32 tz_off = 60*60*hours + 60*minutes;
+ if (!offset_positive) {
+ tz_off *= -1;
+ }
+
+ jbr->tz_off = g_time_zone_new_offset(tz_off);
+
} else {
purple_debug_info("jabber", "Ignoring malformed timezone %s",
tzo_data);
@@ -1504,7 +1506,7 @@
jabber_iq_send(iq);
}
- if (jbr->tz_off == PURPLE_NO_TZ_OFF &&
+ if (jbr->tz_off == NULL &&
(!jbr->caps.info ||
jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) {
PurpleXmlNode *child;
--- 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 @@
char *name;
char *os;
} client;
- /* tz_off == PURPLE_NO_TZ_OFF when unset */
- long tz_off;
+ GTimeZone *tz_off;
struct {
JabberCapsClientInfo *info;
GList *exts;
--- 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 */
-/**************************************************************************/
-
-/**
- * PURPLE_NO_TZ_OFF:
- *
- * 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 */
/**************************************************************************/