mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
commit
4a165b81e6
@ -184,6 +184,7 @@ static Autocomplete occupants_ac;
|
||||
static Autocomplete occupants_default_ac;
|
||||
static Autocomplete occupants_show_ac;
|
||||
static Autocomplete occupants_header_ac;
|
||||
static Autocomplete occupants_header_char_ac;
|
||||
static Autocomplete occupants_char_ac;
|
||||
static Autocomplete time_ac;
|
||||
static Autocomplete time_format_ac;
|
||||
@ -688,6 +689,7 @@ cmd_ac_init(void)
|
||||
autocomplete_add(occupants_ac, "indent");
|
||||
autocomplete_add(occupants_ac, "header");
|
||||
autocomplete_add(occupants_ac, "wrap");
|
||||
autocomplete_add(occupants_ac, "char");
|
||||
|
||||
occupants_default_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_default_ac, "show");
|
||||
@ -696,11 +698,14 @@ cmd_ac_init(void)
|
||||
occupants_show_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_show_ac, "jid");
|
||||
|
||||
occupants_char_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_char_ac, "none");
|
||||
|
||||
occupants_header_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_header_ac, "char");
|
||||
|
||||
occupants_char_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_char_ac, "none");
|
||||
occupants_header_char_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_header_char_ac, "none");
|
||||
|
||||
time_ac = autocomplete_new();
|
||||
autocomplete_add(time_ac, "console");
|
||||
@ -1115,10 +1120,11 @@ cmd_ac_reset(ProfWin *window)
|
||||
autocomplete_reset(form_ac);
|
||||
autocomplete_reset(form_field_multi_ac);
|
||||
autocomplete_reset(occupants_ac);
|
||||
autocomplete_reset(occupants_char_ac);
|
||||
autocomplete_reset(occupants_default_ac);
|
||||
autocomplete_reset(occupants_show_ac);
|
||||
autocomplete_reset(occupants_header_ac);
|
||||
autocomplete_reset(occupants_char_ac);
|
||||
autocomplete_reset(occupants_header_char_ac);
|
||||
autocomplete_reset(time_ac);
|
||||
autocomplete_reset(time_format_ac);
|
||||
autocomplete_reset(resource_ac);
|
||||
@ -1247,6 +1253,7 @@ cmd_ac_uninit(void)
|
||||
autocomplete_free(form_ac);
|
||||
autocomplete_free(form_field_multi_ac);
|
||||
autocomplete_free(occupants_ac);
|
||||
autocomplete_free(occupants_char_ac);
|
||||
autocomplete_free(occupants_default_ac);
|
||||
autocomplete_free(occupants_show_ac);
|
||||
autocomplete_free(occupants_header_ac);
|
||||
@ -2563,6 +2570,11 @@ _occupants_autocomplete(ProfWin *window, const char *const input, gboolean previ
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/occupants char", occupants_char_ac, TRUE, previous);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
found = autocomplete_param_with_ac(input, "/occupants default hide", occupants_show_ac, TRUE, previous);
|
||||
if (found) {
|
||||
return found;
|
||||
|
@ -752,6 +752,7 @@ static struct cmd_t command_defs[] =
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
"/occupants show|hide [jid]",
|
||||
"/occupants char <char>|none",
|
||||
"/occupants default show|hide [jid]",
|
||||
"/occupants size [<percent>]",
|
||||
"/occupants indent <indent>",
|
||||
@ -761,6 +762,8 @@ static struct cmd_t command_defs[] =
|
||||
"Show or hide room occupants, and occupants panel display settings.")
|
||||
CMD_ARGS(
|
||||
{ "show", "Show the occupants panel in current room." },
|
||||
{ "char <char>", "Prefix occupants with specified character." },
|
||||
{ "char none", "Remove occupants character prefix." },
|
||||
{ "hide", "Hide the occupants panel in current room." },
|
||||
{ "show jid", "Show jid in the occupants panel in current room." },
|
||||
{ "hide jid", "Hide jid in the occupants panel in current room." },
|
||||
|
@ -4402,6 +4402,23 @@ cmd_occupants(ProfWin *window, const char *const command, gchar **args)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "char") == 0) {
|
||||
if (!args[1]) {
|
||||
cons_bad_cmd_usage(command);
|
||||
} else if (g_strcmp0(args[1], "none") == 0) {
|
||||
prefs_clear_occupants_char();
|
||||
cons_show("Occupants char removed.");
|
||||
|
||||
occupantswin_occupants_all();
|
||||
} else {
|
||||
prefs_set_occupants_char(args[1][0]);
|
||||
cons_show("Occupants char set to %c.", args[1][0]);
|
||||
|
||||
occupantswin_occupants_all();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "default") == 0) {
|
||||
if (g_strcmp0(args[1], "show") == 0) {
|
||||
if (g_strcmp0(args[2], "jid") == 0) {
|
||||
|
@ -750,6 +750,40 @@ prefs_get_occupants_size(void)
|
||||
}
|
||||
}
|
||||
|
||||
char
|
||||
prefs_get_occupants_char(void)
|
||||
{
|
||||
char result = 0;
|
||||
|
||||
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
|
||||
if (!resultstr) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_occupants_char(char ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", str);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
void
|
||||
prefs_clear_occupants_char(void)
|
||||
{
|
||||
g_key_file_remove_key(prefs, PREF_GROUP_UI, "occupants.char", NULL);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gint
|
||||
prefs_get_occupants_indent(void)
|
||||
{
|
||||
|
@ -240,6 +240,9 @@ void prefs_clear_roster_room_char(void);
|
||||
char prefs_get_roster_room_private_char(void);
|
||||
void prefs_set_roster_room_private_char(char ch);
|
||||
void prefs_clear_roster_room_private_char(void);
|
||||
char prefs_get_occupants_char(void);
|
||||
void prefs_set_occupants_char(char ch);
|
||||
void prefs_clear_occupants_char(void);
|
||||
char prefs_get_occupants_header_char(void);
|
||||
void prefs_set_occupants_header_char(char ch);
|
||||
void prefs_clear_occupants_header_char(void);
|
||||
|
@ -453,6 +453,16 @@ _load_preferences(void)
|
||||
prefs_set_occupants_size(occupants_size);
|
||||
}
|
||||
|
||||
if (g_key_file_has_key(theme, "ui", "occupants.char", NULL)) {
|
||||
gchar *ch = g_key_file_get_string(theme, "ui", "occupants.char", NULL);
|
||||
if (ch && strlen(ch) > 0) {
|
||||
prefs_set_occupants_char(ch[0]);
|
||||
g_free(ch);
|
||||
}
|
||||
} else {
|
||||
prefs_clear_occupants_char();
|
||||
}
|
||||
|
||||
if (g_key_file_has_key(theme, "ui", "occupants.indent", NULL)) {
|
||||
gint occupants_indent = g_key_file_get_integer(theme, "ui", "occupants.indent", NULL);
|
||||
prefs_set_occupants_indent(occupants_indent);
|
||||
|
@ -1237,6 +1237,12 @@ cons_occupants_setting(void)
|
||||
else
|
||||
cons_show("Occupants wrap (/occupants) : OFF");
|
||||
|
||||
char occupants_ch = prefs_get_occupants_char();
|
||||
if (occupants_ch)
|
||||
cons_show("Occupants char (/occupants) : %c", occupants_ch);
|
||||
else
|
||||
cons_show("Occupants char (/occupants) : none");
|
||||
|
||||
gint occupant_indent = prefs_get_occupants_indent();
|
||||
cons_show("Occupant indent (/occupants) : %d", occupant_indent);
|
||||
|
||||
|
@ -60,6 +60,11 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
|
||||
|
||||
GString *msg = g_string_new(spaces->str);
|
||||
|
||||
char ch = prefs_get_occupants_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(msg, "%c", ch);
|
||||
}
|
||||
|
||||
gboolean wrap = prefs_get_boolean(PREF_OCCUPANTS_WRAP);
|
||||
|
||||
g_string_append(msg, occupant->nick);
|
||||
|
@ -131,6 +131,7 @@ roster.private=
|
||||
roster.private.char=
|
||||
occupants=
|
||||
occupants.size=
|
||||
occupants.char=
|
||||
occupants.jid=
|
||||
occupants.wrap=
|
||||
occupants.indent=
|
||||
|
Loading…
Reference in New Issue
Block a user