1
0
Fork 0

Cleanup `char*` to `auto_gchar gchar*` for `prefs_get_string`

Necessity explained in #1819
This commit is contained in:
John Hernandez 2023-06-13 22:01:08 +02:00
parent 1c102fec27
commit 4a70f5f513
19 changed files with 133 additions and 275 deletions

View File

@ -433,7 +433,7 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
}
char* user = args[0];
char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
auto_gchar gchar* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if (!user) {
if (def) {
user = def;
@ -447,7 +447,6 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
char* jid;
user = strdup(user);
g_free(def);
// connect with account
ProfAccount* account = accounts_get_account(user);
@ -568,7 +567,7 @@ cmd_account_remove(ProfWin* window, const char* const command, gchar** args)
return TRUE;
}
char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
auto_gchar gchar* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if (accounts_remove(account_name)) {
cons_show("Account %s removed.", account_name);
if (def && strcmp(def, account_name) == 0) {
@ -580,7 +579,6 @@ cmd_account_remove(ProfWin* window, const char* const command, gchar** args)
cons_show("Either the account does not exist, or an unknown error occurred.");
}
cons_show("");
g_free(def);
return TRUE;
}
@ -650,10 +648,9 @@ gboolean
cmd_account_default(ProfWin* window, const char* const command, gchar** args)
{
if (g_strv_length(args) == 1) {
char* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
auto_gchar gchar* def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if (def) {
cons_show("The default account is %s.", def);
free(def);
} else {
cons_show("No default account.");
}
@ -5417,9 +5414,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
{
if (g_strcmp0(args[0], "lastactivity") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_LASTACTIVITY);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Last activity time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
@ -5436,9 +5432,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_STATUSBAR);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_STATUSBAR);
cons_show("Status bar time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
@ -5456,9 +5451,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "console") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_CONSOLE);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_CONSOLE);
cons_show("Console time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONSOLE, args[2]);
@ -5476,9 +5470,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "chat") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_CHAT);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_CHAT);
cons_show("Chat time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CHAT, args[2]);
@ -5496,9 +5489,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "muc") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_MUC);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_MUC);
cons_show("MUC time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUC, args[2]);
@ -5516,9 +5508,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "config") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_CONFIG);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_CONFIG);
cons_show("config time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONFIG, args[2]);
@ -5536,9 +5527,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "private") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_PRIVATE);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_PRIVATE);
cons_show("Private chat time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_PRIVATE, args[2]);
@ -5556,9 +5546,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "xml") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_XMLCONSOLE);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_XMLCONSOLE);
cons_show("XML Console time format: '%s'.", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]);
@ -5614,9 +5603,8 @@ cmd_time(ProfWin* window, const char* const command, gchar** args)
}
} else if (g_strcmp0(args[0], "vcard") == 0) {
if (args[1] == NULL) {
char* format = prefs_get_string(PREF_TIME_VCARD);
auto_gchar gchar* format = prefs_get_string(PREF_TIME_VCARD);
cons_show("vCard time format: %s", format);
g_free(format);
return TRUE;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_VCARD, args[2]);
@ -8035,9 +8023,8 @@ cmd_otr_policy(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBOTR
if (args[1] == NULL) {
char* policy = prefs_get_string(PREF_OTR_POLICY);
auto_gchar gchar* policy = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy is now set to: %s", policy);
g_free(policy);
return TRUE;
}
@ -9229,9 +9216,8 @@ cmd_omemo_policy(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_OMEMO
if (args[1] == NULL) {
char* policy = prefs_get_string(PREF_OMEMO_POLICY);
auto_gchar gchar* policy = prefs_get_string(PREF_OMEMO_POLICY);
cons_show("OMEMO policy is now set to: %s", policy);
g_free(policy);
return TRUE;
}
@ -9341,17 +9327,15 @@ gboolean
cmd_stamp(ProfWin* window, const char* const command, gchar** args)
{
if (g_strv_length(args) == 0) {
char* def = prefs_get_string(PREF_OUTGOING_STAMP);
auto_gchar gchar* def = prefs_get_string(PREF_OUTGOING_STAMP);
if (def) {
cons_show("The outgoing stamp is: %s", def);
free(def);
} else {
cons_show("The default outgoing stamp is used.");
}
def = prefs_get_string(PREF_INCOMING_STAMP);
if (def) {
cons_show("The incoming stamp is: %s", def);
free(def);
} else {
cons_show("The default incoming stamp is used.");
}
@ -9410,7 +9394,7 @@ cmd_color(ProfWin* window, const char* const command, gchar** args)
cons_show("Consistent color generation for nicks set to: %s", args[0]);
char* theme = prefs_get_string(PREF_THEME);
auto_gchar gchar* theme = prefs_get_string(PREF_THEME);
if (theme) {
gboolean res = theme_load(theme, false);
@ -9419,8 +9403,6 @@ cmd_color(ProfWin* window, const char* const command, gchar** args)
} else {
theme_load("default", false);
}
g_free(theme);
}
return TRUE;

View File

@ -707,13 +707,12 @@ theme_hash_attrs(const char* str)
{
color_profile profile = COLOR_PROFILE_DEFAULT;
char* color_pref = prefs_get_string(PREF_COLOR_NICK);
auto_gchar gchar* color_pref = prefs_get_string(PREF_COLOR_NICK);
if (strcmp(color_pref, "redgreen") == 0) {
profile = COLOR_PROFILE_REDGREEN_BLINDNESS;
} else if (strcmp(color_pref, "blue") == 0) {
profile = COLOR_PROFILE_BLUE_BLINDNESS;
}
g_free(color_pref);
return COLOR_PAIR(color_pair_cache_hash_str(str, profile));
}

View File

@ -159,10 +159,9 @@ sv_ev_roster_received(void)
// Redraw the screen after entry of the PGP secret key, but not init
ProfWin* win = wins_get_current();
char* theme = prefs_get_string(PREF_THEME);
auto_gchar gchar* theme = prefs_get_string(PREF_THEME);
win_redraw(win);
theme_init(theme);
g_free(theme);
ui_resize();
ui_show_roster();
}
@ -903,12 +902,11 @@ sv_ev_room_occupant_offline(const char* const room, const char* const nick,
{
muc_roster_remove(room, nick);
char* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
auto_gchar gchar* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
ProfMucWin* mucwin = wins_get_muc(room);
if (mucwin && (g_strcmp0(muc_status_pref, "none") != 0)) {
mucwin_occupant_offline(mucwin, nick);
}
g_free(muc_status_pref);
Jid* jidp = jid_create_from_bare_and_resource(room, nick);
ProfPrivateWin* privwin = wins_get_private(jidp->fulljid);
@ -1124,12 +1122,11 @@ sv_ev_muc_occupant_online(const char* const room, const char* const nick, const
// joined room
if (!occupant) {
char* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
auto_gchar gchar* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
ProfMucWin* mucwin = wins_get_muc(room);
if (mucwin && g_strcmp0(muc_status_pref, "none") != 0) {
mucwin_occupant_online(mucwin, nick, role, affiliation, show, status);
}
g_free(muc_status_pref);
if (mucwin) {
Jid* jidp = jid_create_from_bare_and_resource(mucwin->roomjid, nick);
@ -1147,12 +1144,11 @@ sv_ev_muc_occupant_online(const char* const room, const char* const nick, const
// presence updated
if (updated) {
char* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
auto_gchar gchar* muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
ProfMucWin* mucwin = wins_get_muc(room);
if (mucwin && (g_strcmp0(muc_status_pref, "all") == 0)) {
mucwin_occupant_presence(mucwin, nick, show, status);
}
g_free(muc_status_pref);
occupantswin_occupants(room);
// presence unchanged, check for role/affiliation change
@ -1254,10 +1250,9 @@ sv_ev_lastactivity_response(const char* const from, const int seconds, const cha
GDateTime* now = g_date_time_new_now_local();
GDateTime* active = g_date_time_add_seconds(now, 0 - seconds);
gchar* date_fmt = NULL;
char* time_pref = prefs_get_string(PREF_TIME_LASTACTIVITY);
auto_gchar gchar* date_fmt = NULL;
auto_gchar gchar* time_pref = prefs_get_string(PREF_TIME_LASTACTIVITY);
date_fmt = g_date_time_format(active, time_pref);
g_free(time_pref);
assert(date_fmt != NULL);
// full jid - last activity
@ -1308,7 +1303,6 @@ sv_ev_lastactivity_response(const char* const from, const int seconds, const cha
g_date_time_unref(now);
g_date_time_unref(active);
g_free(date_fmt);
jid_destroy(jidp);
}

View File

@ -1469,7 +1469,7 @@ omemo_automatic_start(const char* const recipient)
}
} else {
// check global setting
char* pref_omemo_policy = prefs_get_string(PREF_OMEMO_POLICY);
auto_gchar gchar* pref_omemo_policy = prefs_get_string(PREF_OMEMO_POLICY);
// pref defaults to manual
policy = PROF_OMEMOPOLICY_AUTOMATIC;
@ -1479,8 +1479,6 @@ omemo_automatic_start(const char* const recipient)
} else if (strcmp(pref_omemo_policy, "always") == 0) {
policy = PROF_OMEMOPOLICY_ALWAYS;
}
g_free(pref_omemo_policy);
}
switch (policy) {

View File

@ -684,7 +684,7 @@ otr_get_policy(const char* const recipient)
account_free(account);
// check global setting
char* pref_otr_policy = prefs_get_string(PREF_OTR_POLICY);
auto_gchar gchar* pref_otr_policy = prefs_get_string(PREF_OTR_POLICY);
// pref defaults to manual
prof_otrpolicy_t result = PROF_OTRPOLICY_MANUAL;
@ -695,8 +695,6 @@ otr_get_policy(const char* const recipient)
result = PROF_OTRPOLICY_ALWAYS;
}
g_free(pref_otr_policy);
return result;
}

View File

@ -131,7 +131,7 @@ http_file_get(void* userdata)
goto out;
}
char* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
gchar* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
gchar* cafile = cafile_get_name();
ProfAccount* account = accounts_get_account(session_get_account_name());
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;

View File

@ -184,7 +184,7 @@ http_file_put(void* userdata)
win_print_http_transfer(upload->window, msg, upload->put_url);
g_free(msg);
char* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
auto_gchar gchar* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
gchar* cafile = cafile_get_name();
ProfAccount* account = accounts_get_account(session_get_account_name());
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
@ -301,7 +301,6 @@ http_file_put(void* userdata)
pthread_mutex_lock(&lock);
g_free(cafile);
g_free(cert_path);
if (err) {
gchar* msg;

View File

@ -328,7 +328,7 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
ProfWin* window = (ProfWin*)chatwin;
int num = wins_get_num(window);
char* display_name;
auto_gchar gchar* display_name;
char* mybarejid = connection_get_barejid();
if (g_strcmp0(mybarejid, message->from_jid->barejid) == 0) {
display_name = strdup("me");
@ -416,8 +416,6 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
notify_message(display_name, num, message->plain);
}
free(display_name);
plugins_post_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, message->plain);
free(message->plain);

View File

@ -324,7 +324,7 @@ cons_show_incoming_room_message(const char* const nick, const char* const room,
ui_index = 0;
}
char* muc_show = prefs_get_string(PREF_CONSOLE_MUC);
auto_gchar gchar* muc_show = prefs_get_string(PREF_CONSOLE_MUC);
// 'mention'
if (g_strcmp0(muc_show, "mention") == 0) {
@ -348,8 +348,6 @@ cons_show_incoming_room_message(const char* const nick, const char* const room,
cons_alert(window);
}
}
free(muc_show);
}
void
@ -362,13 +360,11 @@ cons_show_incoming_message(const char* const short_from, const int win_index, in
ui_index = 0;
}
char* chat_show = prefs_get_string(PREF_CONSOLE_CHAT);
auto_gchar gchar* chat_show = prefs_get_string(PREF_CONSOLE_CHAT);
if (g_strcmp0(chat_show, "all") == 0 || ((g_strcmp0(chat_show, "first") == 0) && unread == 0)) {
win_println(console, THEME_INCOMING, "-", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert(window);
}
g_free(chat_show);
}
void
@ -381,13 +377,11 @@ cons_show_incoming_private_message(const char* const nick, const char* const roo
ui_index = 0;
}
char* priv_show = prefs_get_string(PREF_CONSOLE_PRIVATE);
auto_gchar gchar* priv_show = prefs_get_string(PREF_CONSOLE_PRIVATE);
if (g_strcmp0(priv_show, "all") == 0 || ((g_strcmp0(priv_show, "first") == 0) && (unread == 0))) {
win_println(console, THEME_INCOMING, "-", "<< private message: %s in %s (win %d)", nick, room, ui_index);
cons_alert(window);
}
free(priv_show);
}
static void
@ -1236,13 +1230,12 @@ cons_show_aliases(GList* aliases)
void
cons_theme_setting(void)
{
char* theme = prefs_get_string(PREF_THEME);
auto_gchar gchar* theme = prefs_get_string(PREF_THEME);
if (theme == NULL) {
cons_show("Theme (/theme) : default");
} else {
cons_show("Theme (/theme) : %s", theme);
}
g_free(theme);
}
void
@ -1330,17 +1323,14 @@ cons_titlebar_setting(void)
void
cons_console_setting(void)
{
char* chatsetting = prefs_get_string(PREF_CONSOLE_CHAT);
auto_gchar gchar* chatsetting = prefs_get_string(PREF_CONSOLE_CHAT);
cons_show("Console chat messages (/console) : %s", chatsetting);
g_free(chatsetting);
char* mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
auto_gchar gchar* mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
cons_show("Console MUC messages (/console) : %s", mucsetting);
g_free(mucsetting);
char* privsetting = prefs_get_string(PREF_CONSOLE_PRIVATE);
auto_gchar gchar* privsetting = prefs_get_string(PREF_CONSOLE_PRIVATE);
cons_show("Console private messages (/console) : %s", privsetting);
g_free(privsetting);
}
void
@ -1351,17 +1341,13 @@ cons_presence_setting(void)
else
cons_show("Titlebar presence (/presence) : OFF");
char* console = prefs_get_string(PREF_STATUSES_CONSOLE);
char* chat = prefs_get_string(PREF_STATUSES_CHAT);
char* room = prefs_get_string(PREF_STATUSES_MUC);
auto_gchar gchar* console = prefs_get_string(PREF_STATUSES_CONSOLE);
auto_gchar gchar* chat = prefs_get_string(PREF_STATUSES_CHAT);
auto_gchar gchar* room = prefs_get_string(PREF_STATUSES_MUC);
cons_show("Console presence (/presence) : %s", console);
cons_show("Chat presence (/presence) : %s", chat);
cons_show("Room presence (/presence) : %s", room);
g_free(console);
g_free(chat);
g_free(room);
}
void
@ -1462,74 +1448,63 @@ cons_rooms_cache_setting(void)
void
cons_autoconnect_setting(void)
{
char* pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT);
auto_gchar gchar* pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT);
if (pref_connect_account)
cons_show("Autoconnect (/autoconnect) : %s", pref_connect_account);
else
cons_show("Autoconnect (/autoconnect) : OFF");
g_free(pref_connect_account);
}
void
cons_time_setting(void)
{
char* pref_time_console = prefs_get_string(PREF_TIME_CONSOLE);
auto_gchar gchar* pref_time_console = prefs_get_string(PREF_TIME_CONSOLE);
if (g_strcmp0(pref_time_console, "off") == 0)
cons_show("Time console (/time) : OFF");
else
cons_show("Time console (/time) : %s", pref_time_console);
g_free(pref_time_console);
char* pref_time_chat = prefs_get_string(PREF_TIME_CHAT);
auto_gchar gchar* pref_time_chat = prefs_get_string(PREF_TIME_CHAT);
if (g_strcmp0(pref_time_chat, "off") == 0)
cons_show("Time chat (/time) : OFF");
else
cons_show("Time chat (/time) : %s", pref_time_chat);
g_free(pref_time_chat);
char* pref_time_muc = prefs_get_string(PREF_TIME_MUC);
auto_gchar gchar* pref_time_muc = prefs_get_string(PREF_TIME_MUC);
if (g_strcmp0(pref_time_muc, "off") == 0)
cons_show("Time MUC (/time) : OFF");
else
cons_show("Time MUC (/time) : %s", pref_time_muc);
g_free(pref_time_muc);
char* pref_time_conf = prefs_get_string(PREF_TIME_CONFIG);
auto_gchar gchar* pref_time_conf = prefs_get_string(PREF_TIME_CONFIG);
if (g_strcmp0(pref_time_conf, "off") == 0)
cons_show("Time config (/time) : OFF");
else
cons_show("Time config (/time) : %s", pref_time_conf);
g_free(pref_time_conf);
char* pref_time_private = prefs_get_string(PREF_TIME_PRIVATE);
auto_gchar gchar* pref_time_private = prefs_get_string(PREF_TIME_PRIVATE);
if (g_strcmp0(pref_time_private, "off") == 0)
cons_show("Time private (/time) : OFF");
else
cons_show("Time private (/time) : %s", pref_time_private);
g_free(pref_time_private);
char* pref_time_xml = prefs_get_string(PREF_TIME_XMLCONSOLE);
auto_gchar gchar* pref_time_xml = prefs_get_string(PREF_TIME_XMLCONSOLE);
if (g_strcmp0(pref_time_xml, "off") == 0)
cons_show("Time XML Console (/time) : OFF");
else
cons_show("Time XML Console (/time) : %s", pref_time_xml);
g_free(pref_time_xml);
char* pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
auto_gchar gchar* pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(pref_time_statusbar, "off") == 0)
cons_show("Time statusbar (/time) : OFF");
else
cons_show("Time statusbar (/time) : %s", pref_time_statusbar);
g_free(pref_time_statusbar);
char* pref_time_lastactivity = prefs_get_string(PREF_TIME_LASTACTIVITY);
auto_gchar gchar* pref_time_lastactivity = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Time last activity (/time) : %s", pref_time_lastactivity);
g_free(pref_time_lastactivity);
char* pref_time_vcard = prefs_get_string(PREF_TIME_VCARD);
auto_gchar gchar* pref_time_vcard = prefs_get_string(PREF_TIME_VCARD);
cons_show("Time vCard (/time) : %s", pref_time_vcard);
g_free(pref_time_vcard);
}
void
@ -1666,28 +1641,25 @@ cons_roster_setting(void)
else
cons_show("Roster unsubscribed (/roster) : hide");
char* count = prefs_get_string(PREF_ROSTER_COUNT);
auto_gchar gchar* count = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(count, "off") == 0) {
cons_show("Roster count (/roster) : OFF");
} else {
cons_show("Roster count (/roster) : %s", count);
}
g_free(count);
if (prefs_get_boolean(PREF_ROSTER_COUNT_ZERO))
cons_show("Roster count zero (/roster) : ON");
else
cons_show("Roster count zero (/roster) : OFF");
char* by = prefs_get_string(PREF_ROSTER_BY);
auto_gchar gchar* by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by);
g_free(by);
char* order = prefs_get_string(PREF_ROSTER_ORDER);
auto_gchar gchar* order = prefs_get_string(PREF_ROSTER_ORDER);
cons_show("Roster order (/roster) : %s", order);
g_free(order);
char* unread = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unread = prefs_get_string(PREF_ROSTER_UNREAD);
if (g_strcmp0(unread, "before") == 0) {
cons_show("Roster unread (/roster) : before");
} else if (g_strcmp0(unread, "after") == 0) {
@ -1695,14 +1667,13 @@ cons_roster_setting(void)
} else {
cons_show("Roster unread (/roster) : OFF");
}
g_free(unread);
if (prefs_get_boolean(PREF_ROSTER_ROOMS))
cons_show("Roster rooms (/roster) : show");
else
cons_show("Roster rooms (/roster) : hide");
char* priv = prefs_get_string(PREF_ROSTER_PRIVATE);
auto_gchar gchar* priv = prefs_get_string(PREF_ROSTER_PRIVATE);
if (g_strcmp0(priv, "room") == 0) {
cons_show("Roster private (/roster) : room");
} else if (g_strcmp0(priv, "group") == 0) {
@ -1710,25 +1681,20 @@ cons_roster_setting(void)
} else {
cons_show("Roster private (/roster) : OFF");
}
g_free(priv);
char* rooms_pos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
auto_gchar gchar* rooms_pos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
cons_show("Roster rooms position (/roster) : %s", rooms_pos);
g_free(rooms_pos);
char* rooms_by = prefs_get_string(PREF_ROSTER_ROOMS_BY);
auto_gchar gchar* rooms_by = prefs_get_string(PREF_ROSTER_ROOMS_BY);
cons_show("Roster rooms by (/roster) : %s", rooms_by);
g_free(rooms_by);
char* rooms_use = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
auto_gchar gchar* rooms_use = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
cons_show("Roster rooms use (/roster) : %s", rooms_use);
g_free(rooms_use);
char* rooms_order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER);
auto_gchar gchar* rooms_order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER);
cons_show("Roster rooms order (/roster) : %s", rooms_order);
g_free(rooms_order);
char* roomsunread = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
auto_gchar gchar* roomsunread = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
if (g_strcmp0(roomsunread, "before") == 0) {
cons_show("Roster rooms unread (/roster) : before");
} else if (g_strcmp0(roomsunread, "after") == 0) {
@ -1736,7 +1702,6 @@ cons_roster_setting(void)
} else {
cons_show("Roster rooms unread (/roster) : OFF");
}
g_free(roomsunread);
int size = prefs_get_roster_size();
cons_show("Roster size (/roster) : %d", size);
@ -2089,13 +2054,12 @@ cons_show_log_prefs(void)
void
cons_autoaway_setting(void)
{
char* pref_autoaway_mode = prefs_get_string(PREF_AUTOAWAY_MODE);
auto_gchar gchar* pref_autoaway_mode = prefs_get_string(PREF_AUTOAWAY_MODE);
if (strcmp(pref_autoaway_mode, "off") == 0) {
cons_show("Autoaway (/autoaway mode) : OFF");
} else {
cons_show("Autoaway (/autoaway mode) : %s", pref_autoaway_mode);
}
g_free(pref_autoaway_mode);
int away_time = prefs_get_autoaway_time();
if (away_time == 1) {
@ -2113,21 +2077,19 @@ cons_autoaway_setting(void)
cons_show("Autoaway xa minutes (/autoaway time) : %d minutes", xa_time);
}
char* pref_autoaway_message = prefs_get_string(PREF_AUTOAWAY_MESSAGE);
auto_gchar gchar* pref_autoaway_message = prefs_get_string(PREF_AUTOAWAY_MESSAGE);
if ((pref_autoaway_message == NULL) || (strcmp(pref_autoaway_message, "") == 0)) {
cons_show("Autoaway away message (/autoaway message) : OFF");
} else {
cons_show("Autoaway away message (/autoaway message) : \"%s\"", pref_autoaway_message);
}
g_free(pref_autoaway_message);
char* pref_autoxa_message = prefs_get_string(PREF_AUTOXA_MESSAGE);
auto_gchar gchar* pref_autoxa_message = prefs_get_string(PREF_AUTOXA_MESSAGE);
if ((pref_autoxa_message == NULL) || (strcmp(pref_autoxa_message, "") == 0)) {
cons_show("Autoaway xa message (/autoaway message) : OFF");
} else {
cons_show("Autoaway xa message (/autoaway message) : \"%s\"", pref_autoxa_message);
}
g_free(pref_autoxa_message);
if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) {
cons_show("Autoaway check (/autoaway check) : ON");
@ -2190,7 +2152,7 @@ cons_autoping_setting(void)
void
cons_color_setting(void)
{
char* color_pref = prefs_get_string(PREF_COLOR_NICK);
auto_gchar gchar* color_pref = prefs_get_string(PREF_COLOR_NICK);
if (!color_pref) {
cons_show("Consistent color generation for nicks (/color) : OFF");
@ -2207,8 +2169,6 @@ cons_color_setting(void)
cons_show("Consistent color generation for nicks (/color) : OFF");
}
g_free(color_pref);
if (prefs_get_boolean(PREF_COLOR_NICK_OWN)) {
cons_show("Consistent color generation for own nick (/color own) : ON");
} else {
@ -2331,11 +2291,10 @@ cons_show_otr_prefs(void)
cons_show("OTR preferences:");
cons_show("");
char* policy_value = prefs_get_string(PREF_OTR_POLICY);
auto_gchar gchar* policy_value = prefs_get_string(PREF_OTR_POLICY);
cons_show("OTR policy (/otr policy) : %s", policy_value);
g_free(policy_value);
char* log_value = prefs_get_string(PREF_OTR_LOG);
auto_gchar gchar* log_value = prefs_get_string(PREF_OTR_LOG);
if (strcmp(log_value, "on") == 0) {
cons_show("OTR logging (/otr log) : ON");
} else if (strcmp(log_value, "off") == 0) {
@ -2343,7 +2302,6 @@ cons_show_otr_prefs(void)
} else {
cons_show("OTR logging (/otr log) : Redacted");
}
g_free(log_value);
char* ch = prefs_get_otr_char();
cons_show("OTR char (/otr char) : %s", ch);
@ -2364,7 +2322,7 @@ cons_show_pgp_prefs(void)
cons_show("PGP preferences:");
cons_show("");
char* log_value = prefs_get_string(PREF_PGP_LOG);
auto_gchar gchar* log_value = prefs_get_string(PREF_PGP_LOG);
if (strcmp(log_value, "on") == 0) {
cons_show("PGP logging (/pgp log) : ON");
} else if (strcmp(log_value, "off") == 0) {
@ -2372,7 +2330,6 @@ cons_show_pgp_prefs(void)
} else {
cons_show("PGP logging (/pgp log) : Redacted");
}
g_free(log_value);
char* ch = prefs_get_pgp_char();
cons_show("PGP char (/pgp char) : %s", ch);
@ -2393,11 +2350,10 @@ cons_show_omemo_prefs(void)
cons_show("OMEMO preferences:");
cons_show("");
char* policy_value = prefs_get_string(PREF_OMEMO_POLICY);
auto_gchar gchar* policy_value = prefs_get_string(PREF_OMEMO_POLICY);
cons_show("OMEMO policy (/omemo policy) : %s", policy_value);
g_free(policy_value);
char* log_value = prefs_get_string(PREF_OMEMO_LOG);
auto_gchar gchar* log_value = prefs_get_string(PREF_OMEMO_LOG);
if (strcmp(log_value, "on") == 0) {
cons_show("OMEMO logging (/omemo log) : ON");
} else if (strcmp(log_value, "off") == 0) {
@ -2405,7 +2361,6 @@ cons_show_omemo_prefs(void)
} else {
cons_show("OMEMO logging (/omemo log) : Redacted");
}
g_free(log_value);
char* ch = prefs_get_omemo_char();
cons_show("OMEMO char (/omemo char) : %s", ch);
@ -2420,7 +2375,7 @@ cons_show_ox_prefs(void)
cons_show("OX preferences:");
cons_show("");
char* log_value = prefs_get_string(PREF_OX_LOG);
auto_gchar gchar* log_value = prefs_get_string(PREF_OX_LOG);
if (strcmp(log_value, "on") == 0) {
cons_show("OX logging (/ox log) : ON");
} else if (strcmp(log_value, "off") == 0) {
@ -2428,7 +2383,6 @@ cons_show_ox_prefs(void)
} else {
cons_show("OX logging (/ox log) : Redacted");
}
g_free(log_value);
char* ch = prefs_get_ox_char();
cons_show("OX char (/ox char) : %s", ch);

View File

@ -228,8 +228,8 @@ ui_load_colours(void)
void
ui_contact_online(char* barejid, Resource* resource, GDateTime* last_activity)
{
char* show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
char* show_chat_win = prefs_get_string(PREF_STATUSES_CHAT);
auto_gchar gchar* show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
auto_gchar gchar* show_chat_win = prefs_get_string(PREF_STATUSES_CHAT);
PContact contact = roster_get_contact(barejid);
// show nothing
@ -262,9 +262,6 @@ ui_contact_online(char* barejid, Resource* resource, GDateTime* last_activity)
chatwin_contact_online(chatwin, resource, last_activity);
}
}
free(show_console);
free(show_chat_win);
}
void
@ -1049,8 +1046,8 @@ ui_ask_pgp_passphrase(const char* hint, int prev_fail)
void
ui_contact_offline(char* barejid, char* resource, char* status)
{
char* show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
char* show_chat_win = prefs_get_string(PREF_STATUSES_CHAT);
auto_gchar gchar* show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
auto_gchar gchar* show_chat_win = prefs_get_string(PREF_STATUSES_CHAT);
Jid* jid = jid_create_from_bare_and_resource(barejid, resource);
PContact contact = roster_get_contact(barejid);
if (p_contact_subscription(contact)) {
@ -1087,8 +1084,6 @@ ui_contact_offline(char* barejid, char* resource, char* status)
FREE_SET_NULL(chatwin->resource_override);
}
g_free(show_console);
g_free(show_chat_win);
jid_destroy(jid);
}

View File

@ -102,7 +102,7 @@ rosterwin_roster(void)
werase(layout->subwin);
}
char* roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
auto_gchar gchar* roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {
_rosterwin_print_rooms(layout);
@ -119,16 +119,15 @@ rosterwin_roster(void)
curr = g_list_next(curr);
}
char* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
auto_gchar gchar* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) {
_rosterwin_private_chats(layout, orphaned_privchats);
}
g_free(privpref);
g_list_free(orphaned_privchats);
}
if (prefs_get_boolean(PREF_ROSTER_CONTACTS)) {
char* by = prefs_get_string(PREF_ROSTER_BY);
auto_gchar gchar* by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) {
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat");
_rosterwin_contacts_by_presence(layout, "online", "Online");
@ -152,7 +151,6 @@ rosterwin_roster(void)
if (prefs_get_boolean(PREF_ROSTER_UNSUBSCRIBED)) {
_rosteriwin_unsubscribed(layout);
}
g_free(by);
}
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "last") == 0)) {
@ -171,16 +169,13 @@ rosterwin_roster(void)
curr = g_list_next(curr);
}
char* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
auto_gchar gchar* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) {
_rosterwin_private_chats(layout, orphaned_privchats);
}
g_free(privpref);
g_list_free(privchats);
g_list_free(orphaned_privchats);
}
g_free(roomspos);
}
static void
@ -188,13 +183,12 @@ _rosterwin_contacts_all(ProfLayoutSplit* layout)
{
GSList* contacts = NULL;
char* order = prefs_get_string(PREF_ROSTER_ORDER);
auto_gchar gchar* order = prefs_get_string(PREF_ROSTER_ORDER);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE);
} else {
contacts = roster_get_contacts(ROSTER_ORD_NAME);
}
g_free(order);
GSList* filtered_contacts = _filter_contacts(contacts);
g_slist_free(contacts);
@ -258,13 +252,12 @@ _rosterwin_contacts_by_group(ProfLayoutSplit* layout, char* group)
{
GSList* contacts = NULL;
char* order = prefs_get_string(PREF_ROSTER_ORDER);
auto_gchar gchar* order = prefs_get_string(PREF_ROSTER_ORDER);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_group(group, ROSTER_ORD_PRESENCE);
} else {
contacts = roster_get_group(group, ROSTER_ORD_NAME);
}
g_free(order);
GSList* filtered_contacts = _filter_contacts(contacts);
g_slist_free(contacts);
@ -320,7 +313,7 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin)
free(ch);
}
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "before") == 0) && unread > 0) {
g_string_append_printf(msg, "(%d) ", unread);
unread = 0;
@ -329,7 +322,6 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin)
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
g_string_append_printf(msg, " (%d)", unread);
}
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -383,7 +375,7 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact)
free(ch);
}
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "before") == 0) && unread > 0) {
g_string_append_printf(msg, "(%d) ", unread);
unread = 0;
@ -397,7 +389,6 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact)
unread = 0;
}
}
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -437,9 +428,8 @@ _rosterwin_presence(ProfLayoutSplit* layout, const char* presence, const char* s
return;
}
char* by = prefs_get_string(PREF_ROSTER_BY);
auto_gchar gchar* by = prefs_get_string(PREF_ROSTER_BY);
gboolean by_presence = g_strcmp0(by, "presence") == 0;
g_free(by);
int presence_indent = prefs_get_roster_presence_indent();
if (presence_indent > 0) {
@ -541,11 +531,10 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
g_string_append_printf(msg, " %d", resource->priority);
}
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
g_string_append_printf(msg, " (%d)", unread);
}
g_free(unreadpos);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
win_sub_print(layout->subwin, msg->str, FALSE, wrap, 0);
@ -560,7 +549,7 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
} else {
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
GString* unreadmsg = g_string_new("");
g_string_append_printf(unreadmsg, " (%d)", unread);
@ -573,7 +562,6 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
g_free(unreadpos);
int resource_indent = prefs_get_roster_resource_indent();
if (resource_indent > 0) {
@ -620,7 +608,7 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
theme_item_t presence_colour = _get_roster_theme(theme_type, presence);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
GString* unreadmsg = g_string_new("");
g_string_append_printf(unreadmsg, " (%d)", unread);
@ -630,12 +618,11 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
g_free(unreadpos);
_rosterwin_presence(layout, presence, status, current_indent);
} else {
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
char* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
GString* unreadmsg = g_string_new("");
g_string_append_printf(unreadmsg, " (%d)", unread);
@ -647,7 +634,6 @@ _rosterwin_resources(ProfLayoutSplit* layout, PContact contact, int current_inde
g_string_free(unreadmsg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
g_free(unreadpos);
}
g_list_free(resources);
@ -661,13 +647,12 @@ _rosterwin_rooms(ProfLayoutSplit* layout, char* title, GList* rooms)
while (curr_room) {
ProfMucWin* mucwin = wins_get_muc(curr_room->data);
if (mucwin) {
char* order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER);
auto_gchar gchar* order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER);
if (g_strcmp0(order, "unread") == 0) {
rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms_unread);
} else {
rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms_name);
}
g_free(order);
}
curr_room = g_list_next(curr_room);
}
@ -762,13 +747,13 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
free(ch);
}
char* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
if ((g_strcmp0(unreadpos, "before") == 0) && mucwin->unread > 0) {
g_string_append_printf(msg, "(%d) ", mucwin->unread);
}
char* use_as_name = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
char* roombypref = prefs_get_string(PREF_ROSTER_ROOMS_BY);
auto_gchar gchar* use_as_name = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
auto_gchar gchar* roombypref = prefs_get_string(PREF_ROSTER_ROOMS_BY);
if (g_strcmp0(roombypref, "service") == 0) {
if (mucwin->room_name == NULL || (g_strcmp0(use_as_name, "jid") == 0)) {
@ -800,13 +785,9 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
}
}
g_free(use_as_name);
g_free(roombypref);
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
g_string_append_printf(msg, " (%d)", mucwin->unread);
}
g_free(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -823,7 +804,7 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_ROOM));
}
char* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
auto_gchar gchar* privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
if (g_strcmp0(privpref, "room") == 0) {
GList* privs = wins_get_private_chats(mucwin->roomjid);
GList* curr = privs;
@ -869,7 +850,6 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, " (%d)", privwin->unread);
}
g_free(unreadpos);
const char* presence = "offline";
@ -895,14 +875,12 @@ _rosterwin_room(ProfLayoutSplit* layout, ProfMucWin* mucwin)
g_list_free(privs);
}
g_free(privpref);
}
static void
_rosterwin_print_rooms(ProfLayoutSplit* layout)
{
char* roomsbypref = prefs_get_string(PREF_ROSTER_ROOMS_BY);
auto_gchar gchar* roomsbypref = prefs_get_string(PREF_ROSTER_ROOMS_BY);
if (g_strcmp0(roomsbypref, "service") == 0) {
_rosterwin_rooms_by_service(layout);
} else {
@ -910,7 +888,6 @@ _rosterwin_print_rooms(ProfLayoutSplit* layout)
_rosterwin_rooms(layout, "Rooms", rooms);
g_list_free(rooms);
}
g_free(roomsbypref);
}
static void
@ -948,7 +925,7 @@ _rosterwin_private_chats(ProfLayoutSplit* layout, GList* orphaned_privchats)
}
}
char* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
auto_gchar gchar* unreadpos = prefs_get_string(PREF_ROSTER_ROOMS_UNREAD);
if ((g_strcmp0(unreadpos, "before") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, "(%d) ", privwin->unread);
}
@ -964,7 +941,6 @@ _rosterwin_private_chats(ProfLayoutSplit* layout, GList* orphaned_privchats)
if ((g_strcmp0(unreadpos, "after") == 0) && privwin->unread > 0) {
g_string_append_printf(privmsg, " (%d)", privwin->unread);
}
g_free(unreadpos);
Jid* jidp = jid_create(privwin->fulljid);
Occupant* occupant = muc_roster_item(jidp->barejid, jidp->resourcepart);
@ -1043,7 +1019,7 @@ _rosterwin_unsubscribed_header(ProfLayoutSplit* layout, GList* wins)
g_string_append(header, "Unsubscribed");
char* countpref = prefs_get_string(PREF_ROSTER_COUNT);
auto_gchar gchar* countpref = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(countpref, "items") == 0) {
int itemcount = g_list_length(wins);
if (itemcount == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) {
@ -1065,7 +1041,6 @@ _rosterwin_unsubscribed_header(ProfLayoutSplit* layout, GList* wins)
g_string_append_printf(header, " (%d)", unreadcount);
}
}
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -1090,7 +1065,7 @@ _rosterwin_contacts_header(ProfLayoutSplit* layout, const char* const title, GSL
g_string_append(header, title);
char* countpref = prefs_get_string(PREF_ROSTER_COUNT);
auto_gchar gchar* countpref = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(countpref, "items") == 0) {
int itemcount = g_slist_length(contacts);
if (itemcount == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) {
@ -1116,7 +1091,6 @@ _rosterwin_contacts_header(ProfLayoutSplit* layout, const char* const title, GSL
g_string_append_printf(header, " (%d)", unreadcount);
}
}
g_free(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
@ -1141,7 +1115,7 @@ _rosterwin_rooms_header(ProfLayoutSplit* layout, GList* rooms, char* title)
}
g_string_append(header, title);
char* countpref = prefs_get_string(PREF_ROSTER_COUNT);
auto_gchar gchar* countpref = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(countpref, "items") == 0) {
int count = g_list_length(rooms);
if (count == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) {
@ -1157,7 +1131,7 @@ _rosterwin_rooms_header(ProfLayoutSplit* layout, GList* rooms, char* title)
unread += mucwin->unread;