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

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-11-22 01:03:54 +00:00
commit 7e0ebc1de4
15 changed files with 523 additions and 244 deletions

View File

@ -280,6 +280,9 @@ static struct cmd_t command_defs[] =
"/roster order name|presence",
"/roster char header <char>|none",
"/roster char contact <char>|none",
"/roster indent contact <indent>",
"/roster indent resource <indent>",
"/roster indent presence <indent>",
"/roster size <percent>",
"/roster add <jid> [<nick>]",
"/roster remove <jid>",
@ -290,38 +293,41 @@ static struct cmd_t command_defs[] =
"Manage your roster, and roster display settings. "
"Passing no arguments lists all contacts in your roster.")
CMD_ARGS(
{ "online", "Show all online contacts in your roster." },
{ "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in the roster panel." },
{ "show resource", "Show contact's connected resources in the roster panel." },
{ "show presence", "Show contact's presence in the roster panel." },
{ "show status", "Show contact's status message in the roster panel." },
{ "show empty", "When grouping by presence, show empty presence groups." },
{ "show count", "Show number of contacts in group/presence." },
{ "show priority", "Show resource priority." },
{ "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in the roster panel." },
{ "hide resource", "Hide contact's connected resources in the roster panel." },
{ "hide presence", "Hide contact's presence in the roster panel." },
{ "hide status", "Hide contact's status message in the roster panel." },
{ "hide empty", "When grouping by presence, hide empty presence groups." },
{ "hide count", "Hide number of contacts in group/presence." },
{ "hide priority", "Hide resource priority." },
{ "by group", "Group contacts in the roster panel by roster group." },
{ "by presence", "Group contacts in the roster panel by presence." },
{ "by none", "No grouping in the roster panel." },
{ "order name", "Order roster items by name only." },
{ "order presence", "Order roster items by presence, and then by name." },
{ "char header <char>", "Prefix roster headers with specificed character." },
{ "char header none", "Remove roster header character prefix." },
{ "char contact <char>", "Prefix roster contacts with specificed character." },
{ "char contact none", "Remove roster contact character prefix." },
{ "size <precent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." },
{ "remove_all contacts", "Remove all items from roster." },
{ "nick <jid> <nick>", "Change a contacts nickname." },
{ "clearnick <jid>", "Removes the current nickname." })
{ "online", "Show all online contacts in your roster." },
{ "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in the roster panel." },
{ "show resource", "Show contact's connected resources in the roster panel." },
{ "show presence", "Show contact's presence in the roster panel." },
{ "show status", "Show contact's status message in the roster panel." },
{ "show empty", "When grouping by presence, show empty presence groups." },
{ "show count", "Show number of contacts in group/presence." },
{ "show priority", "Show resource priority." },
{ "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in the roster panel." },
{ "hide resource", "Hide contact's connected resources in the roster panel." },
{ "hide presence", "Hide contact's presence in the roster panel." },
{ "hide status", "Hide contact's status message in the roster panel." },
{ "hide empty", "When grouping by presence, hide empty presence groups." },
{ "hide count", "Hide number of contacts in group/presence." },
{ "hide priority", "Hide resource priority." },
{ "by group", "Group contacts in the roster panel by roster group." },
{ "by presence", "Group contacts in the roster panel by presence." },
{ "by none", "No grouping in the roster panel." },
{ "order name", "Order roster items by name only." },
{ "order presence", "Order roster items by presence, and then by name." },
{ "char header <char>", "Prefix roster headers with specificed character." },
{ "char header none", "Remove roster header character prefix." },
{ "char contact <char>", "Prefix roster contacts with specificed character." },
{ "char contact none", "Remove roster contact character prefix." },
{ "indent contact <indent>", "Indent contact line by <indent> spaces." },
{ "indent resource <indent>", "Indent resource line by <indent> spaces." },
{ "indent presence <indent>", "Indent presence line by <indent> spaces." },
{ "size <precent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." },
{ "remove_all contacts", "Remove all items from roster." },
{ "nick <jid> <nick>", "Change a contacts nickname." },
{ "clearnick <jid>", "Removes the current nickname." })
CMD_EXAMPLES(
"/roster",
"/roster add someone@contacts.org",
@ -1784,6 +1790,7 @@ static Autocomplete wins_ac;
static Autocomplete roster_ac;
static Autocomplete roster_char_ac;
static Autocomplete roster_char_none_ac;
static Autocomplete roster_indent_ac;
static Autocomplete roster_option_ac;
static Autocomplete roster_by_ac;
static Autocomplete roster_order_ac;
@ -2033,6 +2040,7 @@ cmd_init(void)
autocomplete_add(roster_ac, "order");
autocomplete_add(roster_ac, "size");
autocomplete_add(roster_ac, "char");
autocomplete_add(roster_ac, "indent");
roster_char_ac = autocomplete_new();
autocomplete_add(roster_char_ac, "header");
@ -2041,6 +2049,11 @@ cmd_init(void)
roster_char_none_ac = autocomplete_new();
autocomplete_add(roster_char_none_ac, "none");
roster_indent_ac = autocomplete_new();
autocomplete_add(roster_indent_ac, "contact");
autocomplete_add(roster_indent_ac, "resource");
autocomplete_add(roster_indent_ac, "presence");
roster_option_ac = autocomplete_new();
autocomplete_add(roster_option_ac, "offline");
autocomplete_add(roster_option_ac, "resource");
@ -2313,6 +2326,7 @@ cmd_uninit(void)
autocomplete_free(roster_ac);
autocomplete_free(roster_char_ac);
autocomplete_free(roster_char_none_ac);
autocomplete_free(roster_indent_ac);
autocomplete_free(roster_option_ac);
autocomplete_free(roster_by_ac);
autocomplete_free(roster_order_ac);
@ -2502,6 +2516,7 @@ cmd_reset_autocomplete(ProfWin *window)
autocomplete_reset(roster_ac);
autocomplete_reset(roster_char_ac);
autocomplete_reset(roster_char_none_ac);
autocomplete_reset(roster_indent_ac);
autocomplete_reset(roster_option_ac);
autocomplete_reset(roster_by_ac);
autocomplete_reset(roster_order_ac);
@ -2934,6 +2949,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster indent", roster_indent_ac, TRUE);
if (result) {
return result;
}
result = autocomplete_param_with_ac(input, "/roster", roster_ac, TRUE);
if (result) {
return result;

View File

@ -1781,6 +1781,61 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
}
return TRUE;
// set indentations
} else if (g_strcmp0(args[0], "indent") == 0) {
if (g_strcmp0(args[1], "contact") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else {
int intval = 0;
char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_roster_contact_indent(intval);
cons_show("Roster contact indent set to: %d", intval);
rosterwin_roster();
} else {
cons_show(err_msg);
free(err_msg);
}
}
} else if (g_strcmp0(args[1], "resource") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else {
int intval = 0;
char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, 0, 10, &err_msg);
if (res) {
prefs_set_roster_resource_indent(intval);
cons_show("Roster resource indent set to: %d", intval);
rosterwin_roster();
} else {
cons_show(err_msg);
free(err_msg);
}
}
} else if (g_strcmp0(args[1], "presence") == 0) {
if (!args[2]) {
cons_bad_cmd_usage(command);
} else {
int intval = 0;
char *err_msg = NULL;
gboolean res = strtoi_range(args[2], &intval, -1, 10, &err_msg);
if (res) {
prefs_set_roster_presence_indent(intval);
cons_show("Roster presence indent set to: %d", intval);
rosterwin_roster();
} else {
cons_show(err_msg);
free(err_msg);
}
}
} else {
cons_bad_cmd_usage(command);
}
return TRUE;
// show/hide roster
} else if (g_strcmp0(args[0], "show") == 0) {
if (args[1] == NULL) {
@ -3825,7 +3880,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
{
if (g_strcmp0(args[0], "lastactivity") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
@ -3842,7 +3899,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "statusbar") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
@ -3860,7 +3919,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "console") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CONSOLE, args[2]);
@ -3878,7 +3939,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "chat") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_CHAT, args[2]);
@ -3896,7 +3959,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "muc") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUC, args[2]);
@ -3914,7 +3979,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "mucconfig") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_MUCCONFIG, args[2]);
@ -3932,7 +3999,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "private") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_PRIVATE, args[2]);
@ -3950,7 +4019,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
}
} else if (g_strcmp0(args[0], "xml") == 0) {
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;
} else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]);

View File

@ -506,6 +506,72 @@ prefs_clear_roster_contact_char(void)
_save_prefs();
}
gint
prefs_get_roster_contact_indent(void)
{
if (!g_key_file_has_key(prefs, PREF_GROUP_UI, "roster.contact.indent", NULL)) {
return 2;
}
gint result = g_key_file_get_integer(prefs, PREF_GROUP_UI, "roster.contact.indent", NULL);
if (result < 0) {
result = 0;
}
return result;
}
void
prefs_set_roster_contact_indent(gint value)
{
g_key_file_set_integer(prefs, PREF_GROUP_UI, "roster.contact.indent", value);
_save_prefs();
}
gint
prefs_get_roster_resource_indent(void)
{
if (!g_key_file_has_key(prefs, PREF_GROUP_UI, "roster.resource.indent", NULL)) {
return 2;
}
gint result = g_key_file_get_integer(prefs, PREF_GROUP_UI, "roster.resource.indent", NULL);
if (result < 0) {
result = 0;
}
return result;
}
void
prefs_set_roster_resource_indent(gint value)
{
g_key_file_set_integer(prefs, PREF_GROUP_UI, "roster.resource.indent", value);
_save_prefs();
}
gint
prefs_get_roster_presence_indent(void)
{
if (!g_key_file_has_key(prefs, PREF_GROUP_UI, "roster.presence.indent", NULL)) {
return 2;
}
gint result = g_key_file_get_integer(prefs, PREF_GROUP_UI, "roster.presence.indent", NULL);
if (result < -1) {
result = 0;
}
return result;
}
void
prefs_set_roster_presence_indent(gint value)
{
g_key_file_set_integer(prefs, PREF_GROUP_UI, "roster.presence.indent", value);
_save_prefs();
}
gboolean
prefs_add_alias(const char *const name, const char *const value)
{

View File

@ -172,6 +172,13 @@ char prefs_get_roster_contact_char(void);
void prefs_set_roster_contact_char(char ch);
void prefs_clear_roster_contact_char(void);
gint prefs_get_roster_contact_indent(void);
void prefs_set_roster_contact_indent(gint value);
gint prefs_get_roster_resource_indent(void);
void prefs_set_roster_resource_indent(gint value);
gint prefs_get_roster_presence_indent(void);
void prefs_set_roster_presence_indent(gint value);
void prefs_add_login(const char *jid);
gboolean prefs_add_alias(const char *const name, const char *const value);

View File

@ -483,6 +483,18 @@ _load_preferences(void)
g_free(ch);
}
}
if (g_key_file_has_key(theme, "ui", "roster.contact.indent", NULL)) {
gint contact_indent = g_key_file_get_integer(theme, "ui", "roster.contact.indent", NULL);
prefs_set_roster_contact_indent(contact_indent);
}
if (g_key_file_has_key(theme, "ui", "roster.resource.indent", NULL)) {
gint resource_indent = g_key_file_get_integer(theme, "ui", "roster.resource.indent", NULL);
prefs_set_roster_resource_indent(resource_indent);
}
if (g_key_file_has_key(theme, "ui", "roster.presence.indent", NULL)) {
gint presence_indent = g_key_file_get_integer(theme, "ui", "roster.presence.indent", NULL);
prefs_set_roster_presence_indent(presence_indent);
}
_set_boolean_preference("privileges", PREF_MUC_PRIVILEGES);

View File

@ -960,9 +960,9 @@ cons_theme_setting(void)
{
char *theme = prefs_get_string(PREF_THEME);
if (theme == NULL) {
cons_show("Theme (/theme) : default");
cons_show("Theme (/theme) : default");
} else {
cons_show("Theme (/theme) : %s", theme);
cons_show("Theme (/theme) : %s", theme);
}
prefs_free_string(theme);
}
@ -971,58 +971,58 @@ void
cons_privileges_setting(void)
{
if (prefs_get_boolean(PREF_MUC_PRIVILEGES))
cons_show("MUC privileges (/privileges) : ON");
cons_show("MUC privileges (/privileges) : ON");
else
cons_show("MUC privileges (/privileges) : OFF");
cons_show("MUC privileges (/privileges) : OFF");
}
void
cons_beep_setting(void)
{
if (prefs_get_boolean(PREF_BEEP))
cons_show("Terminal beep (/beep) : ON");
cons_show("Terminal beep (/beep) : ON");
else
cons_show("Terminal beep (/beep) : OFF");
cons_show("Terminal beep (/beep) : OFF");
}
void
cons_resource_setting(void)
{
if (prefs_get_boolean(PREF_RESOURCE_TITLE))
cons_show("Resource title (/resource) : ON");
cons_show("Resource title (/resource) : ON");
else
cons_show("Resource title (/resource) : OFF");
cons_show("Resource title (/resource) : OFF");
if (prefs_get_boolean(PREF_RESOURCE_MESSAGE))
cons_show("Resource message (/resource) : ON");
cons_show("Resource message (/resource) : ON");
else
cons_show("Resource message (/resource) : OFF");
cons_show("Resource message (/resource) : OFF");
}
void
cons_wrap_setting(void)
{
if (prefs_get_boolean(PREF_WRAP))
cons_show("Word wrap (/wrap) : ON");
cons_show("Word wrap (/wrap) : ON");
else
cons_show("Word wrap (/wrap) : OFF");
cons_show("Word wrap (/wrap) : OFF");
}
void
cons_winstidy_setting(void)
{
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY))
cons_show("Window Auto Tidy (/wins) : ON");
cons_show("Window Auto Tidy (/wins) : ON");
else
cons_show("Window Auto Tidy (/wins) : OFF");
cons_show("Window Auto Tidy (/wins) : OFF");
}
void
cons_encwarn_setting(void)
{
if (prefs_get_boolean(PREF_ENC_WARN)) {
cons_show("Warn unencrypted (/encwarn) : ON");
cons_show("Warn unencrypted (/encwarn) : ON");
} else {
cons_show("Warn unencrypted (/encwarn) : OFF");
cons_show("Warn unencrypted (/encwarn) : OFF");
}
}
@ -1030,9 +1030,9 @@ void
cons_tlsshow_setting(void)
{
if (prefs_get_boolean(PREF_TLS_SHOW)) {
cons_show("TLS show (/tls) : ON");
cons_show("TLS show (/tls) : ON");
} else {
cons_show("TLS show (/tls) : OFF");
cons_show("TLS show (/tls) : OFF");
}
}
@ -1040,44 +1040,44 @@ void
cons_presence_setting(void)
{
if (prefs_get_boolean(PREF_PRESENCE))
cons_show("Contact presence (/presence) : ON");
cons_show("Contact presence (/presence) : ON");
else
cons_show("Contact presence (/presence) : OFF");
cons_show("Contact presence (/presence) : OFF");
}
void
cons_flash_setting(void)
{
if (prefs_get_boolean(PREF_FLASH))
cons_show("Terminal flash (/flash) : ON");
cons_show("Terminal flash (/flash) : ON");
else
cons_show("Terminal flash (/flash) : OFF");
cons_show("Terminal flash (/flash) : OFF");
}
void
cons_splash_setting(void)
{
if (prefs_get_boolean(PREF_SPLASH))
cons_show("Splash screen (/splash) : ON");
cons_show("Splash screen (/splash) : ON");
else
cons_show("Splash screen (/splash) : OFF");
cons_show("Splash screen (/splash) : OFF");
}
void
cons_occupants_setting(void)
{
if (prefs_get_boolean(PREF_OCCUPANTS))
cons_show("Occupants (/occupants) : show");
cons_show("Occupants (/occupants) : show");
else
cons_show("Occupants (/occupants) : hide");
cons_show("Occupants (/occupants) : hide");
if (prefs_get_boolean(PREF_OCCUPANTS_JID))
cons_show("Occupant jids (/occupants) : show");
cons_show("Occupant jids (/occupants) : show");
else
cons_show("Occupant jids (/occupants) : hide");
cons_show("Occupant jids (/occupants) : hide");
int size = prefs_get_occupants_size();
cons_show("Occupants size (/occupants) : %d", size);
cons_show("Occupants size (/occupants) : %d", size);
}
void
@ -1097,55 +1097,55 @@ cons_time_setting(void)
{
char *pref_time_console = prefs_get_string(PREF_TIME_CONSOLE);
if (g_strcmp0(pref_time_console, "off") == 0)
cons_show("Time console (/time) : OFF");
cons_show("Time console (/time) : OFF");
else
cons_show("Time console (/time) : %s", pref_time_console);
cons_show("Time console (/time) : %s", pref_time_console);
prefs_free_string(pref_time_console);
char *pref_time_chat = prefs_get_string(PREF_TIME_CHAT);
if (g_strcmp0(pref_time_chat, "off") == 0)
cons_show("Time chat (/time) : OFF");
cons_show("Time chat (/time) : OFF");
else
cons_show("Time chat (/time) : %s", pref_time_chat);
cons_show("Time chat (/time) : %s", pref_time_chat);
prefs_free_string(pref_time_chat);
char *pref_time_muc = prefs_get_string(PREF_TIME_MUC);
if (g_strcmp0(pref_time_muc, "off") == 0)
cons_show("Time MUC (/time) : OFF");
cons_show("Time MUC (/time) : OFF");
else
cons_show("Time MUC (/time) : %s", pref_time_muc);
cons_show("Time MUC (/time) : %s", pref_time_muc);
prefs_free_string(pref_time_muc);
char *pref_time_mucconf = prefs_get_string(PREF_TIME_MUCCONFIG);
if (g_strcmp0(pref_time_mucconf, "off") == 0)
cons_show("Time MUC config (/time) : OFF");
cons_show("Time MUC config (/time) : OFF");
else
cons_show("Time MUC config (/time) : %s", pref_time_mucconf);
cons_show("Time MUC config (/time) : %s", pref_time_mucconf);
prefs_free_string(pref_time_mucconf);
char *pref_time_private = prefs_get_string(PREF_TIME_PRIVATE);
if (g_strcmp0(pref_time_private, "off") == 0)
cons_show("Time private (/time) : OFF");
cons_show("Time private (/time) : OFF");
else
cons_show("Time private (/time) : %s", pref_time_private);
cons_show("Time private (/time) : %s", pref_time_private);
prefs_free_string(pref_time_private);
char *pref_time_xml = prefs_get_string(PREF_TIME_XMLCONSOLE);
if (g_strcmp0(pref_time_xml, "off") == 0)
cons_show("Time XML Console (/time) : OFF");
cons_show("Time XML Console (/time) : OFF");
else
cons_show("Time XML Console (/time) : %s", pref_time_xml);
cons_show("Time XML Console (/time) : %s", pref_time_xml);
prefs_free_string(pref_time_xml);
char *pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(pref_time_statusbar, "off") == 0)
cons_show("Time statusbar (/time) : OFF");
cons_show("Time statusbar (/time) : OFF");
else
cons_show("Time statusbar (/time) : %s", pref_time_statusbar);
cons_show("Time statusbar (/time) : %s", pref_time_statusbar);
prefs_free_string(pref_time_statusbar);
char *pref_time_lastactivity = prefs_get_string(PREF_TIME_LASTACTIVITY);
cons_show("Time last activity (/time) : %s", pref_time_lastactivity);
cons_show("Time last activity (/time) : %s", pref_time_lastactivity);
prefs_free_string(pref_time_lastactivity);
}
@ -1153,9 +1153,9 @@ void
cons_vercheck_setting(void)
{
if (prefs_get_boolean(PREF_VERCHECK))
cons_show("Version checking (/vercheck) : ON");
cons_show("Version checking (/vercheck) : ON");
else
cons_show("Version checking (/vercheck) : OFF");
cons_show("Version checking (/vercheck) : OFF");
}
void
@ -1165,9 +1165,9 @@ cons_statuses_setting(void)
char *chat = prefs_get_string(PREF_STATUSES_CHAT);
char *muc = prefs_get_string(PREF_STATUSES_MUC);
cons_show("Console statuses (/statuses) : %s", console);
cons_show("Chat statuses (/statuses) : %s", chat);
cons_show("MUC statuses (/statuses) : %s", muc);
cons_show("Console statuses (/statuses) : %s", console);
cons_show("Chat statuses (/statuses) : %s", chat);
cons_show("MUC statuses (/statuses) : %s", muc);
prefs_free_string(console);
prefs_free_string(chat);
@ -1178,14 +1178,14 @@ void
cons_titlebar_setting(void)
{
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
cons_show("Titlebar show (/titlebar) : ON");
cons_show("Titlebar show (/titlebar) : ON");
} else {
cons_show("Titlebar show (/titlebar) : OFF");
cons_show("Titlebar show (/titlebar) : OFF");
}
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
cons_show("Titlebar goodbye (/titlebar) : ON");
cons_show("Titlebar goodbye (/titlebar) : ON");
} else {
cons_show("Titlebar goodbye (/titlebar) : OFF");
cons_show("Titlebar goodbye (/titlebar) : OFF");
}
}
@ -1193,67 +1193,76 @@ void
cons_roster_setting(void)
{
if (prefs_get_boolean(PREF_ROSTER))
cons_show("Roster (/roster) : show");
cons_show("Roster (/roster) : show");
else
cons_show("Roster (/roster) : hide");
cons_show("Roster (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_OFFLINE))
cons_show("Roster offline (/roster) : show");
cons_show("Roster offline (/roster) : show");
else
cons_show("Roster offline (/roster) : hide");
cons_show("Roster offline (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_RESOURCE))
cons_show("Roster resource (/roster) : show");
cons_show("Roster resource (/roster) : show");
else
cons_show("Roster resource (/roster) : hide");
cons_show("Roster resource (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_PRESENCE))
cons_show("Roster presence (/roster) : show");
cons_show("Roster presence (/roster) : show");
else
cons_show("Roster presence (/roster) : hide");
cons_show("Roster presence (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_STATUS))
cons_show("Roster status (/roster) : show");
cons_show("Roster status (/roster) : show");
else
cons_show("Roster status (/roster) : hide");
cons_show("Roster status (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_EMPTY))
cons_show("Roster empty (/roster) : show");
cons_show("Roster empty (/roster) : show");
else
cons_show("Roster empty (/roster) : hide");
cons_show("Roster empty (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_COUNT))
cons_show("Roster count (/roster) : show");
cons_show("Roster count (/roster) : show");
else
cons_show("Roster count (/roster) : hide");
cons_show("Roster count (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_PRIORITY))
cons_show("Roster priority (/roster) : show");
cons_show("Roster priority (/roster) : show");
else
cons_show("Roster priority (/roster) : hide");
cons_show("Roster priority (/roster) : hide");
char *by = prefs_get_string(PREF_ROSTER_BY);
cons_show("Roster by (/roster) : %s", by);
cons_show("Roster by (/roster) : %s", by);
prefs_free_string(by);
char *order = prefs_get_string(PREF_ROSTER_ORDER);
cons_show("Roster order (/roster) : %s", order);
cons_show("Roster order (/roster) : %s", order);
prefs_free_string(order);
int size = prefs_get_roster_size();
cons_show("Roster size (/roster) : %d", size);
cons_show("Roster size (/roster) : %d", size);
char header_ch = prefs_get_roster_header_char();
if (header_ch)
cons_show("Roster header char (/roster) : %c", header_ch);
cons_show("Roster header char (/roster) : %c", header_ch);
else
cons_show("Roster header char (/roster) : none");
cons_show("Roster header char (/roster) : none");
char contact_ch = prefs_get_roster_contact_char();
if (contact_ch)
cons_show("Roster contact char (/roster) : %c", contact_ch);
cons_show("Roster contact char (/roster) : %c", contact_ch);
else
cons_show("Roster contact char (/roster) : none");
cons_show("Roster contact char (/roster) : none");
gint contact_indent = prefs_get_roster_contact_indent();
cons_show("Roster contact indent (/roster) : %d", contact_indent);
gint resource_indent = prefs_get_roster_resource_indent();
cons_show("Roster resource indent (/roster) : %d", resource_indent);
gint presence_indent = prefs_get_roster_presence_indent();
cons_show("Roster presence indent (/roster) : %d", presence_indent);
}
void
@ -1457,11 +1466,11 @@ cons_show_chat_prefs(void)
void
cons_inpblock_setting(void)
{
cons_show("Input timeout (/inpblock) : %d milliseconds", prefs_get_inpblock());
cons_show("Input timeout (/inpblock) : %d milliseconds", prefs_get_inpblock());
if (prefs_get_boolean(PREF_INPBLOCK_DYNAMIC)) {
cons_show("Dynamic timeout (/inpblock) : ON");
cons_show("Dynamic timeout (/inpblock) : ON");
} else {
cons_show("Dynamic timeout (/inpblock) : OFF");
cons_show("Dynamic timeout (/inpblock) : OFF");
}
}

View File

@ -48,13 +48,13 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
GString *msg = g_string_new(" ");
g_string_append(msg, occupant->nick);
win_printline_nowrap(layout->subwin, msg->str);
win_sub_print(layout->subwin, msg->str, TRUE, FALSE);
g_string_free(msg, TRUE);
if (showjid && occupant->jid) {
GString *msg = g_string_new(" ");
g_string_append(msg, occupant->jid);
win_printline_nowrap(layout->subwin, msg->str);
win_sub_print(layout->subwin, msg->str, TRUE, FALSE);
g_string_free(msg, TRUE);
}
@ -75,7 +75,7 @@ occupantswin_occupants(const char *const roomjid)
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
win_printline_nowrap(layout->subwin, " -Moderators");
win_sub_print(layout->subwin, " -Moderators", TRUE, FALSE);
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
GList *roster_curr = occupants;
while (roster_curr) {
@ -87,7 +87,7 @@ occupantswin_occupants(const char *const roomjid)
}
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
win_printline_nowrap(layout->subwin, " -Participants");
win_sub_print(layout->subwin, " -Participants", TRUE, FALSE);
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
roster_curr = occupants;
while (roster_curr) {
@ -99,7 +99,7 @@ occupantswin_occupants(const char *const roomjid)
}
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
win_printline_nowrap(layout->subwin, " -Visitors");
win_sub_print(layout->subwin, " -Visitors", TRUE, FALSE);
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
roster_curr = occupants;
while (roster_curr) {
@ -111,7 +111,7 @@ occupantswin_occupants(const char *const roomjid)
}
} else {
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
win_printline_nowrap(layout->subwin, " -Occupants\n");
win_sub_print(layout->subwin, " -Occupants\n", TRUE, FALSE);
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
GList *roster_curr = occupants;
while (roster_curr) {

View File

@ -43,7 +43,8 @@
#include "roster_list.h"
static void
_rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, const char *presence, const char *status)
_rosterwin_presence(ProfLayoutSplit *layout, theme_item_t colour, const char *presence, const char *status,
int current_indent)
{
// don't show presence for offline contacts
gboolean is_offline = g_strcmp0(presence, "offline") == 0;
@ -53,49 +54,85 @@ _rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, co
char *by = prefs_get_string(PREF_ROSTER_BY);
gboolean by_presence = g_strcmp0(by, "presence") == 0;
prefs_free_string(by);
int presence_indent = prefs_get_roster_presence_indent();
if (presence_indent > 0) {
current_indent += presence_indent;
}
// show only status when grouped by presence
if (by_presence) {
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
wattron(layout->subwin, theme_attrs(colour));
GString *msg = g_string_new(" ");
while (indent > 0) {
g_string_append(msg, " ");
indent--;
if (presence_indent == -1) {
GString *msg = g_string_new("");
g_string_append_printf(msg, ": \"%s\"", status);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
} else {
GString *msg = g_string_new(" ");
while (current_indent > 0) {
g_string_append(msg, " ");
current_indent--;
}
g_string_append_printf(msg, "\"%s\"", status);
win_sub_newline_lazy(layout->subwin);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
g_string_append_printf(msg, "\"%s\"", status);
win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
// show both presence and status when not grouped by presence
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || (status && prefs_get_boolean(PREF_ROSTER_STATUS))) {
wattron(layout->subwin, theme_attrs(colour));
GString *msg = g_string_new(" ");
while (indent > 0) {
g_string_append(msg, " ");
indent--;
}
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
g_string_append(msg, presence);
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, " \"%s\"", status);
if (presence_indent == -1) {
GString *msg = g_string_new("");
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
g_string_append_printf(msg, ": %s", presence);
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, " \"%s\"", status);
}
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, ": \"%s\"", status);
}
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, "\"%s\"", status);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
} else {
GString *msg = g_string_new(" ");
while (current_indent > 0) {
g_string_append(msg, " ");
current_indent--;
}
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
g_string_append(msg, presence);
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, " \"%s\"", status);
}
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
g_string_append_printf(msg, "\"%s\"", status);
}
win_sub_newline_lazy(layout->subwin);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
win_printline_nowrap(layout->subwin, msg->str);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(colour));
}
}
static void
_rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
_rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_indent)
{
GList *resources = p_contact_get_available_resources(contact);
if (resources) {
int resource_indent = prefs_get_roster_resource_indent();
if (resource_indent > 0) {
current_indent += resource_indent;
}
GList *curr_resource = resources;
while (curr_resource) {
Resource *resource = curr_resource->data;
@ -103,17 +140,23 @@ _rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
theme_item_t resource_presence_colour = theme_main_presence_attrs(resource_presence);
wattron(layout->subwin, theme_attrs(resource_presence_colour));
GString *msg = g_string_new(" ");
GString *msg = g_string_new(" ");
int this_indent = current_indent;
while (this_indent > 0) {
g_string_append(msg, " ");
this_indent--;
}
g_string_append(msg, resource->name);
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
g_string_append_printf(msg, " [%d]", resource->priority);
g_string_append_printf(msg, " %d", resource->priority);
}
win_printline_nowrap(layout->subwin, msg->str);
win_sub_newline_lazy(layout->subwin);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
_rosterwin_presence(layout, 6, resource_presence_colour, resource_presence, resource->status);
_rosterwin_presence(layout, resource_presence_colour, resource_presence, resource->status, current_indent);
}
curr_resource = g_list_next(curr_resource);
@ -122,7 +165,7 @@ _rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
const char *presence = p_contact_presence(contact);
const char *status = p_contact_status(contact);
theme_item_t presence_colour = theme_main_presence_attrs(presence);
_rosterwin_presence(layout, 4, presence_colour, presence, status);
_rosterwin_presence(layout, presence_colour, presence, status, current_indent);
}
g_list_free(resources);
@ -138,30 +181,43 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
theme_item_t presence_colour = theme_main_presence_attrs(presence);
wattron(layout->subwin, theme_attrs(presence_colour));
GString *msg = g_string_new(" ");
GString *msg = g_string_new(" ");
int indent = prefs_get_roster_contact_indent();
int current_indent = 0;
if (indent > 0) {
current_indent += indent;
while (indent > 0) {
g_string_append(msg, " ");
indent--;
}
}
char ch = prefs_get_roster_contact_char();
if (ch) {
g_string_append_printf(msg, "%c", ch);
}
g_string_append(msg, name);
win_printline_nowrap(layout->subwin, msg->str);
win_sub_newline_lazy(layout->subwin);
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
_rosterwin_resource(layout, contact);
_rosterwin_resources(layout, contact, current_indent);
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
_rosterwin_presence(layout, 4, presence_colour, presence, status);
_rosterwin_presence(layout, presence_colour, presence, status, current_indent);
}
}
static void
_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const presence, char *title)
_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const presence, char *title, gboolean newline)
{
GSList *contacts = roster_get_contacts_by_presence(presence);
// if this group has contacts, or if we want to show empty groups
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
if (newline) {
win_sub_newline_lazy(layout->subwin);
}
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title_str = g_string_new(" ");
char ch = prefs_get_roster_header_char();
@ -172,7 +228,7 @@ _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const prese
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title_str, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title_str->str);
win_sub_print(layout->subwin, title_str->str, FALSE, FALSE);
g_string_free(title_str, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
}
@ -189,7 +245,7 @@ _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const prese
}
static void
_rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
_rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group, gboolean newline)
{
GSList *contacts = NULL;
@ -200,8 +256,12 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
} else {
contacts = roster_get_group(group, ROSTER_ORD_NAME, offline);
}
prefs_free_string(order);
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
if (newline) {
win_sub_newline_lazy(layout->subwin);
}
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" ");
char ch = prefs_get_roster_header_char();
@ -212,7 +272,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
win_sub_print(layout->subwin, title->str, FALSE, FALSE);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@ -227,7 +287,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
}
static void
_rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
_rosterwin_contacts_by_no_group(ProfLayoutSplit *layout, gboolean newline)
{
GSList *contacts = NULL;
@ -238,8 +298,12 @@ _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
} else {
contacts = roster_get_nogroup(ROSTER_ORD_NAME, offline);
}
prefs_free_string(order);
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
if (newline) {
win_sub_newline_lazy(layout->subwin);
}
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" ");
char ch = prefs_get_roster_header_char();
@ -251,7 +315,7 @@ _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
win_sub_print(layout->subwin, title->str, FALSE, FALSE);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@ -269,68 +333,73 @@ void
rosterwin_roster(void)
{
ProfWin *console = wins_get_console();
if (console) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
char *by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) {
werase(layout->subwin);
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat");
_rosterwin_contacts_by_presence(layout, "online", "Online");
_rosterwin_contacts_by_presence(layout, "away", "Away");
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away");
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb");
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
_rosterwin_contacts_by_presence(layout, "offline", "Offline");
}
} else if (g_strcmp0(by, "group") == 0) {
werase(layout->subwin);
GSList *groups = roster_get_groups();
GSList *curr_group = groups;
while (curr_group) {
_rosterwin_contacts_by_group(layout, curr_group->data);
curr_group = g_slist_next(curr_group);
}
g_slist_free_full(groups, free);
_rosterwin_contacts_by_no_group(layout);
} else {
GSList *contacts = NULL;
char *order = prefs_get_string(PREF_ROSTER_ORDER);
gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, offline);
} else {
contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
}
werase(layout->subwin);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" ");
char ch = prefs_get_roster_header_char();
if (ch) {
g_string_append_printf(title, "%c", ch);
}
g_string_append(title, "Roster");
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_printline_nowrap(layout->subwin, title->str);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
if (contacts) {
GSList *curr_contact = contacts;
while (curr_contact) {
PContact contact = curr_contact->data;
_rosterwin_contact(layout, contact);
curr_contact = g_slist_next(curr_contact);
}
}
g_slist_free(contacts);
}
free(by);
if (!console) {
return;
}
ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
char *by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) {
werase(layout->subwin);
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat", FALSE);
_rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
_rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
_rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
}
} else if (g_strcmp0(by, "group") == 0) {
werase(layout->subwin);
gboolean newline = FALSE;
GSList *groups = roster_get_groups();
GSList *curr_group = groups;
while (curr_group) {
_rosterwin_contacts_by_group(layout, curr_group->data, newline);
newline = TRUE;
curr_group = g_slist_next(curr_group);
}
g_slist_free_full(groups, free);
_rosterwin_contacts_by_no_group(layout, newline);
} else {
GSList *contacts = NULL;
char *order = prefs_get_string(PREF_ROSTER_ORDER);
gboolean offline = prefs_get_boolean(PREF_ROSTER_OFFLINE);
if (g_strcmp0(order, "presence") == 0) {
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, offline);
} else {
contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
}
prefs_free_string(order);
werase(layout->subwin);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
GString *title = g_string_new(" ");
char ch = prefs_get_roster_header_char();
if (ch) {
g_string_append_printf(title, "%c", ch);
}
g_string_append(title, "Roster");
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
}
win_sub_print(layout->subwin, title->str, FALSE, FALSE);
g_string_free(title, TRUE);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
if (contacts) {
GSList *curr_contact = contacts;
while (curr_contact) {
PContact contact = curr_contact->data;
_rosterwin_contact(layout, contact);
curr_contact = g_slist_next(curr_contact);
}
}
g_slist_free(contacts);
}
prefs_free_string(by);
}

View File

@ -1266,12 +1266,25 @@ win_unread(ProfWin *window)
}
void
win_printline_nowrap(WINDOW *win, char *msg)
win_sub_print(WINDOW *win, char *msg, gboolean newline, gboolean wrap)
{
int maxx = getmaxx(win);
int curx = getcurx(win);
int cury = getcury(win);
waddnstr(win, msg, maxx);
waddnstr(win, msg, maxx - curx);
wmove(win, cury+1, 0);
if (newline) {
wmove(win, cury+1, 0);
}
}
void
win_sub_newline_lazy(WINDOW *win)
{
int curx = getcurx(win);
if (curx > 0) {
int cury = getcury(win);
wmove(win, cury+1, 0);
}
}

View File

@ -67,7 +67,8 @@ void win_newline(ProfWin *window);
void win_redraw(ProfWin *window);
int win_roster_cols(void);
int win_occpuants_cols(void);
void win_printline_nowrap(WINDOW *win, char *msg);
void win_sub_print(WINDOW *win, char *msg, gboolean newline, gboolean wrap);
void win_sub_newline_lazy(WINDOW *win);
void win_mark_received(ProfWin *window, const char *const id);
gboolean win_has_active_subwin(ProfWin *window);

View File

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

View File

@ -84,6 +84,9 @@ roster.priority=
roster.size=
roster.header.char=
roster.contact.char=
roster.contact.indent=
roster.resource.indent=
roster.presence.indent=
occupants=
occupants.size=
occupants.jid=

View File

@ -71,19 +71,21 @@ resource.message=true
statuses.console=all
statuses.chat=all
statuses.muc=all
roster=true
roster.by=presence
roster.offline=true
roster.resource=true
roster.empty=false
roster.presence=true
roster.status=true
roster.empty=true
roster.by=group
roster.order=presence
roster.status=true
roster.resource=true
roster.priority=false
roster=true
roster.count=true
roster.priority=true
roster.size=25
roster.contact.indent=1
roster.resource.indent=2
roster.presence.indent=-1
roster.header.char=@
roster.contact.char=-
occupants=true
occupants.size=15
occupants.jid=false

View File

@ -31,6 +31,9 @@ roster.priority=true
roster.size=25
roster.header.char=-
roster.contact.char=-
roster.contact.indent=2
roster.resource.indent=2
roster.presence.indent=2
privileges=true
presence=true
intype=true

View File

@ -28,6 +28,9 @@ roster.order=presence
roster.count=false
roster.priority=false
roster.size=25
roster.contact.indent=0
roster.resource.indent=0
roster.presence.indent=-1
privileges=false
presence=false
intype=false