Merge /group command into /roster

Fix https://github.com/profanity-im/profanity/issues/1229
Regards https://github.com/profanity-im/profanity/issues/1116
This commit is contained in:
Michael Vetter
2019-11-25 10:40:25 +01:00
parent 548b64f6c5
commit f0a719d1e1
3 changed files with 118 additions and 146 deletions

View File

@@ -266,7 +266,8 @@ static struct cmd_t command_defs[] =
{ "/roster",
parse_args_with_freetext, 0, 4, NULL,
CMD_NOSUBFUNCS
CMD_SUBFUNCS(
{ "group", cmd_group })
CMD_MAINFUNC(cmd_roster)
CMD_TAGS(
CMD_TAG_ROSTER,
@@ -304,80 +305,87 @@ static struct cmd_t command_defs[] =
"/roster remove <jid>",
"/roster remove_all contacts",
"/roster nick <jid> <nick>",
"/roster clearnick <jid>")
"/roster clearnick <jid>",
"/roster group",
"/roster group show <group>",
"/roster group add <group> <contat>",
"/roster group remove <group> <contact>")
CMD_DESC(
"Manage your roster, and roster display settings. "
"Passing no arguments lists all contacts in your roster.")
CMD_ARGS(
{ "online", "Show all online contacts in console." },
{ "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in roster panel." },
{ "show resource", "Show contact's connected resources in roster panel." },
{ "show presence", "Show contact's presence in roster panel." },
{ "show status", "Show contact's status message in roster panel." },
{ "show empty", "Show empty groups in roster panel." },
{ "show priority", "Show resource priority in roster panel." },
{ "show contacts", "Show contacts in roster panel." },
{ "show rooms", "Show chat rooms in roster panel." },
{ "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in roster panel." },
{ "hide resource", "Hide contact's connected resources in roster panel." },
{ "hide presence", "Hide contact's presence in roster panel." },
{ "hide status", "Hide contact's status message in roster panel." },
{ "hide empty", "Hide empty groups in roster panel." },
{ "hide priority", "Hide resource priority in roster panel." },
{ "hide contacts", "Hide contacts in roster panel." },
{ "hide rooms", "Hide chat rooms in roster panel." },
{ "by group", "Group contacts in roster panel by roster group." },
{ "by presence", "Group contacts in roster panel by presence." },
{ "by none", "No grouping in roster panel." },
{ "count unread", "Show unread message count with roster headers." },
{ "count items", "Show item count with roster headers." },
{ "count off", "Do not show any count with roster headers." },
{ "count zero on", "Show roster header count when 0." },
{ "count zero off", "Hide roster header count when 0." },
{ "order name", "Order roster contacts by name only." },
{ "order presence", "Order roster contacts by presence, and then by name." },
{ "unread before", "Show unread message count before contact." },
{ "unread after", "Show unread message count after contact." },
{ "unread off", "Do not show unread message count for contacts." },
{ "room char <char>", "Prefix rooms with specified character." },
{ "room char none", "Remove room character prefix." },
{ "room private char <char>", "Prefix private room chat with specified character when displayed with room." },
{ "room private char none", "Remove private room chat character prefix when displayed with room." },
{ "room position first", "Show rooms first in roster." },
{ "room position last", "Show rooms last in roster." },
{ "room by service", "Group rooms by chat service." },
{ "room by none", "Do not group rooms." },
{ "room order name", "Order rooms by name." },
{ "room order unread", "Order rooms by unread messages, and then by name." },
{ "room unread before", "Show unread message count before room." },
{ "room unread after", "Show unread message count after room." },
{ "room unread off", "Do not show unread message count for rooms." },
{ "room show server", "Show the conference server with room JIDs." },
{ "room hide server", "Do not show the conference server with room JIDs." },
{ "private room", "Show room private chats with the room." },
{ "private group", "Show room private chats as a separate roster group." },
{ "private off", "Do not show room private chats." },
{ "private char <char>", "Prefix private room chats with specified character when displayed in separate group." },
{ "private char none", "Remove private room chat character prefix." },
{ "header char <char>", "Prefix roster headers with specified character." },
{ "header char none", "Remove roster header character prefix." },
{ "contact char <char>", "Prefix roster contacts with specified character." },
{ "contact char none", "Remove roster contact character prefix." },
{ "contact indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
{ "resource char <char>", "Prefix roster resources with specified character." },
{ "resource char none", "Remove roster resource character prefix." },
{ "resource indent <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
{ "resource join on|off", "Join resource with previous line when only one available resource." },
{ "presence indent <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
{ "size <percent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "wrap on|off", "Enable or disable line wrapping in roster panel." },
{ "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." },
{ "remove_all contacts", "Remove all items from roster." },
{ "nick <jid> <nick>", "Change a contacts nickname." },
{ "clearnick <jid>", "Removes the current nickname." })
{ "online", "Show all online contacts in console." },
{ "show", "Show the roster panel." },
{ "show offline", "Show offline contacts in roster panel." },
{ "show resource", "Show contact's connected resources in roster panel." },
{ "show presence", "Show contact's presence in roster panel." },
{ "show status", "Show contact's status message in roster panel." },
{ "show empty", "Show empty groups in roster panel." },
{ "show priority", "Show resource priority in roster panel." },
{ "show contacts", "Show contacts in roster panel." },
{ "show rooms", "Show chat rooms in roster panel." },
{ "hide", "Hide the roster panel." },
{ "hide offline", "Hide offline contacts in roster panel." },
{ "hide resource", "Hide contact's connected resources in roster panel." },
{ "hide presence", "Hide contact's presence in roster panel." },
{ "hide status", "Hide contact's status message in roster panel." },
{ "hide empty", "Hide empty groups in roster panel." },
{ "hide priority", "Hide resource priority in roster panel." },
{ "hide contacts", "Hide contacts in roster panel." },
{ "hide rooms", "Hide chat rooms in roster panel." },
{ "by group", "Group contacts in roster panel by roster group." },
{ "by presence", "Group contacts in roster panel by presence." },
{ "by none", "No grouping in roster panel." },
{ "count unread", "Show unread message count with roster headers." },
{ "count items", "Show item count with roster headers." },
{ "count off", "Do not show any count with roster headers." },
{ "count zero on", "Show roster header count when 0." },
{ "count zero off", "Hide roster header count when 0." },
{ "order name", "Order roster contacts by name only." },
{ "order presence", "Order roster contacts by presence, and then by name." },
{ "unread before", "Show unread message count before contact." },
{ "unread after", "Show unread message count after contact." },
{ "unread off", "Do not show unread message count for contacts." },
{ "room char <char>", "Prefix rooms with specified character." },
{ "room char none", "Remove room character prefix." },
{ "room private char <char>", "Prefix private room chat with specified character when displayed with room." },
{ "room private char none", "Remove private room chat character prefix when displayed with room." },
{ "room position first", "Show rooms first in roster." },
{ "room position last", "Show rooms last in roster." },
{ "room by service", "Group rooms by chat service." },
{ "room by none", "Do not group rooms." },
{ "room order name", "Order rooms by name." },
{ "room order unread", "Order rooms by unread messages, and then by name." },
{ "room unread before", "Show unread message count before room." },
{ "room unread after", "Show unread message count after room." },
{ "room unread off", "Do not show unread message count for rooms." },
{ "room show server", "Show the conference server with room JIDs." },
{ "room hide server", "Do not show the conference server with room JIDs." },
{ "private room", "Show room private chats with the room." },
{ "private group", "Show room private chats as a separate roster group." },
{ "private off", "Do not show room private chats." },
{ "private char <char>", "Prefix private room chats with specified character when displayed in separate group." },
{ "private char none", "Remove private room chat character prefix." },
{ "header char <char>", "Prefix roster headers with specified character." },
{ "header char none", "Remove roster header character prefix." },
{ "contact char <char>", "Prefix roster contacts with specified character." },
{ "contact char none", "Remove roster contact character prefix." },
{ "contact indent <indent>", "Indent contact line by <indent> spaces (0 to 10)." },
{ "resource char <char>", "Prefix roster resources with specified character." },
{ "resource char none", "Remove roster resource character prefix." },
{ "resource indent <indent>", "Indent resource line by <indent> spaces (0 to 10)." },
{ "resource join on|off", "Join resource with previous line when only one available resource." },
{ "presence indent <indent>", "Indent presence line by <indent> spaces (-1 to 10), a value of -1 will show presence on the previous line." },
{ "size <percent>", "Percentage of the screen taken up by the roster (1-99)." },
{ "wrap on|off", "Enable or disable line wrapping in roster panel." },
{ "add <jid> [<nick>]", "Add a new item to the roster." },
{ "remove <jid>", "Removes an item from the roster." },
{ "remove_all contacts", "Remove all items from roster." },
{ "nick <jid> <nick>", "Change a contacts nickname." },
{ "clearnick <jid>", "Removes the current nickname." },
{ "group show <group>", "List all roster items in a group." },
{ "group add <group> <contact>", "Add a contact to a group." },
{ "group remove <group> <contact>", "Remove a contact from a group." })
CMD_EXAMPLES(
"/roster",
"/roster add someone@contacts.org",
@@ -385,7 +393,12 @@ static struct cmd_t command_defs[] =
"/roster remove someone@contacts.org",
"/roster nick myfriend@chat.org \"My Friend\"",
"/roster clearnick kai@server.com",
"/roster size 15")
"/roster size 15",
"/roster group",
"/roster group show friends",
"/roster group add friends newfriend@server.org",
"/roster group add family Brother",
"/roster group remove colleagues boss@work.com")
},
{ "/blocked",
@@ -410,33 +423,6 @@ static struct cmd_t command_defs[] =
"/blocked add profanity@rooms.dismail.de/spammy-user")
},
{ "/group",
parse_args_with_freetext, 0, 3, NULL,
CMD_NOSUBFUNCS
CMD_MAINFUNC(cmd_group)
CMD_TAGS(
CMD_TAG_ROSTER,
CMD_TAG_UI)
CMD_SYN(
"/group",
"/group show <group>",
"/group add <group> <contat>",
"/group remove <group> <contact>")
CMD_DESC(
"View, add to, and remove from roster groups. "
"Passing no argument will list all roster groups.")
CMD_ARGS(
{ "show <group>", "List all roster items in a group." },
{ "add <group> <contact>", "Add a contact to a group." },
{ "remove <group> <contact>", "Remove a contact from a group." })
CMD_EXAMPLES(
"/group",
"/group show friends",
"/group add friends newfriend@server.org",
"/group add family Brother",
"/group remove colleagues boss@work.com")
},
{ "/info",
parse_args, 0, 1, NULL,
CMD_NOSUBFUNCS