1
0
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:
MarcoPolo-PasTonMolo 2022-03-27 16:06:29 +03:00
parent 409268e2b6
commit 03f8db9658
4 changed files with 14 additions and 3 deletions

View File

@ -627,6 +627,7 @@ cmd_ac_init(void)
autocomplete_add(who_room_ac, "owner"); autocomplete_add(who_room_ac, "owner");
autocomplete_add(who_room_ac, "admin"); autocomplete_add(who_room_ac, "admin");
autocomplete_add(who_room_ac, "member"); autocomplete_add(who_room_ac, "member");
autocomplete_add(who_room_ac, "none");
bookmark_ac = autocomplete_new(); bookmark_ac = autocomplete_new();
autocomplete_add(bookmark_ac, "list"); autocomplete_add(bookmark_ac, "list");

View File

@ -1049,7 +1049,7 @@ static struct cmd_t command_defs[] = {
"/who", "/who",
"/who online|offline|away|dnd|xa|chat|available|unavailable|any [<group>]", "/who online|offline|away|dnd|xa|chat|available|unavailable|any [<group>]",
"/who moderator|participant|visitor", "/who moderator|participant|visitor",
"/who owner|admin|member") "/who owner|admin|member|none")
CMD_DESC( CMD_DESC(
"Show contacts or room occupants with chosen status, role or affiliation.") "Show contacts or room occupants with chosen status, role or affiliation.")
CMD_ARGS( CMD_ARGS(
@ -1060,7 +1060,7 @@ static struct cmd_t command_defs[] = {
{ "any", "Contacts with any status (same as calling with no argument)." }, { "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." }, { "<group>", "Filter the results by the specified roster group, not applicable in chat rooms." },
{ "moderator|participant|visitor", "Room occupants with the specified role." }, { "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( CMD_EXAMPLES(
"/who", "/who",
"/who xa", "/who xa",

View File

@ -1763,7 +1763,7 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
} }
// bad arg // 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); cons_bad_cmd_usage(command);
return; return;
} }
@ -1858,6 +1858,10 @@ _who_room(ProfWin* window, const char* const command, gchar** args)
mucwin_show_affiliation_list(mucwin, MUC_AFFILIATION_OUTCAST); mucwin_show_affiliation_list(mucwin, MUC_AFFILIATION_OUTCAST);
return; return;
} }
if (g_strcmp0(args[0], "none") == 0) {
mucwin_show_affiliation_list(mucwin, MUC_AFFILIATION_NONE);
return;
}
} }
} }

View File

@ -723,6 +723,9 @@ mucwin_show_affiliation_list(ProfMucWin* mucwin, muc_affiliation_t affiliation)
case MUC_AFFILIATION_OUTCAST: case MUC_AFFILIATION_OUTCAST:
win_println(window, THEME_DEFAULT, "!", "No outcasts found."); win_println(window, THEME_DEFAULT, "!", "No outcasts found.");
break; break;
case MUC_AFFILIATION_NONE:
win_println(window, THEME_DEFAULT, "!", "No nones found.");
break;
default: default:
break; break;
} }
@ -741,6 +744,9 @@ mucwin_show_affiliation_list(ProfMucWin* mucwin, muc_affiliation_t affiliation)
case MUC_AFFILIATION_OUTCAST: case MUC_AFFILIATION_OUTCAST:
win_println(window, THEME_DEFAULT, "!", "Outcasts:"); win_println(window, THEME_DEFAULT, "!", "Outcasts:");
break; break;
case MUC_AFFILIATION_NONE:
win_println(window, THEME_DEFAULT, "!", "Nones:");
break;
default: default:
break; break;
} }