1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Free pref strings

This commit is contained in:
James Booth 2015-11-21 21:19:28 +00:00
parent 4b022687fa
commit b73ff08a72
3 changed files with 31 additions and 10 deletions

View File

@ -3848,7 +3848,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
{ {
if (g_strcmp0(args[0], "lastactivity") == 0) { if (g_strcmp0(args[0], "lastactivity") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("Last activity time format: '%s'.", prefs_get_string(PREF_TIME_LASTACTIVITY)); char *format = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Last activity time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]); prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
@ -3865,7 +3867,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "statusbar") == 0) { } else if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("Status bar time format: '%s'.", prefs_get_string(PREF_TIME_STATUSBAR)); char *format = prefs_get_string(PREF_TIME_STATUSBAR);
cons_show("Status bar time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_STATUSBAR, args[2]); prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
@ -3883,7 +3887,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "console") == 0) { } else if (g_strcmp0(args[0], "console") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("Console time format: '%s'.", prefs_get_string(PREF_TIME_CONSOLE)); char *format = prefs_get_string(PREF_TIME_CONSOLE);
cons_show("Console time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONSOLE, args[2]); prefs_set_string(PREF_TIME_CONSOLE, args[2]);
@ -3901,7 +3907,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "chat") == 0) { } else if (g_strcmp0(args[0], "chat") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("Chat time format: '%s'.", prefs_get_string(PREF_TIME_CHAT)); char *format = prefs_get_string(PREF_TIME_CHAT);
cons_show("Chat time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CHAT, args[2]); prefs_set_string(PREF_TIME_CHAT, args[2]);
@ -3919,7 +3927,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "muc") == 0) { } else if (g_strcmp0(args[0], "muc") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("MUC time format: '%s'.", prefs_get_string(PREF_TIME_MUC)); char *format = prefs_get_string(PREF_TIME_MUC);
cons_show("MUC time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUC, args[2]); prefs_set_string(PREF_TIME_MUC, args[2]);
@ -3937,7 +3947,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "mucconfig") == 0) { } else if (g_strcmp0(args[0], "mucconfig") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("MUC config time format: '%s'.", prefs_get_string(PREF_TIME_MUCCONFIG)); char *format = prefs_get_string(PREF_TIME_MUCCONFIG);
cons_show("MUC config time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUCCONFIG, args[2]); prefs_set_string(PREF_TIME_MUCCONFIG, args[2]);
@ -3955,7 +3967,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "private") == 0) { } else if (g_strcmp0(args[0], "private") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("Private chat time format: '%s'.", prefs_get_string(PREF_TIME_PRIVATE)); char *format = prefs_get_string(PREF_TIME_PRIVATE);
cons_show("Private chat time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_PRIVATE, args[2]); prefs_set_string(PREF_TIME_PRIVATE, args[2]);
@ -3973,7 +3987,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
} }
} else if (g_strcmp0(args[0], "xml") == 0) { } else if (g_strcmp0(args[0], "xml") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
cons_show("XML Console time format: '%s'.", prefs_get_string(PREF_TIME_XMLCONSOLE)); char *format = prefs_get_string(PREF_TIME_XMLCONSOLE);
cons_show("XML Console time format: '%s'.", format);
prefs_free_string(format);
return TRUE; return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) { } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]); prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]);

View File

@ -53,6 +53,7 @@ _rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, co
char *by = prefs_get_string(PREF_ROSTER_BY); char *by = prefs_get_string(PREF_ROSTER_BY);
gboolean by_presence = g_strcmp0(by, "presence") == 0; gboolean by_presence = g_strcmp0(by, "presence") == 0;
prefs_free_string(by);
// show only status when grouped by presence // show only status when grouped by presence
if (by_presence) { if (by_presence) {
@ -207,6 +208,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
} else { } else {
contacts = roster_get_group(group, ROSTER_ORD_NAME, offline); contacts = roster_get_group(group, ROSTER_ORD_NAME, offline);
} }
prefs_free_string(order);
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) { if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@ -245,6 +247,7 @@ _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
} else { } else {
contacts = roster_get_nogroup(ROSTER_ORD_NAME, offline); contacts = roster_get_nogroup(ROSTER_ORD_NAME, offline);
} }
prefs_free_string(order);
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) { if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@ -280,7 +283,7 @@ rosterwin_roster(void)
ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK); assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
char *by = prefs_get_string(PREF_ROSTER_BY); char *by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) { if (g_strcmp0(by, "presence") == 0) {
werase(layout->subwin); werase(layout->subwin);
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat"); _rosterwin_contacts_by_presence(layout, "chat", "Available for chat");
@ -311,6 +314,7 @@ rosterwin_roster(void)
} else { } else {
contacts = roster_get_contacts(ROSTER_ORD_NAME, offline); contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
} }
prefs_free_string(order);
werase(layout->subwin); werase(layout->subwin);
@ -338,6 +342,6 @@ rosterwin_roster(void)
} }
g_slist_free(contacts); g_slist_free(contacts);
} }
free(by); prefs_free_string(by);
} }
} }

View File

@ -496,6 +496,7 @@ _jabber_connect(const char *const fulljid, const char *const passwd, const char
if (cert_path) { if (cert_path) {
xmpp_conn_tlscert_path(jabber_conn.conn, cert_path); xmpp_conn_tlscert_path(jabber_conn.conn, cert_path);
} }
prefs_free_string(cert_path);
#endif #endif
#ifdef HAVE_LIBMESODE #ifdef HAVE_LIBMESODE