mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Renamed args to /occupants default
This commit is contained in:
parent
ce7cb3f40f
commit
3615736762
@ -1,5 +1,5 @@
|
|||||||
|
Reorganise/simplify room commands
|
||||||
|
Fix room commands help
|
||||||
Show role/affiliation on join
|
Show role/affiliation on join
|
||||||
Show role/affiliation on update
|
Show role/affiliation on update
|
||||||
Check all commands from private conversations
|
Check all commands from private conversations
|
||||||
Add /occupants show|hide command
|
|
||||||
Add preference whether to show occupants panel by default
|
|
||||||
|
@ -89,6 +89,7 @@ static char * _join_autocomplete(char *input, int *size);
|
|||||||
static char * _log_autocomplete(char *input, int *size);
|
static char * _log_autocomplete(char *input, int *size);
|
||||||
static char * _form_autocomplete(char *input, int *size);
|
static char * _form_autocomplete(char *input, int *size);
|
||||||
static char * _room_autocomplete(char *input, int *size);
|
static char * _room_autocomplete(char *input, int *size);
|
||||||
|
static char * _occupants_autocomplete(char *input, int *size);
|
||||||
|
|
||||||
GHashTable *commands = NULL;
|
GHashTable *commands = NULL;
|
||||||
|
|
||||||
@ -318,12 +319,13 @@ static struct cmd_t command_defs[] =
|
|||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/occupants",
|
{ "/occupants",
|
||||||
cmd_occupants, parse_args, 1, 1, NULL,
|
cmd_occupants, parse_args, 1, 2, &cons_occupants_setting,
|
||||||
{ "/occupants show|hide", "Room configuration.",
|
{ "/occupants show|hide|default [show|hide]", "Show or hide room occupants.",
|
||||||
{ "/occupants show|hide",
|
{ "/occupants show|hide|default [show|hide]",
|
||||||
"--------------------",
|
"----------------------------------------",
|
||||||
"show - Show the occupants panel in chat rooms.",
|
"show - Show the occupants panel in chat rooms.",
|
||||||
"hide - Hide the occupants panel in chat rooms.",
|
"hide - Hide the occupants panel in chat rooms.",
|
||||||
|
"default - Whether occupants are shown by default in new rooms, 'show' or 'hide'",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/form",
|
{ "/form",
|
||||||
@ -988,6 +990,7 @@ static Autocomplete room_cmd_ac;
|
|||||||
static Autocomplete room_subject_ac;
|
static Autocomplete room_subject_ac;
|
||||||
static Autocomplete form_ac;
|
static Autocomplete form_ac;
|
||||||
static Autocomplete occupants_ac;
|
static Autocomplete occupants_ac;
|
||||||
|
static Autocomplete occupants_default_ac;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise command autocompleter and history
|
* Initialise command autocompleter and history
|
||||||
@ -1299,6 +1302,11 @@ cmd_init(void)
|
|||||||
occupants_ac = autocomplete_new();
|
occupants_ac = autocomplete_new();
|
||||||
autocomplete_add(occupants_ac, "show");
|
autocomplete_add(occupants_ac, "show");
|
||||||
autocomplete_add(occupants_ac, "hide");
|
autocomplete_add(occupants_ac, "hide");
|
||||||
|
autocomplete_add(occupants_ac, "default");
|
||||||
|
|
||||||
|
occupants_default_ac = autocomplete_new();
|
||||||
|
autocomplete_add(occupants_default_ac, "show");
|
||||||
|
autocomplete_add(occupants_default_ac, "hide");
|
||||||
|
|
||||||
cmd_history_init();
|
cmd_history_init();
|
||||||
}
|
}
|
||||||
@ -1349,6 +1357,7 @@ cmd_uninit(void)
|
|||||||
autocomplete_free(room_subject_ac);
|
autocomplete_free(room_subject_ac);
|
||||||
autocomplete_free(form_ac);
|
autocomplete_free(form_ac);
|
||||||
autocomplete_free(occupants_ac);
|
autocomplete_free(occupants_ac);
|
||||||
|
autocomplete_free(occupants_default_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -1481,6 +1490,7 @@ cmd_reset_autocomplete()
|
|||||||
autocomplete_reset(room_subject_ac);
|
autocomplete_reset(room_subject_ac);
|
||||||
autocomplete_reset(form_ac);
|
autocomplete_reset(form_ac);
|
||||||
autocomplete_reset(occupants_ac);
|
autocomplete_reset(occupants_ac);
|
||||||
|
autocomplete_reset(occupants_default_ac);
|
||||||
|
|
||||||
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
||||||
ProfWin *window = wins_get_current();
|
ProfWin *window = wins_get_current();
|
||||||
@ -1738,8 +1748,8 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/occupants" };
|
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins" };
|
||||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, occupants_ac };
|
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||||
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
||||||
@ -1769,6 +1779,7 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
g_hash_table_insert(ac_funcs, "/join", _join_autocomplete);
|
g_hash_table_insert(ac_funcs, "/join", _join_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
|
g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/room", _room_autocomplete);
|
g_hash_table_insert(ac_funcs, "/room", _room_autocomplete);
|
||||||
|
g_hash_table_insert(ac_funcs, "/occupants", _occupants_autocomplete);
|
||||||
|
|
||||||
char parsed[*size+1];
|
char parsed[*size+1];
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -2291,6 +2302,24 @@ _form_autocomplete(char *input, int *size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_occupants_autocomplete(char *input, int *size)
|
||||||
|
{
|
||||||
|
char *found = NULL;
|
||||||
|
|
||||||
|
found = autocomplete_param_with_ac(input, size, "/occupants default", occupants_default_ac, TRUE);
|
||||||
|
if (found != NULL) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
found = autocomplete_param_with_ac(input, size, "/occupants", occupants_ac, TRUE);
|
||||||
|
if (found != NULL) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_room_autocomplete(char *input, int *size)
|
_room_autocomplete(char *input, int *size)
|
||||||
{
|
{
|
||||||
|
@ -2336,9 +2336,24 @@ cmd_occupants(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(args[0], "default") == 0) {
|
||||||
|
if (g_strcmp0(args[1], "show") == 0) {
|
||||||
|
cons_show("Occupant list enabled.");
|
||||||
|
prefs_set_boolean(PREF_OCCUPANTS, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
} else if (g_strcmp0(args[1], "hide") == 0) {
|
||||||
|
cons_show("Occupant list disabled.");
|
||||||
|
prefs_set_boolean(PREF_OCCUPANTS, FALSE);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
win_type_t win_type = ui_current_win_type();
|
win_type_t win_type = ui_current_win_type();
|
||||||
if (win_type != WIN_MUC) {
|
if (win_type != WIN_MUC) {
|
||||||
cons_show("Command '/occupants' does not apply to this window.");
|
cons_show("Cannot show/hide occupant list when not in chat room.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,6 +693,12 @@ handle_muc_self_online(const char * const room, const char * const nick, gboolea
|
|||||||
muc_invites_remove(room);
|
muc_invites_remove(room);
|
||||||
muc_roster_set_complete(room);
|
muc_roster_set_complete(room);
|
||||||
|
|
||||||
|
// show roster if occupants list disabled by default
|
||||||
|
if (!prefs_get_boolean(PREF_OCCUPANTS)) {
|
||||||
|
GList *roster = muc_roster(room);
|
||||||
|
ui_room_roster(room, roster, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
char *subject = muc_subject(room);
|
char *subject = muc_subject(room);
|
||||||
if (subject != NULL) {
|
if (subject != NULL) {
|
||||||
ui_room_subject(room, NULL, subject);
|
ui_room_subject(room, NULL, subject);
|
||||||
|
@ -848,6 +848,15 @@ _cons_splash_setting(void)
|
|||||||
cons_show("Splash screen (/splash) : OFF");
|
cons_show("Splash screen (/splash) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cons_occupants_setting(void)
|
||||||
|
{
|
||||||
|
if (prefs_get_boolean(PREF_OCCUPANTS))
|
||||||
|
cons_show("Occupants (/occupants) : show");
|
||||||
|
else
|
||||||
|
cons_show("Occupants (/occupants) : hide");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cons_autoconnect_setting(void)
|
_cons_autoconnect_setting(void)
|
||||||
{
|
{
|
||||||
@ -916,6 +925,7 @@ _cons_show_ui_prefs(void)
|
|||||||
cons_vercheck_setting();
|
cons_vercheck_setting();
|
||||||
cons_mouse_setting();
|
cons_mouse_setting();
|
||||||
cons_statuses_setting();
|
cons_statuses_setting();
|
||||||
|
cons_occupants_setting();
|
||||||
cons_titlebar_setting();
|
cons_titlebar_setting();
|
||||||
|
|
||||||
cons_alert();
|
cons_alert();
|
||||||
@ -1300,6 +1310,7 @@ _cons_navigation_help(void)
|
|||||||
cons_show("ESC : Clear current input.");
|
cons_show("ESC : Clear current input.");
|
||||||
cons_show("TAB : Autocomplete.");
|
cons_show("TAB : Autocomplete.");
|
||||||
cons_show("PAGE UP, PAGE DOWN : Page the main window.");
|
cons_show("PAGE UP, PAGE DOWN : Page the main window.");
|
||||||
|
cons_show("SHIFT-PAGE UP, SHIFT-PAGE DOWN : Page the main window.");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
cons_alert();
|
cons_alert();
|
||||||
@ -1512,6 +1523,7 @@ console_init_module(void)
|
|||||||
cons_flash_setting = _cons_flash_setting;
|
cons_flash_setting = _cons_flash_setting;
|
||||||
cons_splash_setting = _cons_splash_setting;
|
cons_splash_setting = _cons_splash_setting;
|
||||||
cons_autoconnect_setting = _cons_autoconnect_setting;
|
cons_autoconnect_setting = _cons_autoconnect_setting;
|
||||||
|
cons_occupants_setting = _cons_occupants_setting;
|
||||||
cons_vercheck_setting = _cons_vercheck_setting;
|
cons_vercheck_setting = _cons_vercheck_setting;
|
||||||
cons_mouse_setting = _cons_mouse_setting;
|
cons_mouse_setting = _cons_mouse_setting;
|
||||||
cons_statuses_setting = _cons_statuses_setting;
|
cons_statuses_setting = _cons_statuses_setting;
|
||||||
|
@ -291,6 +291,7 @@ void (*cons_beep_setting)(void);
|
|||||||
void (*cons_flash_setting)(void);
|
void (*cons_flash_setting)(void);
|
||||||
void (*cons_splash_setting)(void);
|
void (*cons_splash_setting)(void);
|
||||||
void (*cons_vercheck_setting)(void);
|
void (*cons_vercheck_setting)(void);
|
||||||
|
void (*cons_occupants_setting)(void);
|
||||||
void (*cons_mouse_setting)(void);
|
void (*cons_mouse_setting)(void);
|
||||||
void (*cons_statuses_setting)(void);
|
void (*cons_statuses_setting)(void);
|
||||||
void (*cons_titlebar_setting)(void);
|
void (*cons_titlebar_setting)(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user