mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Add none option for /who
Fixes https://github.com/profanity-im/profanity/issues/1425 `/who none` now displays all users in an muc without an affiliation
This commit is contained in:
parent
409268e2b6
commit
03f8db9658
@ -627,6 +627,7 @@ cmd_ac_init(void)
|
||||
autocomplete_add(who_room_ac, "owner");
|
||||
autocomplete_add(who_room_ac, "admin");
|
||||
autocomplete_add(who_room_ac, "member");
|
||||
autocomplete_add(who_room_ac, "none");
|
||||
|
||||
bookmark_ac = autocomplete_new();
|
||||
autocomplete_add(bookmark_ac, "list");
|
||||
|
@ -1049,7 +1049,7 @@ static struct cmd_t command_defs[] = {
|
||||
"/who",
|
||||
"/who online|offline|away|dnd|xa|chat|available|unavailable|any [<group>]",
|
||||
"/who moderator|participant|visitor",
|
||||
"/who owner|admin|member")
|
||||
"/who owner|admin|member|none")
|
||||
CMD_DESC(
|
||||
"Show contacts or room occupants with chosen status, role or affiliation.")
|
||||
CMD_ARGS(
|
||||
@ -1060,7 +1060,7 @@ static struct cmd_t command_defs[] = {
|
||||
{ "any", "Contacts with any status (same as calling with no argument)." },
|
||||
{ "<group>", "Filter the results by the specified roster group, not applicable in chat rooms." },
|
||||
{ "moderator|participant|visitor", "Room occupants with the specified role." },
|
||||
{ "owner|admin|member", "Room occupants with the specified affiliation." })
|
||||
{ "owner|admin|member|none", "Room occupants with the specified affiliation." })
|
||||
CMD_EXAMPLES(
|
||||
"/who",
|
||||
"/who xa",
|
||||
|
@ -1763,7 +1763,7 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
|
||||
}
|
||||
|
||||
// bad arg
|
||||
if (args[0] && (g_strcmp0(args[0], "online") != 0) && (g_strcmp0(args[0], "available") != 0) && (g_strcmp0(args[0], "unavailable") != 0) && (g_strcmp0(args[0], "away") != 0) && (g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "xa") != 0) && (g_strcmp0(args[0], "dnd") != 0) && (g_strcmp0(args[0], "any") != 0) && (g_strcmp0(args[0], "moderator") != 0) && (g_strcmp0(args[0], "participant") != 0) && (g_strcmp0(args[0], "visitor") != 0) && (g_strcmp0(args[0], "owner") != 0) && (g_strcmp0(args[0], "admin") != 0) && (g_strcmp0(args[0], "member") != 0) && (g_strcmp0(args[0], "outcast") != 0)) {
|
||||
if (args[0] && (g_strcmp0(args[0], "online") != 0) && (g_strcmp0(args[0], "available") != 0) && (g_strcmp0(args[0], "unavailable") != 0) && (g_strcmp0(args[0], "away") != 0) && (g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "xa") != 0) && (g_strcmp0(args[0], "dnd") != 0) && (g_strcmp0(args[0], "any") != 0) && (g_strcmp0(args[0], "moderator") != 0) && (g_strcmp0(args[0], "participant") != 0) && (g_strcmp0(args[0], "visitor") != 0) && (g_strcmp0(args[0], "owner") != 0) && (g_strcmp0(args[0], "admin") != 0) && (g_strcmp0(args[0], "member") != 0) && (g_strcmp0(args[0], "outcast") != 0) && (g_strcmp0(args[0], "none") != 0)) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return;
|
||||
}
|
||||
@ -1858,6 +1858,10 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
|
||||
mucwin_show_affiliation_list(mucwin, MUC_AFFILIATION_OUTCAST);
|
||||
return;
|
||||
}
|
||||
if (g_strcmp0(args[0], "none") == 0) {
|
||||
mucwin_show_affiliation_list(mucwin, MUC_AFFILIATION_NONE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -723,6 +723,9 @@ mucwin_show_affiliation_list(ProfMucWin* mucwin, muc_affiliation_t affiliation)
|
||||
case MUC_AFFILIATION_OUTCAST:
|
||||
win_println(window, THEME_DEFAULT, "!", "No outcasts found.");
|
||||
break;
|
||||
case MUC_AFFILIATION_NONE:
|
||||
win_println(window, THEME_DEFAULT, "!", "No nones found.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -741,6 +744,9 @@ mucwin_show_affiliation_list(ProfMucWin* mucwin, muc_affiliation_t affiliation)
|
||||
case MUC_AFFILIATION_OUTCAST:
|
||||
win_println(window, THEME_DEFAULT, "!", "Outcasts:");
|
||||
break;
|
||||
case MUC_AFFILIATION_NONE:
|
||||
win_println(window, THEME_DEFAULT, "!", "Nones:");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user