mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
ce4aa34990
@ -280,6 +280,7 @@ static struct cmd_t command_defs[] =
|
||||
"/roster order name|presence",
|
||||
"/roster char header <char>|none",
|
||||
"/roster char contact <char>|none",
|
||||
"/roster char resource <char>|none",
|
||||
"/roster indent contact <indent>",
|
||||
"/roster indent resource <indent>",
|
||||
"/roster indent presence <indent>",
|
||||
@ -320,6 +321,8 @@ static struct cmd_t command_defs[] =
|
||||
{ "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." },
|
||||
{ "char resource <char>", "Prefix roster resources with specificed character." },
|
||||
{ "char resource none", "Remove roster resource character prefix." },
|
||||
{ "indent contact <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
|
||||
{ "indent resource <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
|
||||
{ "indent presence <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
|
||||
@ -2048,6 +2051,7 @@ cmd_init(void)
|
||||
roster_char_ac = autocomplete_new();
|
||||
autocomplete_add(roster_char_ac, "header");
|
||||
autocomplete_add(roster_char_ac, "contact");
|
||||
autocomplete_add(roster_char_ac, "resource");
|
||||
|
||||
roster_char_none_ac = autocomplete_new();
|
||||
autocomplete_add(roster_char_none_ac, "none");
|
||||
@ -2916,6 +2920,10 @@ _roster_autocomplete(ProfWin *window, const char *const input)
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
result = autocomplete_param_with_ac(input, "/roster char resource", roster_char_none_ac, TRUE);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete);
|
||||
if (result) {
|
||||
return result;
|
||||
|
@ -1787,6 +1787,18 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
||||
cons_show("Roster contact char set to %c.", args[2][0]);
|
||||
rosterwin_roster();
|
||||
}
|
||||
} else if (g_strcmp0(args[1], "resource") == 0) {
|
||||
if (!args[2]) {
|
||||
cons_bad_cmd_usage(command);
|
||||
} else if (g_strcmp0(args[2], "none") == 0) {
|
||||
prefs_clear_roster_resource_char();
|
||||
cons_show("Roster resource char removed.");
|
||||
rosterwin_roster();
|
||||
} else {
|
||||
prefs_set_roster_resource_char(args[2][0]);
|
||||
cons_show("Roster resource char set to %c.", args[2][0]);
|
||||
rosterwin_roster();
|
||||
}
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
@ -506,6 +506,40 @@ prefs_clear_roster_contact_char(void)
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
char
|
||||
prefs_get_roster_resource_char(void)
|
||||
{
|
||||
char result = 0;
|
||||
|
||||
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "roster.resource.char", NULL);
|
||||
if (!resultstr) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_roster_resource_char(char ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "roster.resource.char", str);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
void
|
||||
prefs_clear_roster_resource_char(void)
|
||||
{
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "roster.resource.char", NULL);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gint
|
||||
prefs_get_roster_contact_indent(void)
|
||||
{
|
||||
|
@ -172,6 +172,9 @@ void prefs_clear_roster_header_char(void);
|
||||
char prefs_get_roster_contact_char(void);
|
||||
void prefs_set_roster_contact_char(char ch);
|
||||
void prefs_clear_roster_contact_char(void);
|
||||
char prefs_get_roster_resource_char(void);
|
||||
void prefs_set_roster_resource_char(char ch);
|
||||
void prefs_clear_roster_resource_char(void);
|
||||
|
||||
gint prefs_get_roster_contact_indent(void);
|
||||
void prefs_set_roster_contact_indent(gint value);
|
||||
|
@ -484,6 +484,13 @@ _load_preferences(void)
|
||||
g_free(ch);
|
||||
}
|
||||
}
|
||||
if (g_key_file_has_key(theme, "ui", "roster.resource.char", NULL)) {
|
||||
gchar *ch = g_key_file_get_string(theme, "ui", "roster.resource.char", NULL);
|
||||
if (ch && strlen(ch) > 0) {
|
||||
prefs_set_roster_resource_char(ch[0]);
|
||||
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);
|
||||
|
@ -1255,6 +1255,12 @@ cons_roster_setting(void)
|
||||
else
|
||||
cons_show("Roster contact char (/roster) : none");
|
||||
|
||||
char resource_ch = prefs_get_roster_resource_char();
|
||||
if (resource_ch)
|
||||
cons_show("Roster resource char (/roster) : %c", resource_ch);
|
||||
else
|
||||
cons_show("Roster resource char (/roster) : none");
|
||||
|
||||
gint contact_indent = prefs_get_roster_contact_indent();
|
||||
cons_show("Roster contact indent (/roster) : %d", contact_indent);
|
||||
|
||||
|
@ -148,6 +148,10 @@ _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_inde
|
||||
g_string_append(msg, " ");
|
||||
this_indent--;
|
||||
}
|
||||
char ch = prefs_get_roster_resource_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(msg, "%c", ch);
|
||||
}
|
||||
g_string_append(msg, resource->name);
|
||||
if (prefs_get_boolean(PREF_ROSTER_PRIORITY)) {
|
||||
g_string_append_printf(msg, " %d", resource->priority);
|
||||
|
@ -84,6 +84,7 @@ roster.priority=
|
||||
roster.size=
|
||||
roster.header.char=
|
||||
roster.contact.char=
|
||||
roster.resource.char=
|
||||
roster.contact.indent=
|
||||
roster.resource.indent=
|
||||
roster.presence.indent=
|
||||
|
@ -31,6 +31,7 @@ roster.priority=true
|
||||
roster.size=25
|
||||
roster.header.char=-
|
||||
roster.contact.char=-
|
||||
roster.resource.char=-
|
||||
roster.contact.indent=2
|
||||
roster.resource.indent=2
|
||||
roster.presence.indent=2
|
||||
|
Loading…
x
Reference in New Issue
Block a user