mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use reference counts for GDateTimes #516
This commit is contained in:
parent
dd206ef637
commit
d5f79c7b35
@ -87,7 +87,7 @@ buffer_push(ProfBuff buffer, const char show_char, GDateTime *time,
|
||||
e->show_char = show_char;
|
||||
e->flags = flags;
|
||||
e->theme_item = theme_item;
|
||||
e->time = time;
|
||||
e->time = g_date_time_ref(time);
|
||||
e->from = strdup(from);
|
||||
e->message = strdup(message);
|
||||
e->receipt = receipt;
|
||||
@ -136,4 +136,4 @@ _free_entry(ProfBuffEntry *entry)
|
||||
free(entry->receipt);
|
||||
}
|
||||
free(entry);
|
||||
}
|
||||
}
|
||||
|
@ -562,6 +562,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
|
||||
GDateTime *timestamp = stanza_get_delay(stanza);
|
||||
if (timestamp) {
|
||||
sv_ev_room_history(jid->barejid, jid->resourcepart, timestamp, message);
|
||||
g_date_time_unref(timestamp);
|
||||
} else {
|
||||
sv_ev_room_message(jid->barejid, jid->resourcepart, message);
|
||||
}
|
||||
@ -665,6 +666,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid)
|
||||
GDateTime *timestamp = stanza_get_delay(stanza);
|
||||
if (timestamp) {
|
||||
sv_ev_delayed_private_message(fulljid, message, timestamp);
|
||||
g_date_time_unref(timestamp);
|
||||
} else {
|
||||
sv_ev_incoming_private_message(fulljid, message);
|
||||
}
|
||||
@ -803,6 +805,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
|
||||
}
|
||||
}
|
||||
|
||||
if (timestamp) g_date_time_unref(timestamp);
|
||||
jid_destroy(jid);
|
||||
return 1;
|
||||
}
|
||||
|
@ -995,6 +995,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
|
||||
if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
|
||||
GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
|
||||
GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
|
||||
g_date_time_unref(utc_datetime);
|
||||
return local_datetime;
|
||||
}
|
||||
}
|
||||
@ -1010,6 +1011,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
|
||||
if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
|
||||
GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
|
||||
GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
|
||||
g_date_time_unref(utc_datetime);
|
||||
return local_datetime;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user