mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Free timestamps and carbons stanzas
This commit is contained in:
parent
d944e8252e
commit
783342a48c
@ -907,12 +907,17 @@ void
|
|||||||
win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp,
|
win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp,
|
||||||
int flags, theme_item_t theme_item, const char * const from, const char * const message)
|
int flags, theme_item_t theme_item, const char * const from, const char * const message)
|
||||||
{
|
{
|
||||||
if (timestamp == NULL) timestamp = g_date_time_new_now_local();
|
if (timestamp == NULL) {
|
||||||
|
timestamp = g_date_time_new_now_local();
|
||||||
|
} else {
|
||||||
|
g_date_time_ref(timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
buffer_push(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL);
|
buffer_push(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL);
|
||||||
_win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL);
|
_win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, message, NULL);
|
||||||
// TODO: cross-reference.. this should be replaced by a real event-based system
|
// TODO: cross-reference.. this should be replaced by a real event-based system
|
||||||
ui_input_nonblocking(TRUE);
|
ui_input_nonblocking(TRUE);
|
||||||
|
g_date_time_unref(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -975,7 +980,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
|
|||||||
gchar *date_fmt = NULL;
|
gchar *date_fmt = NULL;
|
||||||
char *time_pref = prefs_get_string(PREF_TIME);
|
char *time_pref = prefs_get_string(PREF_TIME);
|
||||||
date_fmt = g_date_time_format(time, time_pref);
|
date_fmt = g_date_time_format(time, time_pref);
|
||||||
free(time_pref);
|
prefs_free_string(time_pref);
|
||||||
assert(date_fmt != NULL);
|
assert(date_fmt != NULL);
|
||||||
|
|
||||||
if(strlen(date_fmt) != 0){
|
if(strlen(date_fmt) != 0){
|
||||||
@ -992,7 +997,6 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
|
|||||||
wattroff(window->layout->win, theme_attrs(THEME_TIME));
|
wattroff(window->layout->win, theme_attrs(THEME_TIME));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free(date_fmt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(from) > 0) {
|
if (strlen(from) > 0) {
|
||||||
@ -1049,6 +1053,8 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
|
|||||||
wattroff(window->layout->win, theme_attrs(theme_item));
|
wattroff(window->layout->win, theme_attrs(theme_item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free(date_fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -213,6 +213,7 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){
|
|||||||
xmpp_stanza_set_ns(carbons_enable, STANZA_NS_CARBONS);
|
xmpp_stanza_set_ns(carbons_enable, STANZA_NS_CARBONS);
|
||||||
|
|
||||||
xmpp_stanza_add_child(iq, carbons_enable);
|
xmpp_stanza_add_child(iq, carbons_enable);
|
||||||
|
xmpp_stanza_release(carbons_enable);
|
||||||
|
|
||||||
return iq;
|
return iq;
|
||||||
}
|
}
|
||||||
@ -232,6 +233,7 @@ stanza_disable_carbons(xmpp_ctx_t *ctx){
|
|||||||
xmpp_stanza_set_ns(carbons_disable, STANZA_NS_CARBONS);
|
xmpp_stanza_set_ns(carbons_disable, STANZA_NS_CARBONS);
|
||||||
|
|
||||||
xmpp_stanza_add_child(iq, carbons_disable);
|
xmpp_stanza_add_child(iq, carbons_disable);
|
||||||
|
xmpp_stanza_release(carbons_disable);
|
||||||
|
|
||||||
return iq;
|
return iq;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user