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:
commit
7e0ebc1de4
@ -280,6 +280,9 @@ static struct cmd_t command_defs[] =
|
|||||||
"/roster order name|presence",
|
"/roster order name|presence",
|
||||||
"/roster char header <char>|none",
|
"/roster char header <char>|none",
|
||||||
"/roster char contact <char>|none",
|
"/roster char contact <char>|none",
|
||||||
|
"/roster indent contact <indent>",
|
||||||
|
"/roster indent resource <indent>",
|
||||||
|
"/roster indent presence <indent>",
|
||||||
"/roster size <percent>",
|
"/roster size <percent>",
|
||||||
"/roster add <jid> [<nick>]",
|
"/roster add <jid> [<nick>]",
|
||||||
"/roster remove <jid>",
|
"/roster remove <jid>",
|
||||||
@ -316,6 +319,9 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "char header none", "Remove roster header character prefix." },
|
{ "char header none", "Remove roster header character prefix." },
|
||||||
{ "char contact <char>", "Prefix roster contacts with specificed character." },
|
{ "char contact <char>", "Prefix roster contacts with specificed character." },
|
||||||
{ "char contact none", "Remove roster contact character prefix." },
|
{ "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)." },
|
{ "size <precent>", "Percentage of the screen taken up by the roster (1-99)." },
|
||||||
{ "add <jid> [<nick>]", "Add a new item to the roster." },
|
{ "add <jid> [<nick>]", "Add a new item to the roster." },
|
||||||
{ "remove <jid>", "Removes an item from the roster." },
|
{ "remove <jid>", "Removes an item from the roster." },
|
||||||
@ -1784,6 +1790,7 @@ static Autocomplete wins_ac;
|
|||||||
static Autocomplete roster_ac;
|
static Autocomplete roster_ac;
|
||||||
static Autocomplete roster_char_ac;
|
static Autocomplete roster_char_ac;
|
||||||
static Autocomplete roster_char_none_ac;
|
static Autocomplete roster_char_none_ac;
|
||||||
|
static Autocomplete roster_indent_ac;
|
||||||
static Autocomplete roster_option_ac;
|
static Autocomplete roster_option_ac;
|
||||||
static Autocomplete roster_by_ac;
|
static Autocomplete roster_by_ac;
|
||||||
static Autocomplete roster_order_ac;
|
static Autocomplete roster_order_ac;
|
||||||
@ -2033,6 +2040,7 @@ cmd_init(void)
|
|||||||
autocomplete_add(roster_ac, "order");
|
autocomplete_add(roster_ac, "order");
|
||||||
autocomplete_add(roster_ac, "size");
|
autocomplete_add(roster_ac, "size");
|
||||||
autocomplete_add(roster_ac, "char");
|
autocomplete_add(roster_ac, "char");
|
||||||
|
autocomplete_add(roster_ac, "indent");
|
||||||
|
|
||||||
roster_char_ac = autocomplete_new();
|
roster_char_ac = autocomplete_new();
|
||||||
autocomplete_add(roster_char_ac, "header");
|
autocomplete_add(roster_char_ac, "header");
|
||||||
@ -2041,6 +2049,11 @@ cmd_init(void)
|
|||||||
roster_char_none_ac = autocomplete_new();
|
roster_char_none_ac = autocomplete_new();
|
||||||
autocomplete_add(roster_char_none_ac, "none");
|
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();
|
roster_option_ac = autocomplete_new();
|
||||||
autocomplete_add(roster_option_ac, "offline");
|
autocomplete_add(roster_option_ac, "offline");
|
||||||
autocomplete_add(roster_option_ac, "resource");
|
autocomplete_add(roster_option_ac, "resource");
|
||||||
@ -2313,6 +2326,7 @@ cmd_uninit(void)
|
|||||||
autocomplete_free(roster_ac);
|
autocomplete_free(roster_ac);
|
||||||
autocomplete_free(roster_char_ac);
|
autocomplete_free(roster_char_ac);
|
||||||
autocomplete_free(roster_char_none_ac);
|
autocomplete_free(roster_char_none_ac);
|
||||||
|
autocomplete_free(roster_indent_ac);
|
||||||
autocomplete_free(roster_option_ac);
|
autocomplete_free(roster_option_ac);
|
||||||
autocomplete_free(roster_by_ac);
|
autocomplete_free(roster_by_ac);
|
||||||
autocomplete_free(roster_order_ac);
|
autocomplete_free(roster_order_ac);
|
||||||
@ -2502,6 +2516,7 @@ cmd_reset_autocomplete(ProfWin *window)
|
|||||||
autocomplete_reset(roster_ac);
|
autocomplete_reset(roster_ac);
|
||||||
autocomplete_reset(roster_char_ac);
|
autocomplete_reset(roster_char_ac);
|
||||||
autocomplete_reset(roster_char_none_ac);
|
autocomplete_reset(roster_char_none_ac);
|
||||||
|
autocomplete_reset(roster_indent_ac);
|
||||||
autocomplete_reset(roster_option_ac);
|
autocomplete_reset(roster_option_ac);
|
||||||
autocomplete_reset(roster_by_ac);
|
autocomplete_reset(roster_by_ac);
|
||||||
autocomplete_reset(roster_order_ac);
|
autocomplete_reset(roster_order_ac);
|
||||||
@ -2934,6 +2949,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
|
|||||||
if (result) {
|
if (result) {
|
||||||
return 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);
|
result = autocomplete_param_with_ac(input, "/roster", roster_ac, TRUE);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -1781,6 +1781,61 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
return TRUE;
|
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
|
// show/hide roster
|
||||||
} else if (g_strcmp0(args[0], "show") == 0) {
|
} else if (g_strcmp0(args[0], "show") == 0) {
|
||||||
if (args[1] == NULL) {
|
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 (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]);
|
||||||
@ -3842,7 +3899,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]);
|
||||||
@ -3860,7 +3919,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]);
|
||||||
@ -3878,7 +3939,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]);
|
||||||
@ -3896,7 +3959,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]);
|
||||||
@ -3914,7 +3979,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]);
|
||||||
@ -3932,7 +3999,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]);
|
||||||
@ -3950,7 +4019,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]);
|
||||||
|
@ -506,6 +506,72 @@ prefs_clear_roster_contact_char(void)
|
|||||||
_save_prefs();
|
_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
|
gboolean
|
||||||
prefs_add_alias(const char *const name, const char *const value)
|
prefs_add_alias(const char *const name, const char *const value)
|
||||||
{
|
{
|
||||||
|
@ -172,6 +172,13 @@ char prefs_get_roster_contact_char(void);
|
|||||||
void prefs_set_roster_contact_char(char ch);
|
void prefs_set_roster_contact_char(char ch);
|
||||||
void prefs_clear_roster_contact_char(void);
|
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);
|
void prefs_add_login(const char *jid);
|
||||||
|
|
||||||
gboolean prefs_add_alias(const char *const name, const char *const value);
|
gboolean prefs_add_alias(const char *const name, const char *const value);
|
||||||
|
@ -483,6 +483,18 @@ _load_preferences(void)
|
|||||||
g_free(ch);
|
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);
|
_set_boolean_preference("privileges", PREF_MUC_PRIVILEGES);
|
||||||
|
|
||||||
|
@ -1254,6 +1254,15 @@ cons_roster_setting(void)
|
|||||||
cons_show("Roster contact char (/roster) : %c", contact_ch);
|
cons_show("Roster contact char (/roster) : %c", contact_ch);
|
||||||
else
|
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
|
void
|
||||||
|
@ -48,13 +48,13 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
|
|||||||
|
|
||||||
GString *msg = g_string_new(" ");
|
GString *msg = g_string_new(" ");
|
||||||
g_string_append(msg, occupant->nick);
|
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);
|
g_string_free(msg, TRUE);
|
||||||
|
|
||||||
if (showjid && occupant->jid) {
|
if (showjid && occupant->jid) {
|
||||||
GString *msg = g_string_new(" ");
|
GString *msg = g_string_new(" ");
|
||||||
g_string_append(msg, occupant->jid);
|
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);
|
g_string_free(msg, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ occupantswin_occupants(const char *const roomjid)
|
|||||||
|
|
||||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||||
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
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));
|
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||||
GList *roster_curr = occupants;
|
GList *roster_curr = occupants;
|
||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
@ -87,7 +87,7 @@ occupantswin_occupants(const char *const roomjid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
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));
|
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||||
roster_curr = occupants;
|
roster_curr = occupants;
|
||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
@ -99,7 +99,7 @@ occupantswin_occupants(const char *const roomjid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
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));
|
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||||
roster_curr = occupants;
|
roster_curr = occupants;
|
||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
@ -111,7 +111,7 @@ occupantswin_occupants(const char *const roomjid)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wattron(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
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));
|
wattroff(layout->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||||
GList *roster_curr = occupants;
|
GList *roster_curr = occupants;
|
||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
|
@ -43,7 +43,8 @@
|
|||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
|
|
||||||
static void
|
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
|
// don't show presence for offline contacts
|
||||||
gboolean is_offline = g_strcmp0(presence, "offline") == 0;
|
gboolean is_offline = g_strcmp0(presence, "offline") == 0;
|
||||||
@ -53,29 +54,58 @@ _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);
|
||||||
|
|
||||||
|
int presence_indent = prefs_get_roster_presence_indent();
|
||||||
|
if (presence_indent > 0) {
|
||||||
|
current_indent += presence_indent;
|
||||||
|
}
|
||||||
|
|
||||||
// show only status when grouped by presence
|
// show only status when grouped by presence
|
||||||
if (by_presence) {
|
if (by_presence) {
|
||||||
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
|
if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
|
||||||
wattron(layout->subwin, theme_attrs(colour));
|
wattron(layout->subwin, theme_attrs(colour));
|
||||||
|
if (presence_indent == -1) {
|
||||||
GString *msg = g_string_new("");
|
GString *msg = g_string_new("");
|
||||||
while (indent > 0) {
|
g_string_append_printf(msg, ": \"%s\"", status);
|
||||||
g_string_append(msg, " ");
|
win_sub_print(layout->subwin, msg->str, FALSE, FALSE);
|
||||||
indent--;
|
|
||||||
}
|
|
||||||
g_string_append_printf(msg, "\"%s\"", status);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
g_string_free(msg, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(colour));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// show both presence and status when not grouped by presence
|
// 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))) {
|
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || (status && prefs_get_boolean(PREF_ROSTER_STATUS))) {
|
||||||
wattron(layout->subwin, theme_attrs(colour));
|
wattron(layout->subwin, theme_attrs(colour));
|
||||||
|
if (presence_indent == -1) {
|
||||||
GString *msg = g_string_new("");
|
GString *msg = g_string_new("");
|
||||||
while (indent > 0) {
|
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);
|
||||||
|
}
|
||||||
|
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, " ");
|
g_string_append(msg, " ");
|
||||||
indent--;
|
current_indent--;
|
||||||
}
|
}
|
||||||
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
||||||
g_string_append(msg, presence);
|
g_string_append(msg, presence);
|
||||||
@ -85,17 +115,24 @@ _rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, co
|
|||||||
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
|
} else if (status && prefs_get_boolean(PREF_ROSTER_STATUS)) {
|
||||||
g_string_append_printf(msg, "\"%s\"", status);
|
g_string_append_printf(msg, "\"%s\"", status);
|
||||||
}
|
}
|
||||||
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);
|
g_string_free(msg, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(colour));
|
wattroff(layout->subwin, theme_attrs(colour));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
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);
|
GList *resources = p_contact_get_available_resources(contact);
|
||||||
if (resources) {
|
if (resources) {
|
||||||
|
int resource_indent = prefs_get_roster_resource_indent();
|
||||||
|
if (resource_indent > 0) {
|
||||||
|
current_indent += resource_indent;
|
||||||
|
}
|
||||||
|
|
||||||
GList *curr_resource = resources;
|
GList *curr_resource = resources;
|
||||||
while (curr_resource) {
|
while (curr_resource) {
|
||||||
Resource *resource = curr_resource->data;
|
Resource *resource = curr_resource->data;
|
||||||
@ -104,16 +141,22 @@ _rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
|
|||||||
|
|
||||||
wattron(layout->subwin, theme_attrs(resource_presence_colour));
|
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);
|
g_string_append(msg, resource->name);
|
||||||
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
|
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);
|
g_string_free(msg, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
|
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_ROSTER_PRESENCE) || prefs_get_boolean(PREF_ROSTER_STATUS)) {
|
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);
|
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 *presence = p_contact_presence(contact);
|
||||||
const char *status = p_contact_status(contact);
|
const char *status = p_contact_status(contact);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
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);
|
g_list_free(resources);
|
||||||
|
|
||||||
@ -139,29 +182,42 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
|||||||
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
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();
|
char ch = prefs_get_roster_contact_char();
|
||||||
if (ch) {
|
if (ch) {
|
||||||
g_string_append_printf(msg, "%c", ch);
|
g_string_append_printf(msg, "%c", ch);
|
||||||
}
|
}
|
||||||
g_string_append(msg, name);
|
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);
|
g_string_free(msg, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
wattroff(layout->subwin, theme_attrs(presence_colour));
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
|
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)) {
|
} 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
|
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);
|
GSList *contacts = roster_get_contacts_by_presence(presence);
|
||||||
|
|
||||||
// if this group has contacts, or if we want to show empty groups
|
// if this group has contacts, or if we want to show empty groups
|
||||||
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
|
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
|
||||||
|
if (newline) {
|
||||||
|
win_sub_newline_lazy(layout->subwin);
|
||||||
|
}
|
||||||
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
GString *title_str = g_string_new(" ");
|
GString *title_str = g_string_new(" ");
|
||||||
char ch = prefs_get_roster_header_char();
|
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)) {
|
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
|
||||||
g_string_append_printf(title_str, " (%d)", g_slist_length(contacts));
|
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);
|
g_string_free(title_str, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
}
|
}
|
||||||
@ -189,7 +245,7 @@ _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const prese
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
|
_rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group, gboolean newline)
|
||||||
{
|
{
|
||||||
GSList *contacts = NULL;
|
GSList *contacts = NULL;
|
||||||
|
|
||||||
@ -200,8 +256,12 @@ _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)) {
|
||||||
|
if (newline) {
|
||||||
|
win_sub_newline_lazy(layout->subwin);
|
||||||
|
}
|
||||||
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
GString *title = g_string_new(" ");
|
GString *title = g_string_new(" ");
|
||||||
char ch = prefs_get_roster_header_char();
|
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)) {
|
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
|
||||||
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
|
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);
|
g_string_free(title, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
|
|
||||||
@ -227,7 +287,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
|
_rosterwin_contacts_by_no_group(ProfLayoutSplit *layout, gboolean newline)
|
||||||
{
|
{
|
||||||
GSList *contacts = NULL;
|
GSList *contacts = NULL;
|
||||||
|
|
||||||
@ -238,8 +298,12 @@ _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)) {
|
||||||
|
if (newline) {
|
||||||
|
win_sub_newline_lazy(layout->subwin);
|
||||||
|
}
|
||||||
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
GString *title = g_string_new(" ");
|
GString *title = g_string_new(" ");
|
||||||
char ch = prefs_get_roster_header_char();
|
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)) {
|
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
|
||||||
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
|
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);
|
g_string_free(title, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
|
|
||||||
@ -269,31 +333,36 @@ void
|
|||||||
rosterwin_roster(void)
|
rosterwin_roster(void)
|
||||||
{
|
{
|
||||||
ProfWin *console = wins_get_console();
|
ProfWin *console = wins_get_console();
|
||||||
if (console) {
|
if (!console) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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", FALSE);
|
||||||
_rosterwin_contacts_by_presence(layout, "online", "Online");
|
_rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
|
||||||
_rosterwin_contacts_by_presence(layout, "away", "Away");
|
_rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
|
||||||
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away");
|
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
|
||||||
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb");
|
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
|
||||||
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
|
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
|
||||||
_rosterwin_contacts_by_presence(layout, "offline", "Offline");
|
_rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
|
||||||
}
|
}
|
||||||
} else if (g_strcmp0(by, "group") == 0) {
|
} else if (g_strcmp0(by, "group") == 0) {
|
||||||
werase(layout->subwin);
|
werase(layout->subwin);
|
||||||
|
gboolean newline = FALSE;
|
||||||
GSList *groups = roster_get_groups();
|
GSList *groups = roster_get_groups();
|
||||||
GSList *curr_group = groups;
|
GSList *curr_group = groups;
|
||||||
while (curr_group) {
|
while (curr_group) {
|
||||||
_rosterwin_contacts_by_group(layout, curr_group->data);
|
_rosterwin_contacts_by_group(layout, curr_group->data, newline);
|
||||||
|
newline = TRUE;
|
||||||
curr_group = g_slist_next(curr_group);
|
curr_group = g_slist_next(curr_group);
|
||||||
}
|
}
|
||||||
g_slist_free_full(groups, free);
|
g_slist_free_full(groups, free);
|
||||||
_rosterwin_contacts_by_no_group(layout);
|
_rosterwin_contacts_by_no_group(layout, newline);
|
||||||
} else {
|
} else {
|
||||||
GSList *contacts = NULL;
|
GSList *contacts = NULL;
|
||||||
|
|
||||||
@ -304,6 +373,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);
|
||||||
|
|
||||||
@ -317,7 +387,7 @@ rosterwin_roster(void)
|
|||||||
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
|
if (prefs_get_boolean(PREF_ROSTER_COUNT)) {
|
||||||
g_string_append_printf(title, " (%d)", g_slist_length(contacts));
|
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);
|
g_string_free(title, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||||
|
|
||||||
@ -331,6 +401,5 @@ rosterwin_roster(void)
|
|||||||
}
|
}
|
||||||
g_slist_free(contacts);
|
g_slist_free(contacts);
|
||||||
}
|
}
|
||||||
free(by);
|
prefs_free_string(by);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1266,12 +1266,25 @@ win_unread(ProfWin *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_printline_nowrap(WINDOW *win, char *msg)
|
win_sub_print(WINDOW *win, char *msg, gboolean newline, gboolean wrap)
|
||||||
{
|
{
|
||||||
int maxx = getmaxx(win);
|
int maxx = getmaxx(win);
|
||||||
|
int curx = getcurx(win);
|
||||||
int cury = getcury(win);
|
int cury = getcury(win);
|
||||||
|
|
||||||
waddnstr(win, msg, maxx);
|
waddnstr(win, msg, maxx - curx);
|
||||||
|
|
||||||
|
if (newline) {
|
||||||
wmove(win, cury+1, 0);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -67,7 +67,8 @@ void win_newline(ProfWin *window);
|
|||||||
void win_redraw(ProfWin *window);
|
void win_redraw(ProfWin *window);
|
||||||
int win_roster_cols(void);
|
int win_roster_cols(void);
|
||||||
int win_occpuants_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);
|
void win_mark_received(ProfWin *window, const char *const id);
|
||||||
|
|
||||||
gboolean win_has_active_subwin(ProfWin *window);
|
gboolean win_has_active_subwin(ProfWin *window);
|
||||||
|
@ -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
|
||||||
|
@ -84,6 +84,9 @@ roster.priority=
|
|||||||
roster.size=
|
roster.size=
|
||||||
roster.header.char=
|
roster.header.char=
|
||||||
roster.contact.char=
|
roster.contact.char=
|
||||||
|
roster.contact.indent=
|
||||||
|
roster.resource.indent=
|
||||||
|
roster.presence.indent=
|
||||||
occupants=
|
occupants=
|
||||||
occupants.size=
|
occupants.size=
|
||||||
occupants.jid=
|
occupants.jid=
|
||||||
|
@ -71,19 +71,21 @@ resource.message=true
|
|||||||
statuses.console=all
|
statuses.console=all
|
||||||
statuses.chat=all
|
statuses.chat=all
|
||||||
statuses.muc=all
|
statuses.muc=all
|
||||||
roster=true
|
roster.by=presence
|
||||||
roster.offline=true
|
roster.offline=true
|
||||||
roster.resource=true
|
roster.empty=false
|
||||||
roster.presence=true
|
roster.presence=true
|
||||||
roster.status=true
|
|
||||||
roster.empty=true
|
|
||||||
roster.by=group
|
|
||||||
roster.order=presence
|
roster.order=presence
|
||||||
|
roster.status=true
|
||||||
|
roster.resource=true
|
||||||
|
roster.priority=false
|
||||||
|
roster=true
|
||||||
roster.count=true
|
roster.count=true
|
||||||
roster.priority=true
|
|
||||||
roster.size=25
|
roster.size=25
|
||||||
|
roster.contact.indent=1
|
||||||
|
roster.resource.indent=2
|
||||||
|
roster.presence.indent=-1
|
||||||
roster.header.char=@
|
roster.header.char=@
|
||||||
roster.contact.char=-
|
|
||||||
occupants=true
|
occupants=true
|
||||||
occupants.size=15
|
occupants.size=15
|
||||||
occupants.jid=false
|
occupants.jid=false
|
||||||
|
@ -31,6 +31,9 @@ roster.priority=true
|
|||||||
roster.size=25
|
roster.size=25
|
||||||
roster.header.char=-
|
roster.header.char=-
|
||||||
roster.contact.char=-
|
roster.contact.char=-
|
||||||
|
roster.contact.indent=2
|
||||||
|
roster.resource.indent=2
|
||||||
|
roster.presence.indent=2
|
||||||
privileges=true
|
privileges=true
|
||||||
presence=true
|
presence=true
|
||||||
intype=true
|
intype=true
|
||||||
|
@ -28,6 +28,9 @@ roster.order=presence
|
|||||||
roster.count=false
|
roster.count=false
|
||||||
roster.priority=false
|
roster.priority=false
|
||||||
roster.size=25
|
roster.size=25
|
||||||
|
roster.contact.indent=0
|
||||||
|
roster.resource.indent=0
|
||||||
|
roster.presence.indent=-1
|
||||||
privileges=false
|
privileges=false
|
||||||
presence=false
|
presence=false
|
||||||
intype=false
|
intype=false
|
||||||
|
Loading…
Reference in New Issue
Block a user