From 59dd87d5f886d54e09ac012934aaad1bdfec2be6 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Tue, 21 Jul 2015 22:55:39 +0100
Subject: [PATCH 01/25] Fix /help commands spacing
---
src/command/commands.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/command/commands.c b/src/command/commands.c
index 810772d5..2e377f4e 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -795,7 +795,7 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
GList *curr = ordered_commands;
while (curr) {
Command *cmd = curr->data;
- cons_show("%-12s: %s", cmd->cmd, cmd->help.short_help);
+ cons_show("%-13s: %s", cmd->cmd, cmd->help.short_help);
curr = g_list_next(curr);
}
g_list_free(ordered_commands);
From e66f0cf7569f8f959ef3ce7faed4e1a94a97c470 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Wed, 22 Jul 2015 00:47:03 +0100
Subject: [PATCH 02/25] Added help example text
---
helpexample.txt | 89 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
create mode 100644 helpexample.txt
diff --git a/helpexample.txt b/helpexample.txt
new file mode 100644
index 00000000..4dc40169
--- /dev/null
+++ b/helpexample.txt
@@ -0,0 +1,89 @@
+ROSTER
+
+Synopsis:
+/roster
+/roster online
+/roster show [offline|resource|empty]
+/roster hide [offline|resource|empty]
+/roster by group|presence|none
+/roster size
+/roster add []
+/roster remove
+/roster remove_all contacts
+/roster nick
+/roster clearnick
+
+Description:
+Manage your roster, and roster display settings. Passing no arguments displays your roster.
+
+Arguments:
+online : Show all online contacts in your roster.
+show : Show the roster panel.
+show offline : Show offline contacts in the roster panel.
+show resource : Show contact's connected resources in the roster panel.
+show empty : When grouping by presence, show empty presence groups
+hide : Hide the roster panel.
+hide offline : Hide offline contacts in the roster panel.
+hide resource : Hide contact's connected resources in the roster panel.
+hide empty : When grouping by presence, hide empty presence groups
+by group : Group contacts in the roster panel by roster group.
+by presence : Group contacts in the roster panel by presence.
+by none : No grouping in the roster panel.
+size : Percentage of the screen taken up by the roster (1-99).
+add [] : Add a new item to the roster.
+remove : Removes an item from the roster.
+remove_all contacts : Remove all items from roster.
+nick : Change a contacts nickname.
+clearnick : Removes the current nickname.
+
+Exmaples:
+/roster
+/roster add someone@contacts.org
+/roster add someone@contacts.org Buddy
+/roster remove someone@contacts.org
+/roster nick myfriend@chat.org My Friend
+/roster clearnick kai@server.com
+/roster size 15
+
+OTR
+
+Synopsis:
+/otr gen
+/otr myfp
+/otr theirfp
+/otr start []
+/otr end
+/otr trust
+/otr untrust
+/otr log on|off|redact
+/otr warn on|off
+/otr libver
+/otr policy manual|opportunistic|always
+/otr secret
+/otr question
+/otr answer
+
+Description:
+Off The Record message encryption commands.
+
+Arguments:
+gen : Generate your private key.
+myfp : Show your fingerprint.
+theirfp : Show contacts fingerprint.
+start : Start an OTR session with current recipient.
+start : Start an OTR session with the contact.
+end : End the current OTR session.
+trust : Indicate that you have verified the contact's fingerprint.
+untrust : Indicate the the contact's fingerprint is not verified.
+log on : Enable plaintext logging of OTR messages.
+log off : Disable logging of OTR messages.
+log redact : Log OTR messages as [redacted], the default.
+warn on : Show in the titlebar when unencrypted messaging is being used.
+warn off : Show in the titlebar when unencrypted messaging is being used.
+libver : Show which version of the libotr library is being used.
+policy manual : Set the global OTR policy.
+policy opportunistici : Set the global OTR policy.
+policy always : Set the global OTR policy.
+secret : Verify a contacts identity using a shared secret.
+question : Verify a contacts identity using a question and expected answer.
+answer : Respond to a question answer verification request with your answer.
From 22111bf75b34181cdab4f8369e781cb1d857fcfb Mon Sep 17 00:00:00 2001
From: James Booth
Date: Thu, 23 Jul 2015 23:05:33 +0100
Subject: [PATCH 03/25] Moved help and about to new format
---
src/command/command.c | 289 +++++++++++++++++++++++------------
src/command/commands.c | 19 +--
src/command/commands.h | 7 +-
src/ui/console.c | 36 +++++
src/ui/ui.h | 2 +
tests/unittests/ui/stub_ui.c | 2 +
6 files changed, 244 insertions(+), 111 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index 9d33f61b..b4b80169 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -109,30 +109,41 @@ GHashTable *commands = NULL;
*/
static struct cmd_t command_defs[] =
{
- { "/help",
- cmd_help, parse_args, 0, 1, NULL,
- { "/help [area|command]", "Help on using Profanity.",
- { "/help [area|command]",
- "--------------------",
- "Help on using Profanity.",
- "",
- "area : Summary help for commands in a certain area of functionality.",
- "command : Full help for a specific command, for example '/help connect'.",
- "",
- "Use with no arguments to see a list of areas.",
- "",
- "Example: /help commands",
- "Example: /help presence",
- "Example: /help who",
- NULL } } },
+ // NEW STYLE
+ { "/help", cmd_help, parse_args, 0, 1, NULL,
+ { NULL, NULL, { NULL },
+ {
+ "/help [ |]",
+ NULL },
- { "/about",
- cmd_about, parse_args, 0, 0, NULL,
- { "/about", "About Profanity.",
- { "/about",
- "------",
- "Show version and license information.",
- NULL } } },
+ "Help on using Profanity. Passing no arguments list help areas.",
+
+ {
+ { "area", "Summary help for commands in a certain area of functionality." },
+ { "command", "Full help for a specific command, for example '/help connect'." },
+ { NULL, NULL } },
+
+ {
+ "/help commands",
+ "/help presence",
+ "/help who",
+ NULL } } },
+
+ { "/about", cmd_about, parse_args, 0, 0, NULL,
+ { NULL, NULL, { NULL },
+ {
+ "/about",
+ NULL },
+
+ "Show version and license information.",
+
+ {
+ { NULL, NULL } },
+
+ {
+ NULL } } },
+
+ // OLD STYLE
{ "/connect",
cmd_connect, parse_args, 0, 5, NULL,
@@ -153,7 +164,8 @@ static struct cmd_t command_defs[] =
"Example: /connect myuser@mycompany.com server talk.google.com",
"Example: /connect bob@someplace port 5678",
"Example: /connect me@chatty server chatty.com port 5443",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
@@ -161,7 +173,8 @@ static struct cmd_t command_defs[] =
{ "/disconnect",
"-----------",
"Disconnect from the current chat service.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/msg",
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
@@ -181,7 +194,8 @@ static struct cmd_t command_defs[] =
"Example: /msg otherfriend@server.com",
"Example: /msg Bob Here is a private message",
"Example: /msg \"My Friend\" Hi, how are you?",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/roster",
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
@@ -219,7 +233,8 @@ static struct cmd_t command_defs[] =
"Example: /roster remove someone@contacts.org (remove the contact)",
"Example: /roster nick myfriend@chat.org My Friend",
"Example: /roster clearnick kai@server.com (clears nickname)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/group",
cmd_group, parse_args_with_freetext, 0, 3, NULL,
@@ -239,7 +254,8 @@ static struct cmd_t command_defs[] =
"Example: /group add friends newfriend@server.org",
"Example: /group add family Brother (using contacts nickname)",
"Example: /group remove colleagues boss@work.com",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/info",
cmd_info, parse_args, 0, 1, NULL,
@@ -256,7 +272,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /info mybuddy@chat.server.org",
"Example: /info kai",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/caps",
cmd_caps, parse_args, 0, 1, NULL,
@@ -273,7 +290,8 @@ static struct cmd_t command_defs[] =
"Example: /caps mybuddy@chat.server.org/laptop (contact's laptop resource)",
"Example: /caps mybuddy@chat.server.org/phone (contact's phone resource)",
"Example: /caps bruce (room member)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/software",
cmd_software, parse_args, 0, 1, NULL,
@@ -291,7 +309,8 @@ static struct cmd_t command_defs[] =
"Example: /software mybuddy@chat.server.org/laptop (contact's laptop resource)",
"Example: /software mybuddy@chat.server.org/phone (contact's phone resource)",
"Example: /software bruce (room member)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/status",
cmd_status, parse_args, 0, 1, NULL,
@@ -307,7 +326,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /status buddy@server.com",
"Example: /status jon",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/resource",
cmd_resource, parse_args, 1, 2, &cons_resource_setting,
@@ -320,7 +340,8 @@ static struct cmd_t command_defs[] =
"off : Let the server choose which resource to route messages to.",
"title on|off : Show or hide the current resource in the titlebar.",
"message on|off : Show or hide the resource when showing an incoming message.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/join",
cmd_join, parse_args, 0, 5, NULL,
@@ -342,7 +363,8 @@ static struct cmd_t command_defs[] =
"Example: /join jdev@conference.jabber.org nick mynick",
"Example: /join private@conference.jabber.org nick mynick password mypassword",
"Example: /join jdev (as user@jabber.org will join jdev@conference.jabber.org)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/leave",
cmd_leave, parse_args, 0, 0, NULL,
@@ -350,7 +372,8 @@ static struct cmd_t command_defs[] =
{ "/leave",
"------",
"Leave the current chat room.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/invite",
cmd_invite, parse_args_with_freetext, 1, 2, NULL,
@@ -361,7 +384,8 @@ static struct cmd_t command_defs[] =
"",
"contact : The contact you wish to invite",
"message : An optional message to send with the invite.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/invites",
cmd_invites, parse_args_with_freetext, 0, 0, NULL,
@@ -369,7 +393,8 @@ static struct cmd_t command_defs[] =
{ "/invites",
"--------",
"Show all rooms that you have been invited to, and not accepted or declined.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/decline",
cmd_decline, parse_args_with_freetext, 1, 1, NULL,
@@ -379,7 +404,8 @@ static struct cmd_t command_defs[] =
"Decline a chat room invitation.",
"",
"room : The room for the invite you wish to decline.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/room",
cmd_room, parse_args, 1, 1, NULL,
@@ -391,7 +417,8 @@ static struct cmd_t command_defs[] =
"accept : Accept default room configuration.",
"destroy : Reject default room configuration.",
"config : Edit room configuration.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/kick",
cmd_kick, parse_args_with_freetext, 1, 2, NULL,
@@ -402,7 +429,8 @@ static struct cmd_t command_defs[] =
"",
"nick : Nickname of the occupant to kick from the room.",
"reason : Optional reason for kicking the occupant.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/ban",
cmd_ban, parse_args_with_freetext, 1, 2, NULL,
@@ -413,7 +441,8 @@ static struct cmd_t command_defs[] =
"",
"jid : Bare JID of the user to ban from the room.",
"reason : Optional reason for banning the user.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/subject",
cmd_subject, parse_args_with_freetext, 0, 2, NULL,
@@ -424,7 +453,8 @@ static struct cmd_t command_defs[] =
"",
"set subject : Set the room subject.",
"clear : Clear the room subject.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/affiliation",
cmd_affiliation, parse_args_with_freetext, 1, 4, NULL,
@@ -437,7 +467,8 @@ static struct cmd_t command_defs[] =
"list [affiliation] : List all users with the specified affiliation, or all if none specified.",
"",
"The affiliation may be one of owner, admin, member, outcast or none.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/role",
cmd_role, parse_args_with_freetext, 1, 4, NULL,
@@ -450,7 +481,8 @@ static struct cmd_t command_defs[] =
"list [role] : List all occupants with the specified role, or all if none specified.",
"",
"The role may be one of moderator, participant, visitor or none.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/occupants",
cmd_occupants, parse_args, 1, 3, cons_occupants_setting,
@@ -466,7 +498,8 @@ static struct cmd_t command_defs[] =
"default show|hide : Whether occupants are shown by default in new rooms.",
"default show|hide jid : Whether occupants jids are shown by default in new rooms.",
"size percent : Percentage of the screen taken by the occupants list in rooms (1-99).",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/form",
cmd_form, parse_args, 1, 2, NULL,
@@ -479,7 +512,8 @@ static struct cmd_t command_defs[] =
"submit : Submit the current form.",
"cancel : Cancel changes to the current form.",
"help [tag] : Display help for form, or a specific field.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/rooms",
cmd_rooms, parse_args, 0, 1, NULL,
@@ -494,7 +528,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /rooms conference.jabber.org",
"Example: /rooms (if logged in as me@server.org, is equivalent to /rooms conference.server.org)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/bookmark",
cmd_bookmark, parse_args, 0, 8, NULL,
@@ -515,7 +550,8 @@ static struct cmd_t command_defs[] =
"join room@server : Join room using the properties associated with the bookmark.",
"",
"In a chat room, /bookmark with no arguments will bookmark the current room, setting autojoin to \"on\".",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/disco",
cmd_disco, parse_args, 1, 2, NULL,
@@ -532,7 +568,8 @@ static struct cmd_t command_defs[] =
"Example: /disco items myserver.org",
"Example: /disco items conference.jabber.org",
"Example: /disco info myfriend@server.com/laptop",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/nick",
cmd_nick, parse_args_with_freetext, 1, 1, NULL,
@@ -545,7 +582,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /nick kai hansen",
"Example: /nick bob",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/win",
cmd_win, parse_args, 1, 1, NULL,
@@ -555,7 +593,8 @@ static struct cmd_t command_defs[] =
"Show the contents of a specific window in the main window area.",
"",
"num - Window number to display.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/wins",
cmd_wins, parse_args, 0, 3, NULL,
@@ -569,7 +608,8 @@ static struct cmd_t command_defs[] =
"swap source target : Swap windows, target may be an empty position.",
"",
"Passing no argument will list all currently active windows and information about their usage.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/sub",
cmd_sub, parse_args, 1, 2, NULL,
@@ -591,7 +631,8 @@ static struct cmd_t command_defs[] =
"Example: /sub allow myfriend@jabber.org",
"Example: /sub request (whilst in chat with contact)",
"Example: /sub sent",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/tiny",
cmd_tiny, parse_args, 1, 1, NULL,
@@ -603,7 +644,8 @@ static struct cmd_t command_defs[] =
"url : The url to make tiny.",
"",
"Example: /tiny http://www.profanity.im",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/who",
cmd_who, parse_args, 0, 2, NULL,
@@ -620,7 +662,8 @@ static struct cmd_t command_defs[] =
"role : moderator|participant|visitor",
"affiliation : owner|admin|member",
"group : Filter the results by the specified group.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/close",
cmd_close, parse_args, 0, 1, NULL,
@@ -634,7 +677,8 @@ static struct cmd_t command_defs[] =
"read : Close all windows that have no new messages.",
"",
"Passing no argument will close the current window.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/clear",
cmd_clear, parse_args, 0, 0, NULL,
@@ -642,7 +686,8 @@ static struct cmd_t command_defs[] =
{ "/clear",
"------",
"Clear the current window.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/quit",
cmd_quit, parse_args, 0, 0, NULL,
@@ -650,7 +695,8 @@ static struct cmd_t command_defs[] =
{ "/quit",
"-----",
"Logout of any current session, and quit Profanity.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/privileges",
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
@@ -658,7 +704,8 @@ static struct cmd_t command_defs[] =
{ "/privileges on|off",
"------------------",
"If enabled the room occupants panel will be grouped by role, and role information will be shown in the room.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
@@ -668,7 +715,8 @@ static struct cmd_t command_defs[] =
"Switch the terminal bell on or off.",
"The bell will sound when incoming messages are received.",
"If the terminal does not support sounds, it may attempt to flash the screen instead.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/encwarn",
cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting,
@@ -676,7 +724,8 @@ static struct cmd_t command_defs[] =
{ "/encwarn on|off",
"---------------",
"Enabled or disable the unencrypted warning message in the titlebar.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/presence",
cmd_presence, parse_args, 1, 1, &cons_presence_setting,
@@ -684,7 +733,8 @@ static struct cmd_t command_defs[] =
{ "/presence on|off",
"----------------",
"Switch display of the contacts presence in the titlebar on or off.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/wrap",
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
@@ -692,7 +742,8 @@ static struct cmd_t command_defs[] =
{ "/wrap on|off",
"------------",
"Enable or disable word wrapping in the main window.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/winstidy",
cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting,
@@ -700,7 +751,8 @@ static struct cmd_t command_defs[] =
{ "/winstidy on|off",
"----------------",
"Enable or disable auto window tidy.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/time",
cmd_time, parse_args, 1, 3, &cons_time_setting,
@@ -718,7 +770,8 @@ static struct cmd_t command_defs[] =
"See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format for more details.",
"Example: /time main set %H:%M (main time will be set to HH:MM)",
"Example: /time statusbar set yolo (statusbar time will all be changed to a static yolo)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/inpblock",
cmd_inpblock, parse_args, 2, 2, &cons_inpblock_setting,
@@ -729,7 +782,8 @@ static struct cmd_t command_defs[] =
"",
"timeout millis : Time to wait (1-1000) in milliseconds before reading input from the terminal buffer, default: 1000.",
"dynamic on|off : Start with 0 millis and dynamically increase up to timeout when no activity, default: on.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/notify",
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
@@ -759,7 +813,8 @@ static struct cmd_t command_defs[] =
"Example: /notify remind 0 (switch off reminders)",
"Example: /notify typing on (enable typing notifications)",
"Example: /notify invite on (enable chat room invite notifications)",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/flash",
cmd_flash, parse_args, 1, 1, &cons_flash_setting,
@@ -768,7 +823,8 @@ static struct cmd_t command_defs[] =
"-------------",
"Make the terminal flash when incoming messages are received in another window.",
"If the terminal doesn't support flashing, it may attempt to beep.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/intype",
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
@@ -776,7 +832,8 @@ static struct cmd_t command_defs[] =
{ "/intype on|off",
"--------------",
"Show when a contact is typing in the console, and in active message window.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/splash",
cmd_splash, parse_args, 1, 1, &cons_splash_setting,
@@ -784,7 +841,8 @@ static struct cmd_t command_defs[] =
{ "/splash on|off",
"--------------",
"Switch on or off the ascii logo on start up and when the /about command is called.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/autoconnect",
cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
@@ -796,7 +854,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /autoconnect set jc@stuntteam.org (autoconnect with the specified account).",
"Example: /autoconnect off (disable autoconnect).",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/vercheck",
cmd_vercheck, parse_args, 0, 1, NULL,
@@ -804,7 +863,8 @@ static struct cmd_t command_defs[] =
{ "/vercheck [on|off]",
"------------------",
"Enable/disable a version check when Profanity starts, and each time the /about command is run.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/titlebar",
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
@@ -815,7 +875,8 @@ static struct cmd_t command_defs[] =
"",
"show : Show current logged in user, and unread messages in the title.",
"goodbye : Show a message in the title when exiting profanity.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/alias",
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
@@ -835,7 +896,8 @@ static struct cmd_t command_defs[] =
"Example: /alias list",
"",
"The above aliases will be available as /friends and /a",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/chlog",
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
@@ -846,7 +908,8 @@ static struct cmd_t command_defs[] =
"This setting will be enabled if /history is set to on.",
"When disabling this option, /history will also be disabled.",
"See the /grlog setting for enabling logging of chat room (groupchat) messages.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/grlog",
cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
@@ -855,7 +918,8 @@ static struct cmd_t command_defs[] =
"-------------",
"Switch chat room logging on or off.",
"See the /chlog setting for enabling logging of one to one chat.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/states",
cmd_states, parse_args, 1, 1, &cons_states_setting,
@@ -863,7 +927,8 @@ static struct cmd_t command_defs[] =
{ "/states on|off",
"--------------",
"Send chat state notifications during chat sessions.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/pgp",
cmd_pgp, parse_args, 1, 3, NULL,
@@ -879,7 +944,8 @@ static struct cmd_t command_defs[] =
"start [contact] : Start PGP encrypted chat, current contact will be used if not specified.",
"end : End PGP encrypted chat with the current recipient.",
"log on|off|redact : PGP message logging, default: redact.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/otr",
cmd_otr, parse_args, 1, 3, NULL,
@@ -902,7 +968,8 @@ static struct cmd_t command_defs[] =
"secret [secret] : Verify a contacts identity using a shared secret.",
"question [question] [answer] : Verify a contacts identity using a question and expected answer.",
"answer [answer] : Respond to a question answer verification request with your answer.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/outtype",
cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
@@ -910,7 +977,8 @@ static struct cmd_t command_defs[] =
{ "/outtype on|off",
"---------------",
"Send typing notifications, chat states (/states) will be enabled if this setting is set.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/gone",
cmd_gone, parse_args, 1, 1, &cons_gone_setting,
@@ -920,7 +988,8 @@ static struct cmd_t command_defs[] =
"Send a 'gone' state to the recipient after the specified number of minutes.",
"A value of 0 will disable sending this chat state.",
"Chat states (/states) will be enabled if this setting is set.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/history",
cmd_history, parse_args, 1, 1, &cons_history_setting,
@@ -929,7 +998,8 @@ static struct cmd_t command_defs[] =
"---------------",
"Switch chat history on or off, /chlog will automatically be enabled when this setting is on.",
"When history is enabled, previous messages are shown in chat windows.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/log",
cmd_log, parse_args, 1, 2, &cons_log_setting,
@@ -942,7 +1012,8 @@ static struct cmd_t command_defs[] =
"rotate on|off : Rotate log, default on.",
"maxsize bytes : With rotate enabled, specifies the max log size, defaults to 1048580 (1MB).",
"shared on|off : Share logs between all instances, default: on.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/carbons",
cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
@@ -951,7 +1022,8 @@ static struct cmd_t command_defs[] =
"---------------",
"Enable or disable message carbons.",
"The message carbons feature ensures that both sides of all conversations are shared with all the user's clients that implement this protocol.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/receipts",
cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
@@ -962,7 +1034,8 @@ static struct cmd_t command_defs[] =
"",
"send on|off : Enable or disable sending of delivery receipts.",
"request on|off : Enable or disable sending of delivery receipt requests.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/reconnect",
cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
@@ -971,7 +1044,8 @@ static struct cmd_t command_defs[] =
"------------------",
"Set the reconnect attempt interval in seconds for when the connection is lost.",
"A value of 0 will switch off reconnect attempts.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/autoping",
cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
@@ -980,7 +1054,8 @@ static struct cmd_t command_defs[] =
"-----------------",
"Set the number of seconds between server pings, so ensure connection kept alive.",
"A value of 0 will switch off autopinging the server.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/ping",
cmd_ping, parse_args, 0, 1, NULL,
@@ -989,7 +1064,8 @@ static struct cmd_t command_defs[] =
"--------------",
"Sends an IQ ping stanza to the specified target.",
"If no target is supplied, your chat server will be pinged.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/autoaway",
cmd_autoaway, parse_args_with_freetext, 2, 2, &cons_autoaway_setting,
@@ -1009,7 +1085,8 @@ static struct cmd_t command_defs[] =
"Example: /autoaway time 30",
"Example: /autoaway message I'm not really doing much",
"Example: /autoaway check off",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/priority",
cmd_priority, parse_args, 1, 1, &cons_priority_setting,
@@ -1021,7 +1098,8 @@ static struct cmd_t command_defs[] =
"value : Number between -128 and 127, default: 0.",
"",
"See the /account command for specific priority settings per presence status.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/account",
cmd_account, parse_args, 0, 4, NULL,
@@ -1064,7 +1142,8 @@ static struct cmd_t command_defs[] =
"Example: /account set me status dnd",
"Example: /account set me dnd -1",
"Example: /account rename me gtalk",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/prefs",
cmd_prefs, parse_args, 0, 1, NULL,
@@ -1081,7 +1160,8 @@ static struct cmd_t command_defs[] =
"presence : Chat presence preferences.",
"",
"No argument shows all preferences.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/theme",
cmd_theme, parse_args, 1, 2, &cons_theme_setting,
@@ -1096,8 +1176,8 @@ static struct cmd_t command_defs[] =
"",
"Example: /theme list",
"Example: /theme load mycooltheme",
- NULL } } },
-
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/statuses",
cmd_statuses, parse_args, 2, 2, &cons_statuses_setting,
@@ -1121,7 +1201,8 @@ static struct cmd_t command_defs[] =
"Example: /statuses console none",
"Example: /statuses chat online",
"Example: /statuses muc all",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/xmlconsole",
cmd_xmlconsole, parse_args, 0, 0, NULL,
@@ -1129,7 +1210,8 @@ static struct cmd_t command_defs[] =
{ "/xmlconsole",
"-----------",
"Open the XML console to view incoming and outgoing XMPP traffic.",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/away",
cmd_away, parse_args_with_freetext, 0, 1, NULL,
@@ -1139,7 +1221,8 @@ static struct cmd_t command_defs[] =
"Set your status to 'away' with the optional message.",
"",
"Example: /away Gone for lunch",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/chat",
cmd_chat, parse_args_with_freetext, 0, 1, NULL,
@@ -1149,7 +1232,8 @@ static struct cmd_t command_defs[] =
"Set your status to 'chat', meaning 'available for chat', with the optional message.",
"",
"Example: /chat Please talk to me!",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/dnd",
cmd_dnd, parse_args_with_freetext, 0, 1, NULL,
@@ -1159,7 +1243,8 @@ static struct cmd_t command_defs[] =
"Set your status to 'dnd', meaning 'do not disturb', with the optional message.",
"",
"Example: /dnd I'm in the zone",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/online",
cmd_online, parse_args_with_freetext, 0, 1, NULL,
@@ -1169,7 +1254,8 @@ static struct cmd_t command_defs[] =
"Set your status to 'online' with the optional message.",
"",
"Example: /online Up the Irons!",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
{ "/xa",
cmd_xa, parse_args_with_freetext, 0, 1, NULL,
@@ -1179,7 +1265,8 @@ static struct cmd_t command_defs[] =
"Set your status to 'xa', meaning 'extended away', with the optional message.",
"",
"Example: /xa This meeting is going to be a long one",
- NULL } } },
+ NULL,
+ NULL, NULL, NULL, NULL } } },
};
static Autocomplete commands_ac;
diff --git a/src/command/commands.c b/src/command/commands.c
index 2e377f4e..b5babf3c 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -852,21 +852,22 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
char cmd_with_slash[1 + strlen(cmd) + 1];
sprintf(cmd_with_slash, "/%s", cmd);
- const gchar **help_text = NULL;
Command *command = g_hash_table_lookup(commands, cmd_with_slash);
-
if (command) {
- help_text = command->help.long_help;
- }
+ // old
+ if (command->help.usage) {
+ const gchar **help_text = command->help.long_help;
+ ProfWin *console = wins_get_console();
+ cons_show("");
+ ui_show_lines(console, help_text);
- cons_show("");
- if (help_text) {
- ProfWin *console = wins_get_console();
- ui_show_lines(console, help_text);
+ // new
+ } else {
+ cons_show_help(command);
+ }
} else {
cons_show("No such command.");
}
-
cons_show("");
}
diff --git a/src/command/commands.h b/src/command/commands.h
index 0b135d71..bf0f94ae 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -35,13 +35,18 @@
#ifndef COMMANDS_H
#define COMMANDS_H
-#include "ui/ui.h"
+#include "ui/win_types.h"
// Command help strings
typedef struct cmd_help_t {
const gchar *usage;
const gchar *short_help;
const gchar *long_help[50];
+
+ const gchar *synopsis[50];
+ const gchar *desc;
+ const gchar *args[50][2];
+ const gchar *examples[10];
} CommandHelp;
/*
diff --git a/src/ui/console.c b/src/ui/console.c
index 98691a0a..9b18a599 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -105,6 +105,42 @@ cons_show(const char * const msg, ...)
va_end(arg);
}
+void
+cons_show_help(Command *command)
+{
+ ProfWin *console = wins_get_console();
+
+ cons_show("");
+
+ cons_show("Synopsis:");
+ ui_show_lines(console, command->help.synopsis);
+ cons_show("");
+
+ cons_show("Description:");
+ win_println(console, command->help.desc);
+
+ int i;
+ int maxlen = 0;
+ for (i = 0; command->help.args[i][0] != NULL; i++) {
+ if (strlen(command->help.args[i][0]) > maxlen)
+ maxlen = strlen(command->help.args[i][0]);
+ }
+
+ if (i > 0) {
+ cons_show("");
+ cons_show("Arguments:");
+ for (i = 0; command->help.args[i][0] != NULL; i++) {
+ win_vprint(console, '-', NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]);
+ }
+ }
+
+ if (g_strv_length((gchar**)command->help.examples) > 0) {
+ cons_show("");
+ cons_show("Examples:");
+ ui_show_lines(console, command->help.examples);
+ }
+}
+
void
cons_show_error(const char * const msg, ...)
{
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 637c8f75..58f1ee98 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -35,6 +35,7 @@
#ifndef UI_UI_H
#define UI_UI_H
+#include "command/commands.h"
#include "ui/win_types.h"
#include "muc.h"
@@ -241,6 +242,7 @@ void ui_inp_history_append(char *inp);
void cons_show(const char * const msg, ...);
void cons_about(void);
void cons_help(void);
+void cons_show_help(Command *command);
void cons_navigation_help(void);
void cons_prefs(void);
void cons_show_ui_prefs(void);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 71a577f5..05863fd0 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -358,6 +358,8 @@ void cons_show(const char * const msg, ...)
va_end(args);
}
+void cons_show_help(Command *command) {}
+
void cons_about(void) {}
void cons_help(void) {}
void cons_navigation_help(void) {}
From 44d7a152a4495cf0238745d91d590d163018cb9b Mon Sep 17 00:00:00 2001
From: James Booth
Date: Fri, 24 Jul 2015 00:33:38 +0100
Subject: [PATCH 04/25] Added connect to new help format
---
src/command/command.c | 111 ++++++++++++++++++++++--------------------
src/ui/console.c | 8 +--
2 files changed, 63 insertions(+), 56 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index b4b80169..e8874f8b 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -104,68 +104,75 @@ static char * _receipts_autocomplete(ProfWin *window, const char * const input);
GHashTable *commands = NULL;
+#define END_ARGS { NULL, NULL }
+
+
+
/*
* Command list
*/
static struct cmd_t command_defs[] =
{
// NEW STYLE
- { "/help", cmd_help, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
- {
- "/help [ |]",
- NULL },
+ { "/help",
+ cmd_help, parse_args, 0, 1, NULL,
+ { NULL, NULL, { NULL },
+ {
+ "/help [ |]",
+ NULL
+ },
+ "Help on using Profanity. Passing no arguments list help areas.",
+ {
+ { "area", "Summary help for commands in a certain area of functionality." },
+ { "command", "Full help for a specific command, for example '/help connect'." },
+ END_ARGS },
+ {
+ "/help commands",
+ "/help presence",
+ "/help who",
+ NULL } }
+ },
- "Help on using Profanity. Passing no arguments list help areas.",
-
- {
- { "area", "Summary help for commands in a certain area of functionality." },
- { "command", "Full help for a specific command, for example '/help connect'." },
- { NULL, NULL } },
-
- {
- "/help commands",
- "/help presence",
- "/help who",
- NULL } } },
-
- { "/about", cmd_about, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
- {
- "/about",
- NULL },
-
- "Show version and license information.",
-
- {
- { NULL, NULL } },
-
- {
- NULL } } },
-
- // OLD STYLE
+ { "/about",
+ cmd_about, parse_args, 0, 0, NULL,
+ { NULL, NULL, { NULL },
+ {
+ "/about",
+ NULL
+ },
+ "Show version and license information.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/connect",
cmd_connect, parse_args, 0, 5, NULL,
- { "/connect [account] [server value] [port value]", "Account login.",
- { "/connect [account] [server value] [port value]",
- "----------------------------------------------",
- "Login to a chat service.",
- "",
- "account : The local account you wish to connect with, or a JID if connecting for the first time.",
- "server value : Supply a server if it is different to the domain part of your JID.",
- "port value : The port to use if different to the default (5222, or 5223 for SSL).",
- "",
- "If no account is specified, the default is used if one is configured.",
- "A local account is created with the JID as it's name if it doesn't already exist.",
- "",
- "Example: /connect",
- "Example: /connect myuser@gmail.com",
- "Example: /connect myuser@mycompany.com server talk.google.com",
- "Example: /connect bob@someplace port 5678",
- "Example: /connect me@chatty server chatty.com port 5443",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/connect []",
+ "/connect [server ] [port ]",
+ NULL
+ },
+ "Login to a chat service. "
+ "If no account is specified, the default is used if one is configured. "
+ "A local account is created with the JID as it's name if it doesn't already exist.",
+ {
+ { "account", "The local account you wish to connect with, or a JID if connecting for the first time." },
+ { "server ", "Supply a server if it is different to the domain part of your JID." },
+ { "port ", "The port to use if different to the default (5222, or 5223 for SSL)." },
+ END_ARGS },
+ {
+ "/connect",
+ "/connect myuser@gmail.com",
+ "/connect myuser@mycompany.com server talk.google.com",
+ "/connect bob@someplace port 5678",
+ "/connect me@chatty server chatty.com port 5443",
+ NULL } }
+ },
+
+ // OLD STYLE
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
diff --git a/src/ui/console.c b/src/ui/console.c
index 9b18a599..20f6803e 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -112,11 +112,11 @@ cons_show_help(Command *command)
cons_show("");
- cons_show("Synopsis:");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Synopsis");
ui_show_lines(console, command->help.synopsis);
cons_show("");
- cons_show("Description:");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Description");
win_println(console, command->help.desc);
int i;
@@ -128,7 +128,7 @@ cons_show_help(Command *command)
if (i > 0) {
cons_show("");
- cons_show("Arguments:");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Arguments");
for (i = 0; command->help.args[i][0] != NULL; i++) {
win_vprint(console, '-', NULL, 0, 0, "", "%-*s: %s", maxlen + 1, command->help.args[i][0], command->help.args[i][1]);
}
@@ -136,7 +136,7 @@ cons_show_help(Command *command)
if (g_strv_length((gchar**)command->help.examples) > 0) {
cons_show("");
- cons_show("Examples:");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Examples");
ui_show_lines(console, command->help.examples);
}
}
From a8eb2815539b59bb9afa682edd7fb63b0aa4a9da Mon Sep 17 00:00:00 2001
From: James Booth
Date: Fri, 24 Jul 2015 00:44:56 +0100
Subject: [PATCH 05/25] Added msg to new help format
---
src/command/command.c | 63 +++++++++++++++++++++++++------------------
1 file changed, 37 insertions(+), 26 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index e8874f8b..7671fa0c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -172,37 +172,48 @@ static struct cmd_t command_defs[] =
NULL } }
},
- // OLD STYLE
-
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
- { "/disconnect", "Logout of current session.",
- { "/disconnect",
- "-----------",
- "Disconnect from the current chat service.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/disconnect",
+ NULL
+ },
+ "Disconnect from the current chat service.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/msg",
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
- { "/msg contact|nick [message]", "Start chat with a user.",
- { "/msg contact|nick [message]",
- "---------------------------",
- "Send a one to one chat message, or a private message to a chat room occupant.",
- "",
- "contact : The contact's JID, or nickname if one has been set in your roster.",
- "nick : A chat room occupant, to whom you wish to send a private message.",
- "message : The message to send",
- "",
- "If the message is omitted, a new chat window will be opened without sending a message.",
- "Use quotes if the nickname includes spaces.",
- "",
- "Example: /msg myfriend@server.com Hey, here's a message!",
- "Example: /msg otherfriend@server.com",
- "Example: /msg Bob Here is a private message",
- "Example: /msg \"My Friend\" Hi, how are you?",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/msg []",
+ "/msg []",
+ NULL
+ },
+ "Send a one to one chat message, or a private message to a chat room occupant. "
+ "If the message is omitted, a new chat window will be opened without sending a message. "
+ "Use quotes if the nickname includes spaces.",
+ {
+ { "", "Open chat window with contact, by JID or nickname." },
+ { " []", "Send message to contact, by JID or nickname." },
+ { "", "Open private chat window with chat room occupant." },
+ { " []", "Send a private message to a chat room occupant." },
+ END_ARGS },
+ {
+ "/msg myfriend@server.com Hey, here's a message!",
+ "/msg otherfriend@server.com",
+ "/msg Bob Here is a private message",
+ "/msg \"My Friend\" Hi, how are you?",
+ NULL } }
+ },
+
+ // OLD STYLE
+
+
{ "/roster",
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
From b736883ac4a1ff5ad9ad92b2676360de545747f8 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Fri, 24 Jul 2015 21:20:55 +0100
Subject: [PATCH 06/25] Added roster to new help format
---
src/command/command.c | 96 ++++++++++++++++++++++++-------------------
1 file changed, 54 insertions(+), 42 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index 7671fa0c..ef785089 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -198,10 +198,10 @@ static struct cmd_t command_defs[] =
"If the message is omitted, a new chat window will be opened without sending a message. "
"Use quotes if the nickname includes spaces.",
{
- { "", "Open chat window with contact, by JID or nickname." },
+ { "", "Open chat window with contact, by JID or nickname." },
{ " []", "Send message to contact, by JID or nickname." },
- { "", "Open private chat window with chat room occupant." },
- { " []", "Send a private message to a chat room occupant." },
+ { "", "Open private chat window with chat room occupant." },
+ { " []", "Send a private message to a chat room occupant." },
END_ARGS },
{
"/msg myfriend@server.com Hey, here's a message!",
@@ -211,48 +211,60 @@ static struct cmd_t command_defs[] =
NULL } }
},
- // OLD STYLE
-
-
-
{ "/roster",
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
- { "/roster [command] [args..]", "Manage your roster.",
- { "/roster [command] [args..]",
- "--------------------------",
- "Manage your roster, and roster display settings.",
- "",
- "command - online|show|hide|by|size|add|remove|remove_all|nick|clearnick",
- "",
- "online : Show all online contacts in your roster.",
- "show : Show the roster panel.",
- "show offline : Show offline contacts in the roster panel.",
- "show resource : Show contact's connected resources in the roster panel.",
- "show empty : When grouping by presence, show empty presence groups",
- "hide : Hide the roster panel.",
- "hide offline : Hide offline contacts in the roster panel.",
- "hide resource : Hide contact's connected resources in the roster panel.",
- "hide empty : When grouping by presence, hide empty presence groups",
- "by group : Group contacts in the roster panel by roster group.",
- "by presence : Group contacts in the roster panel by presence.",
- "by none : No grouping in the roster panel.",
- "size : Percentage of the screen taken up by the roster (1-99).",
- "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.",
- "",
+ { NULL, NULL, { NULL },
+ {
+ "/roster",
+ "/roster online",
+ "/roster show [offline|resource|empty]",
+ "/roster hide [offline|resource|empty]",
+ "/roster by group|presence|none",
+ "/roster size ",
+ "/roster add []",
+ "/roster remove ",
+ "/roster remove_all contacts",
+ "/roster nick ",
+ "/roster clearnick ",
+ NULL
+ },
+ "Manage your roster, and roster display settings. "
"Passing no arguments lists all contacts in your roster.",
- "",
- "Example: /roster (show your roster)",
- "Example: /roster add someone@contacts.org (add the contact)",
- "Example: /roster add someone@contacts.org Buddy (add the contact with nickname 'Buddy')",
- "Example: /roster remove someone@contacts.org (remove the contact)",
- "Example: /roster nick myfriend@chat.org My Friend",
- "Example: /roster clearnick kai@server.com (clears nickname)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ {
+ { "online", "Show all online contacts in your roster." },
+ { "show", "Show the roster panel." },
+ { "show offline", "Show offline contacts in the roster panel." },
+ { "show resource", "Show contact's connected resources in the roster panel." },
+ { "show empty", "When grouping by presence, show empty presence groups." },
+ { "show empty", "When grouping by presence, show empty presence groups." },
+ { "hide", "Hide the roster panel." },
+ { "hide offline", "Hide offline contacts in the roster panel." },
+ { "hide resource", "Hide contact's connected resources in the roster panel." },
+ { "hide empty", "When grouping by presence, hide empty presence groups." },
+ { "by group", "Group contacts in the roster panel by roster group." },
+ { "by presence", "Group contacts in the roster panel by presence." },
+ { "by none", "No grouping in the roster panel." },
+ { "size ", "Percentage of the screen taken up by the roster (1-99)." },
+ { "add []", "Add a new item to the roster." },
+ { "remove ", "Removes an item from the roster." },
+ { "remove_all contacts", "Remove all items from roster." },
+ { "nick ", "Change a contacts nickname." },
+ { "clearnick ", "Removes the current nickname." },
+ END_ARGS },
+ {
+ "/roster",
+ "/roster add someone@contacts.org",
+ "/roster add someone@contacts.org Buddy",
+ "/roster remove someone@contacts.org",
+ "/roster nick myfriend@chat.org My Friend",
+ "/roster clearnick kai@server.com",
+ "/roster size 15",
+ NULL } }
+ },
+
+
+ // OLD STYLE
+
{ "/group",
cmd_group, parse_args_with_freetext, 0, 3, NULL,
From 90dda0e9a0dfd10bcbc4c416031039d9719790c8 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sat, 25 Jul 2015 00:45:20 +0100
Subject: [PATCH 07/25] Added more help to new format
---
src/command/command.c | 1248 ++++++++++++++++++++++++-----------------
1 file changed, 744 insertions(+), 504 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index ef785089..b2d3be9b 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -262,651 +262,891 @@ static struct cmd_t command_defs[] =
NULL } }
},
-
- // OLD STYLE
-
-
{ "/group",
cmd_group, parse_args_with_freetext, 0, 3, NULL,
- { "/group [show|add|remove] [group] [contact]", "Manage roster groups.",
- { "/group [show|add|remove] [group] [contact]",
- "------------------------------------------",
- "View, add to, and remove from roster groups.",
- "",
- "show group : List all roster items a group.",
- "add group contact : Added a contact to a group.",
- "remove group contact : Remove a contact from a group.",
- "",
+ { NULL, NULL, { NULL },
+ {
+ "/group",
+ "/group show ",
+ "/group remove ",
+ NULL
+ },
+ "View, add to, and remove from roster groups. "
"Passing no argument will list all roster groups.",
- "",
- "Example: /group",
- "Example: /group show friends",
- "Example: /group add friends newfriend@server.org",
- "Example: /group add family Brother (using contacts nickname)",
- "Example: /group remove colleagues boss@work.com",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ {
+ { "show ", "List all roster items a group." },
+ { "add ", "Add a contact to a group." },
+ { "remove ", "Remove a contact from a group." },
+ END_ARGS },
+ {
+ "/group",
+ "/group show friends",
+ "/group add friends newfriend@server.org",
+ "/group add family Brother",
+ "/group remove colleagues boss@work.com",
+ NULL } }
+ },
{ "/info",
cmd_info, parse_args, 0, 1, NULL,
- { "/info [contact|nick]", "Show information about a contact, room, or room member.",
- { "/info [contact|nick]",
- "--------------------",
- "Show information about a contact, room, or room member.",
- "",
- "contact : The contact you wish to view information about.",
- "nick : When in a chat room, the occupant you wish to view information about.",
- "",
- "Passing no argument in a chat window will use the current recipient.",
+ { NULL, NULL, { NULL },
+ {
+ "/info",
+ "/info |",
+ NULL
+ },
+ "Show information about a contact, room, or room member. "
+ "Passing no argument in a chat window will use the current recipient. "
"Passing no argument in a chat room will display information about the room.",
- "",
- "Example: /info mybuddy@chat.server.org",
- "Example: /info kai",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ {
+ { "contact", "The contact you wish to view information about." },
+ { "nick", "When in a chat room, the occupant you wish to view information about." },
+ END_ARGS },
+ {
+ "/info mybuddy@chat.server.org",
+ "/info kai",
+ NULL } }
+ },
{ "/caps",
cmd_caps, parse_args, 0, 1, NULL,
- { "/caps [fulljid|nick]", "Find out a contacts client software capabilities.",
- { "/caps [fulljid|nick]",
- "--------------------",
- "Find out a contacts, or room members client software capabilities.",
- "",
- "fulljid : If in the console or a chat window, the full JID for which you wish to see capabilities.",
- "nick : If in a chat room, nickname for which you wish to see capabilities.",
- "",
- "If in private chat initiated from a chat room, no parameter is required.",
- "",
- "Example: /caps mybuddy@chat.server.org/laptop (contact's laptop resource)",
- "Example: /caps mybuddy@chat.server.org/phone (contact's phone resource)",
- "Example: /caps bruce (room member)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/caps",
+ "/caps |",
+ NULL
+ },
+ "Find out a contacts, or room members client software capabilities. "
+ "If in private chat initiated from a chat room, no parameter is required.",
+ {
+ { "fulljid", "If in the console or a chat window, the full JID for which you wish to see capabilities." },
+ { "nick", "If in a chat room, nickname for which you wish to see capabilities." },
+ END_ARGS },
+ {
+ "/caps mybuddy@chat.server.org/laptop",
+ "/caps mybuddy@chat.server.org/phone",
+ "/caps bruce",
+ NULL } }
+ },
{ "/software",
cmd_software, parse_args, 0, 1, NULL,
- { "/software [fulljid|nick]", "Find out software version information about a contacts resource.",
- { "/software [fulljid|nick]",
- "------------------------",
- "Find out a contact, or room members software version information.",
- "",
- "fulljid : If in the console or a chat window, the full JID for which you wish to see software information.",
- "nick : If in a chat room, nickname for which you wish to see software information.",
- "",
- "If in private chat initiated from a chat room, no parameter is required.",
+ { NULL, NULL, { NULL },
+ {
+ "/software",
+ "/software |",
+ NULL
+ },
+ "Find out a contact, or room members software version information. "
+ "If in private chat initiated from a chat room, no parameter is required. "
"If the contact's software does not support software version requests, nothing will be displayed.",
- "",
- "Example: /software mybuddy@chat.server.org/laptop (contact's laptop resource)",
- "Example: /software mybuddy@chat.server.org/phone (contact's phone resource)",
- "Example: /software bruce (room member)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ {
+ { "fulljid", "If in the console or a chat window, the full JID for which you wish to see software information." },
+ { "nick", "If in a chat room, nickname for which you wish to see software information." },
+ END_ARGS },
+ {
+ "/software mybuddy@chat.server.org/laptop",
+ "/software mybuddy@chat.server.org/phone",
+ "/software bruce",
+ NULL } }
+ },
{ "/status",
cmd_status, parse_args, 0, 1, NULL,
- { "/status [contact|nick]", "Find out a contacts presence information.",
- { "/status [contact|nick]",
- "----------------------",
- "Find out a contact, or room members presence information.",
- "",
- "contact : The contact who's presence you which to see.",
- "nick : If in a chat room, the occupant who's presence you wish to see.",
- "",
+ { NULL, NULL, { NULL },
+ {
+ "/status",
+ "/status |",
+ NULL
+ },
+ "Find out a contact, or room members presence information. "
"If in a chat window the parameter is not required, the current recipient will be used.",
- "",
- "Example: /status buddy@server.com",
- "Example: /status jon",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ {
+ { "contact", "The contact who's presence you which to see." },
+ { "nick", "If in a chat room, the occupant who's presence you wish to see." },
+ END_ARGS },
+ {
+ "/status buddy@server.com",
+ "/status jon",
+ NULL } }
+ },
{ "/resource",
cmd_resource, parse_args, 1, 2, &cons_resource_setting,
- { "/resource set|off|title|message [resource]", "Set the contact's resource, display settings.",
- { "/resource set|off|title|message [resource]",
- "------------------------------------------",
- "Override chat session resource, and manage resource display settings.",
- "",
- "set resource : Set the resource to which messages will be sent.",
- "off : Let the server choose which resource to route messages to.",
- "title on|off : Show or hide the current resource in the titlebar.",
- "message on|off : Show or hide the resource when showing an incoming message.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/resource set ",
+ "/resource off",
+ "/resource title on|off",
+ "/resource message on|off",
+ NULL
+ },
+ "Override chat session resource, and manage resource display settings.",
+ {
+ { "set ", "Set the resource to which messages will be sent." },
+ { "off", "Let the server choose which resource to route messages to." },
+ { "title on|off", "Show or hide the current resource in the titlebar." },
+ { "message on|off", "Show or hide the resource when showing an incoming message." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/join",
cmd_join, parse_args, 0, 5, NULL,
- { "/join [room] [nick value] [password value]", "Join a chat room.",
- { "/join [room] [nick value] [password value]",
- "-----------------------------------------",
- "Join a chat room at the conference server.",
- "",
- "room : Bare room JID (the chat server is determined by the 'muc.service' account property) or full room jid."
- "nick value : Nickname to use in the room",
- "password value : Password if the room requires it.",
- "",
- "If no room is supplied, a generated name will be used with the format private-chat-[UUID].",
- "If no nickname is specified the account preference 'muc.nick' will be used which by default is the localpart of your JID.",
- "If the room doesn't exist, and the server allows it, a new one will be created.",
- "",
- "Example: /join",
- "Example: /join jdev@conference.jabber.org",
- "Example: /join jdev@conference.jabber.org nick mynick",
- "Example: /join private@conference.jabber.org nick mynick password mypassword",
- "Example: /join jdev (as user@jabber.org will join jdev@conference.jabber.org)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/join",
+ "/join [nick ] [password ]",
+ NULL
+ },
+ "Join a chat room at the conference server. "
+ "If no room is supplied, a generated name will be used with the format private-chat-[UUID]. "
+ "If the domain part is not included in the room name, the account preference 'muc.service' will be used. "
+ "If no nickname is specified the account preference 'muc.nick' will be used which by default is the localpart of your JID. "
+ "If the room doesn't exist, and the server allows it, a new one will be created.",
+ {
+ { "", "The chat room to join." },
+ { "nick ", "Nickname to use in the room." },
+ { "password ", "Password if the room requires one." },
+ END_ARGS },
+ {
+ "/join",
+ "/join jdev@conference.jabber.org",
+ "/join jdev@conference.jabber.org nick mynick",
+ "/join private@conference.jabber.org nick mynick password mypassword",
+ "/join jdev",
+ NULL } }
+ },
{ "/leave",
cmd_leave, parse_args, 0, 0, NULL,
- { "/leave", "Leave a chat room.",
- { "/leave",
- "------",
- "Leave the current chat room.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/leave",
+ NULL
+ },
+ "Leave the current chat room.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/invite",
cmd_invite, parse_args_with_freetext, 1, 2, NULL,
- { "/invite contact [message]", "Invite contact to chat room.",
- { "/invite contact [message]",
- "-------------------------",
- "Send a direct invite to the current chat room.",
- "",
- "contact : The contact you wish to invite",
- "message : An optional message to send with the invite.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/invite []",
+ NULL
+ },
+ "Send an invite to a contact for the current chat room.",
+ {
+ { "", "The contact you wish to invite." },
+ { "", "An optional message to send with the invite." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/invites",
cmd_invites, parse_args_with_freetext, 0, 0, NULL,
- { "/invites", "Show outstanding chat room invites.",
- { "/invites",
- "--------",
- "Show all rooms that you have been invited to, and not accepted or declined.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/invites",
+ NULL
+ },
+ "Show all rooms that you have been invited to, and not accepted or declined.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/decline",
cmd_decline, parse_args_with_freetext, 1, 1, NULL,
- { "/decline room", "Decline a chat room invite.",
- { "/decline room",
- "-------------",
- "Decline a chat room invitation.",
- "",
- "room : The room for the invite you wish to decline.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/decline ",
+ NULL
+ },
+ "Decline a chat room invitation.",
+ {
+ { "", "The room for the invite you wish to decline." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/room",
cmd_room, parse_args, 1, 1, NULL,
- { "/room accept|destroy|config", "Room configuration.",
- { "/room accept|destroy|config",
- "---------------------------",
- "Chat room configuration.",
- "",
- "accept : Accept default room configuration.",
- "destroy : Reject default room configuration.",
- "config : Edit room configuration.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/room accept|destroy|config",
+ NULL
+ },
+ "Chat room configuration.",
+ {
+ { "accept", "Accept default room configuration." },
+ { "destroy", "Reject default room configuration, and destroy the room." },
+ { "config", "Edit room configuration." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/kick",
cmd_kick, parse_args_with_freetext, 1, 2, NULL,
- { "/kick nick [reason]", "Kick occupants from chat rooms.",
- { "/kick nick [reason]",
- "-------------------",
- "Kick occupants from chat rooms.",
- "",
- "nick : Nickname of the occupant to kick from the room.",
- "reason : Optional reason for kicking the occupant.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/kick []",
+ NULL
+ },
+ "Kick occupant from chat room.",
+ {
+ { "", "Nickname of the occupant to kick from the room." },
+ { "", "Optional reason for kicking the occupant." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/ban",
cmd_ban, parse_args_with_freetext, 1, 2, NULL,
- { "/ban jid [reason]", "Ban users from chat rooms.",
- { "/ban jid [reason]",
- "-----------------",
- "Ban users from chat rooms.",
- "",
- "jid : Bare JID of the user to ban from the room.",
- "reason : Optional reason for banning the user.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/ban []",
+ NULL
+ },
+ "Ban user from chat room.",
+ {
+ { "", "Bare JID of the user to ban from the room." },
+ { "", "Optional reason for banning the user." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/subject",
cmd_subject, parse_args_with_freetext, 0, 2, NULL,
- { "/subject set|clear [subject]", "Set or clear room subject.",
- { "/subject set|clear [subject]",
- "----------------------------",
- "Set or clear room subject.",
- "",
- "set subject : Set the room subject.",
- "clear : Clear the room subject.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/subject set ",
+ "/subject clear",
+ NULL
+ },
+ "Set or clear room subject.",
+ {
+ { "set ", "Set the room subject." },
+ { "clear", "Clear the room subject." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/affiliation",
cmd_affiliation, parse_args_with_freetext, 1, 4, NULL,
- { "/affiliation set|list [affiliation] [jid] [reason]", "Manage room affiliations.",
- { "/affiliation set|list [affiliation] [jid] [reason]",
- "--------------------------------------------------",
- "Manage room affiliations.",
- "",
- "set affiliation jid [reason]: Set the affiliation of user with jid, with an optional reason.",
- "list [affiliation] : List all users with the specified affiliation, or all if none specified.",
- "",
- "The affiliation may be one of owner, admin, member, outcast or none.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/affiliation set []",
+ "/list []",
+ NULL
+ },
+ "Manage room affiliations. "
+ "Affiliation may be one of owner, admin, member, outcast or none.",
+ {
+ { "set []", "Set the affiliation of user with jid, with an optional reason." },
+ { "list []", "List all users with the specified affiliation, or all if none specified." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/role",
cmd_role, parse_args_with_freetext, 1, 4, NULL,
- { "/role set|list [role] [nick] [reason]", "Manage room roles.",
- { "/role set|list [role] [nick] [reason]",
- "-------------------------------------",
- "Manage room roles.",
- "",
- "set role nick [reason] : Set the role of occupant with nick, with an optional reason.",
- "list [role] : List all occupants with the specified role, or all if none specified.",
- "",
- "The role may be one of moderator, participant, visitor or none.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/role set []",
+ "/list []",
+ NULL
+ },
+ "Manage room roles. "
+ "Role may be one of moderator, participant, visitor or none.",
+ {
+ { "set []", "Set the role of occupant with nick, with an optional reason." },
+ { "list []", "List all occupants with the specified role, or all if none specified." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/occupants",
cmd_occupants, parse_args, 1, 3, cons_occupants_setting,
- { "/occupants show|hide|default|size [jid|show|hide|percent] [jid]", "Show or hide room occupants.",
- { "/occupants show|hide|default|size [jid|show|hide|percent] [jid]",
- "---------------------------------------------------------------",
- "Show or hide room occupants, and occupants panel display settings.",
- "",
- "show : Show the occupants panel in current room.",
- "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.",
- "default show|hide : Whether occupants are shown by default in new rooms.",
- "default show|hide jid : Whether occupants jids are shown by default in new rooms.",
- "size percent : Percentage of the screen taken by the occupants list in rooms (1-99).",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/occupants show|hide [jid]",
+ "/occupants default show|hide [jid]",
+ "/occupants size []",
+ NULL
+ },
+ "Show or hide room occupants, and occupants panel display settings.",
+ {
+ { "show", "Show the occupants panel in current room." },
+ { "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." },
+ { "default show|hide", "Whether occupants are shown by default in new rooms." },
+ { "default show|hide jid", "Whether occupants jids are shown by default in new rooms." },
+ { "size ", "Percentage of the screen taken by the occupants list in rooms (1-99)." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/form",
cmd_form, parse_args, 1, 2, NULL,
- { "/form show|submit|cancel|help [tag]", "Form handling.",
- { "/form show|submit|cancel|help [tag]",
- "-----------------------------------",
- "Form configuration.",
- "",
- "show : Show the current form.",
- "submit : Submit the current form.",
- "cancel : Cancel changes to the current form.",
- "help [tag] : Display help for form, or a specific field.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/form show",
+ "/form submit",
+ "/form cancel",
+ "/form help []",
+ NULL
+ },
+ "Form configuration.",
+ {
+ { "show", "Show the current form." },
+ { "submit", "Submit the current form." },
+ { "cancel", "Cancel changes to the current form." },
+ { "help []", "Display help for form, or a specific field." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/rooms",
cmd_rooms, parse_args, 0, 1, NULL,
- { "/rooms [conference-service]", "List chat rooms.",
- { "/rooms [conference-service]",
- "---------------------------",
- "List the chat rooms available at the specified conference service",
- "",
- "conference-service : The conference service to query.",
- "",
- "If no argument is supplied, the account preference 'muc.service' is used, 'conference.' by default.",
- "",
- "Example: /rooms conference.jabber.org",
- "Example: /rooms (if logged in as me@server.org, is equivalent to /rooms conference.server.org)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/rooms []",
+ NULL
+ },
+ "List the chat rooms available at the specified conference service. "
+ "If no argument is supplied, the account preference 'muc.service' is used, 'conference.' by default.",
+ {
+ { "", "The conference service to query." },
+ END_ARGS },
+ {
+ "/rooms conference.jabber.org",
+ NULL } }
+ },
{ "/bookmark",
cmd_bookmark, parse_args, 0, 8, NULL,
- { "/bookmark [command] [args..]", "Manage bookmarks.",
- { "/bookmark [command] [args..]",
- "----------------------------",
- "Manage bookmarks and join bookmarked rooms.",
- "",
- "command : list|add|update|remove|join",
- "",
- "list : List all bookmarks.",
- "add room@server [prop value..] : Add a bookmark for room@server with the following optional properties:",
- " nick value : Nickname used in the chat room",
- " password value : Password if required, may be stored in plaintext on your server",
- " autojoin on|off : Whether to join the room automatically on login.",
- "update room@server [prop value..] : Update any of the above properties associated with the bookmark.",
- "remove room@server : Remove the bookmark for room@server.",
- "join room@server : Join room using the properties associated with the bookmark.",
- "",
- "In a chat room, /bookmark with no arguments will bookmark the current room, setting autojoin to \"on\".",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/bookmark",
+ "/bookmark list",
+ "/bookmark add [nick ] [password ] [autojoin on|off]",
+ "/bookmark update [nick ] [password ] [autojoin on|off]",
+ "/bookmark remove ",
+ "/bookmark join ",
+ NULL
+ },
+ "Manage bookmarks and join bookmarked rooms. "
+ "In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\".",
+ {
+ { "list", "List all bookmarks." },
+ { "add ", "Add a bookmark." },
+ { "remove ", "Remove a bookmark." },
+ { "update ", "Update the properties associated with a bookmark." },
+ { "nick ", "Nickname used in the chat room." },
+ { "password ", "Password if required, may be stored in plaintext on your server." },
+ { "autojoin on|off", "Whether to join the room automatically on login." },
+ { "join ", "Join room using the properties associated with the bookmark." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/disco",
cmd_disco, parse_args, 1, 2, NULL,
- { "/disco info|items entity", "Service discovery.",
- { "/disco info|items entity",
- "---------------------",
- "Find out information about an entities supported services.",
- "",
- "info : List protocols and features supported by an entity.",
- "items : List items associated with an entity.",
- "entity : Jabber ID.",
- "",
- "Example: /disco info myserver.org",
- "Example: /disco items myserver.org",
- "Example: /disco items conference.jabber.org",
- "Example: /disco info myfriend@server.com/laptop",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/disco info []",
+ "/disco items []",
+ NULL
+ },
+ "Find out information about an entities supported services. "
+ "Calling with no arguments will query the server you are currently connected to.",
+ {
+ { "info []", "List protocols and features supported by an entity." },
+ { "items []", "List items associated with an entity." },
+ END_ARGS },
+ {
+ "/disco info",
+ "/disco items myserver.org",
+ "/disco items conference.jabber.org",
+ "/disco info myfriend@server.com/laptop",
+ NULL } }
+ },
{ "/nick",
cmd_nick, parse_args_with_freetext, 1, 1, NULL,
- { "/nick nickname", "Change nickname in chat room.",
- { "/nick nickname",
- "--------------",
- "Change the name by which other members of a chat room see you.",
- "",
- "nickname : The new nickname.",
- "",
- "Example: /nick kai hansen",
- "Example: /nick bob",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/nick ",
+ NULL
+ },
+ "Change your nickname in the current chat room.",
+ {
+ { "", "Your new nickname." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/win",
cmd_win, parse_args, 1, 1, NULL,
- { "/win num", "View a window.",
- { "/win num",
- "--------",
- "Show the contents of a specific window in the main window area.",
- "",
- "num - Window number to display.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/win ",
+ NULL
+ },
+ "Move to the specified window.",
+ {
+ { "", "Window number to display." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/wins",
cmd_wins, parse_args, 0, 3, NULL,
- { "/wins [tidy|prune|swap] [source target]", "List or tidy active windows.",
- { "/wins [tidy|prune|swap] [source target]",
- "---------------------------------------",
- "Show a list of windows, or tidy or swap.",
- "",
- "tidy : Move windows so there are no gaps.",
- "prune : Close all windows with no unread messages, and then tidy as above.",
- "swap source target : Swap windows, target may be an empty position.",
- "",
- "Passing no argument will list all currently active windows and information about their usage.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/wins tidy",
+ "/wins prune",
+ "/wins swap ",
+ NULL
+ },
+ "Manage windows. "
+ "Passing no argument will list all currently active windows and information about their usage.",
+ {
+ { "tidy", "Move windows so there are no gaps." },
+ { "prune", "Close all windows with no unread messages, and then tidy so there are no gaps." },
+ { "swap ", "Swap windows, target may be an empty position." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/sub",
cmd_sub, parse_args, 1, 2, NULL,
- { "/sub request|allow|deny|show|sent|received [jid]", "Manage subscriptions.",
- { "/sub request|allow|deny|show|sent|received [jid]",
- "------------------------------------------------",
- "Manage subscriptions to contact presence.",
- "",
- "request [jid] : Send a subscription request to the user.",
- "allow [jid] : Approve a contact's subscription request.",
- "deny [jid] : Remove subscription for a contact, or deny a request",
- "show [jid] : Show subscription status for a contact.",
- "sent : Show all sent subscription requests pending a response.",
- "received : Show all received subscription requests awaiting your response.",
- "",
- "If jid is omitted, the contact of the current window is used.",
- "",
- "Example: /sub request myfriend@jabber.org",
- "Example: /sub allow myfriend@jabber.org",
- "Example: /sub request (whilst in chat with contact)",
- "Example: /sub sent",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/sub request []",
+ "/sub allow []",
+ "/sub deny []",
+ "/sub show []",
+ "/sub sent",
+ "/sub received",
+ NULL
+ },
+ "Manage subscriptions to contact presence. "
+ "If jid is omitted, the contact of the current window is used.",
+ {
+ { "request []", "Send a subscription request to the user." },
+ { "allow []", "Approve a contact's subscription request." },
+ { "deny []", "Remove subscription for a contact, or deny a request." },
+ { "show []", "Show subscription status for a contact." },
+ { "sent", "Show all sent subscription requests pending a response." },
+ { "received", "Show all received subscription requests awaiting your response." },
+ END_ARGS },
+ {
+ "/sub request myfriend@jabber.org",
+ "/sub allow myfriend@jabber.org",
+ "/sub request",
+ "/sub sent",
+ NULL } }
+ },
{ "/tiny",
cmd_tiny, parse_args, 1, 1, NULL,
- { "/tiny url", "Send url as tinyurl in current chat.",
- { "/tiny url",
- "---------",
- "Send url as tinyurl in current chat.",
- "",
- "url : The url to make tiny.",
- "",
- "Example: /tiny http://www.profanity.im",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/tiny ",
+ NULL
+ },
+ "Send url as tinyurl in current chat.",
+ {
+ { "", "The url to make tiny." },
+ END_ARGS },
+ {
+ "Example: /tiny http://www.profanity.im",
+ NULL } }
+ },
{ "/who",
cmd_who, parse_args, 0, 2, NULL,
- { "/who [status|role|affiliation] [group]", "Show contacts/room occupants with chosen status, role or affiliation",
- { "/who [status|role|affiliation] [group]",
- "--------------------------------------",
- "Show contacts/room occupants with chosen status, role or affiliation",
- "",
- "status : online|offline|away|dnd|xa|chat|available|unavailable|any",
- " online : Contacts that are online, chat, away, xa, dnd",
- " available : Contacts that are available for chat - online, chat.",
- " unavailable : Contacts that are not available for chat - offline, away, xa, dnd.",
- " any : Contacts with any status (same as calling with no argument).",
- "role : moderator|participant|visitor",
- "affiliation : owner|admin|member",
- "group : Filter the results by the specified group.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/who",
+ "/who online|offline|away|dnd|xa|chat|available|unavailable|any []",
+ "/who moderator|participant|visitor",
+ "/who owner|admin|member",
+ NULL
+ },
+ "Show contacts or room occupants with chosen status, role or affiliation",
+ {
+ { "offline|away|dnd|xa|chat", "Show contacts or room occupants with specified presence." },
+ { "online", "Contacts that are online, chat, away, xa, dnd." },
+ { "available", "Contacts that are available for chat - online, chat." },
+ { "unavailable", "Contacts that are not available for chat - offline, away, xa, dnd." },
+ { "any", "Contacts with any status (same as calling with no argument)." },
+ { "", "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." },
+ END_ARGS },
+ {
+ "/who",
+ "/who xa",
+ "/who online friends",
+ "/who any family",
+ "/who particpant",
+ "/who admin",
+ NULL } }
+ },
{ "/close",
cmd_close, parse_args, 0, 1, NULL,
- { "/close [num|read|all]", "Close windows.",
- { "/close [num|read|all]",
- "---------------------",
- "Close the current window, or a number of windows.",
- "",
- "num : Close the specified window.",
- "all : Close all windows.",
- "read : Close all windows that have no new messages.",
- "",
- "Passing no argument will close the current window.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/close []",
+ "/close all|read",
+ NULL
+ },
+ "Close windows. "
+ "Passing no argument closes the current window.",
+ {
+ { "", "Close the specified window." },
+ { "all", "Close all windows." },
+ { "read", "Close all windows that have no unread messages." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/clear",
cmd_clear, parse_args, 0, 0, NULL,
- { "/clear", "Clear current window.",
- { "/clear",
- "------",
- "Clear the current window.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/clear",
+ NULL
+ },
+ "Clear the current window.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/quit",
cmd_quit, parse_args, 0, 0, NULL,
- { "/quit", "Quit Profanity.",
- { "/quit",
- "-----",
- "Logout of any current session, and quit Profanity.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/quit",
+ NULL
+ },
+ "Logout of any current session, and quit Profanity.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/privileges",
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
- { "/privileges on|off", "Show occupant privileges in chat rooms.",
- { "/privileges on|off",
- "------------------",
- "If enabled the room occupants panel will be grouped by role, and role information will be shown in the room.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/privileges on|off",
+ NULL
+ },
+ "Group occupants panel by role, and show role information in chat rooms.",
+ {
+ { "on|off", "Enable or disable privilege information." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
- { "/beep on|off", "Terminal beep on new messages.",
- { "/beep on|off",
- "------------",
- "Switch the terminal bell on or off.",
- "The bell will sound when incoming messages are received.",
- "If the terminal does not support sounds, it may attempt to flash the screen instead.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/beep on|off",
+ NULL
+ },
+ "Switch the terminal bell on or off. "
+ "The bell will sound when incoming messages are received. "
+ "If the terminal does not support sounds, it may attempt to flash the screen instead.",
+ {
+ { "on|off", "Enable or disable terminal bell." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/encwarn",
cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting,
- { "/encwarn on|off", "Titlebar encryption warning.",
- { "/encwarn on|off",
- "---------------",
- "Enabled or disable the unencrypted warning message in the titlebar.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/encwarn on|off",
+ NULL
+ },
+ "Titlebar encryption warning.",
+ {
+ { "on|off", "Enabled or disable the unencrypted warning message in the titlebar." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/presence",
cmd_presence, parse_args, 1, 1, &cons_presence_setting,
- { "/presence on|off", "Show the contacts presence in the titlebar.",
- { "/presence on|off",
- "----------------",
- "Switch display of the contacts presence in the titlebar on or off.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/presence on|off",
+ NULL
+ },
+ "Show the contacts presence in the titlebar.",
+ {
+ { "on|off", "Switch display of the contacts presence in the titlebar on or off." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/wrap",
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
- { "/wrap on|off", "Word wrapping.",
- { "/wrap on|off",
- "------------",
- "Enable or disable word wrapping in the main window.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/wrap on|off",
+ NULL
+ },
+ "Word wrapping.",
+ {
+ { "on|off", "Enable or disable word wrapping in the main window." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/winstidy",
cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting,
- { "/winstidy on|off", "Auto tidy windows.",
- { "/winstidy on|off",
- "----------------",
- "Enable or disable auto window tidy.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/winstidy on|off",
+ NULL
+ },
+ "Auto tidy windows, when a window is closed, windows will be moved to fill the gap.",
+ {
+ { "on|off", "Enable or disable auto window tidy." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/time",
cmd_time, parse_args, 1, 3, &cons_time_setting,
- { "/time main|statusbar set|off [format]", "Time display.",
- { "/time main|statusbar set|off [format]",
- "-------------------------------------",
- "Configure time display preferences.",
- "",
- "main set : Change time format to in main window.",
- "main off : Do not show time in main window.",
- "statusbar set : Change time format to in statusbar.",
- "statusbar off : Do not show time in status bar.",
- "",
- "Time formats are strings supported by g_date_time_format.",
- "See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format for more details.",
- "Example: /time main set %H:%M (main time will be set to HH:MM)",
- "Example: /time statusbar set yolo (statusbar time will all be changed to a static yolo)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/time main set ",
+ "/time main off",
+ "/time statusbar set ",
+ "/time statusbar off",
+ NULL
+ },
+ "Configure time display preferences. "
+ "Time formats are strings supported by g_date_time_format. "
+ "See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format for more details. "
+ "Setting the format to an unsupported string, will display the string. "
+ "If the format contains spaces, it must be surrounded with double quotes.",
+ {
+ { "main set ", "Change time format in main window." },
+ { "main off", "Do not show time in main window." },
+ { "statusbar set ", "Change time format in statusbar." },
+ { "statusbar off", "Change time format in status bar." },
+ END_ARGS },
+ {
+ "/time main set \"%d-%m-%y %H:%M\"",
+ "/time main off",
+ "/time statusbar set %H:%M",
+ NULL } }
+ },
{ "/inpblock",
cmd_inpblock, parse_args, 2, 2, &cons_inpblock_setting,
- { "/inpblock timeout|dynamic [millis|on|off]", "Configure input blocking.",
- { "/inpblock timeout|dynamic [millis|on|off]",
- "-----------------------------------------",
- "How long to wait for input before checking for new messages or checking for state changes such as 'idle'.",
- "",
- "timeout millis : Time to wait (1-1000) in milliseconds before reading input from the terminal buffer, default: 1000.",
- "dynamic on|off : Start with 0 millis and dynamically increase up to timeout when no activity, default: on.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/inpblock timeout ",
+ "/inpblock dynamic on|off",
+ NULL
+ },
+ "How long to wait for keyboard input before checking for new messages or checking for state changes such as 'idle'.",
+ {
+ { "timeout ", "Time to wait (1-1000) in milliseconds before reading input from the terminal buffer, default: 1000." },
+ { "dynamic on|off", "Start with 0 millis and dynamically increase up to timeout when no activity, default: on." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/notify",
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
- { "/notify [type value]|[type setting value]", "Control various desktop notifications.",
- { "/notify [type value]|[type setting value]",
- "-----------------------------------------",
- "Settings for various kinds of desktop notifications.",
- "",
- "message on|off : Notifications for regular messages.",
- "message current on|off : Whether messages in the current window trigger notifications.",
- "message text on|off : Show message text in message notifications.",
- "room on|off|mention : Notifications for chat room messages.",
- "room current on|off : Whether chat room messages in the current window trigger notifications.",
- "room text on|off : Show message text in chat room message notifications.",
- "remind seconds : Notification reminder period for unread messages, use 0 to disable.",
- "typing on|off : Notifications when contacts are typing.",
- "typing current of|off : Whether typing notifications are triggered for the current window.",
- "invite on|off : Notifications for chat room invites.",
- "sub on|off : Notifications for subscription requests.",
- "",
- "Example: /notify message on (enable message notifications)",
- "Example: /notify message text on (show message text in notifications)",
- "Example: /notify room mention (enable chat room notifications only on mention)",
- "Example: /notify room current off (disable room message notifications when window visible)",
- "Example: /notify room text off (do not show message text in chat room notifications)",
- "Example: /notify remind 10 (remind every 10 seconds)",
- "Example: /notify remind 0 (switch off reminders)",
- "Example: /notify typing on (enable typing notifications)",
- "Example: /notify invite on (enable chat room invite notifications)",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/notify message on|off",
+ "/notify message current on|off",
+ "/notify message text on|off",
+ "/notify room on|off|mention",
+ "/notify room current on|off",
+ "/notify room text on|off",
+ "/notify remind ",
+ "/notify typing on|off",
+ "/notify typing current on|off",
+ "/notify invite on|off",
+ "/notify sub on|off",
+ NULL
+ },
+ "Settings for various kinds of desktop notifications.",
+ {
+ { "message on|off", "Notifications for regular chat messages." },
+ { "message current on|off", "Whether messages in the current window trigger notifications." },
+ { "message text on|off", "Show message text in regular message notifications." },
+ { "room on|off|mention", "Notifications for chat room messages, mention triggers notifications only when your nick is mentioned." },
+ { "room current on|off", "Whether chat room messages in the current window trigger notifications." },
+ { "room text on|off", "Show message text in chat room message notifications." },
+ { "remind ", "Notification reminder period for unread messages, use 0 to disable." },
+ { "typing on|off", "Notifications when contacts are typing." },
+ { "typing current on|off", "Whether typing notifications are triggered for the current window." },
+ { "invite on|off", "Notifications for chat room invites." },
+ { "sub on|off", "Notifications for subscription requests." },
+ END_ARGS },
+ {
+ "/notify message on",
+ "/notify message text on",
+ "/notify room mention",
+ "/notify room current off",
+ "/notify room text off",
+ "/notify remind 10",
+ "/notify typing on",
+ "/notify invite on",
+ NULL } }
+ },
{ "/flash",
cmd_flash, parse_args, 1, 1, &cons_flash_setting,
- { "/flash on|off", "Terminal flash on new messages.",
- { "/flash on|off",
- "-------------",
- "Make the terminal flash when incoming messages are received in another window.",
- "If the terminal doesn't support flashing, it may attempt to beep.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/flash on|off",
+ NULL
+ },
+ "Make the terminal flash when incoming messages are received in another window. "
+ "If the terminal doesn't support flashing, it may attempt to beep.",
+ {
+ { "on|off", "Enable or disable terminal flash." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/intype",
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
- { "/intype on|off", "Show when contact is typing.",
- { "/intype on|off",
- "--------------",
- "Show when a contact is typing in the console, and in active message window.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/intype on|off",
+ NULL
+ },
+ "Show when a contact is typing in the console, and in active message window.",
+ {
+ { "on|off", "Enable or disable contact typing messages." },
+ END_ARGS },
+ {
+ NULL } }
+ },
+
{ "/splash",
cmd_splash, parse_args, 1, 1, &cons_splash_setting,
- { "/splash on|off", "Splash logo on startup and /about command.",
- { "/splash on|off",
- "--------------",
- "Switch on or off the ascii logo on start up and when the /about command is called.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/splash on|off",
+ NULL
+ },
+ "Switch on or off the ascii logo on start up and when the /about command is called.",
+ {
+ { "on|off", "Enable or disable splash logo." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/autoconnect",
cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
- { "/autoconnect set|off [account]", "Set account to autoconnect with.",
- { "/autoconnect set|off [account]",
- "------------------------------",
- "Enable or disable autoconnect on start up.",
- "The setting can be overridden by the -a (--account) command line option.",
- "",
- "Example: /autoconnect set jc@stuntteam.org (autoconnect with the specified account).",
- "Example: /autoconnect off (disable autoconnect).",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/autoconnect set ",
+ "/autoconnect off",
+ NULL
+ },
+ "Enable or disable autoconnect on start up. "
+ "The setting can be overridden by the -a (--account) command line option.",
+ {
+ { "set ", "Connect with account on start up." },
+ { "off", "Disable autoconnect." },
+ END_ARGS },
+ {
+ "/autoconnect set jc@stuntteam.org",
+ "/autoconnect off",
+ NULL } }
+ },
{ "/vercheck",
cmd_vercheck, parse_args, 0, 1, NULL,
- { "/vercheck [on|off]", "Check for a new release.",
- { "/vercheck [on|off]",
- "------------------",
- "Enable/disable a version check when Profanity starts, and each time the /about command is run.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/vercheck on|off",
+ NULL
+ },
+ "Check for new versions when Profanity starts, and when the /about command is run.",
+ {
+ { "on|off", "Enable or disable the version check." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/titlebar",
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
- { "/titlebar show|goodbye on|off", "Manage the terminal window title.",
- { "/titlebar show|goodbye on|off",
- "-----------------------------",
- "Show or hide a title and exit message in the terminal window title.",
- "",
- "show : Show current logged in user, and unread messages in the title.",
- "goodbye : Show a message in the title when exiting profanity.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/titlebar show on|off",
+ "/titlebar goodbye on|off",
+ NULL
+ },
+ "Allow Profanity to modify the window title bar.",
+ {
+ { "show on|off", "Show current logged in user, and unread messages as the window title." },
+ { "goodbye on|off", "Show a message in the title when exiting profanity." },
+ END_ARGS },
+ {
+ NULL } }
+ },
+
+
+ // OLD STYLE
+
{ "/alias",
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
From 19fb907bc5f44485b437b26a678900c8a2a665cc Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sat, 25 Jul 2015 20:43:16 +0100
Subject: [PATCH 08/25] Generate HTML docs using new help format
---
src/command/command.c | 84 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 71 insertions(+), 13 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index b2d3be9b..593adbd9 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -3510,22 +3510,80 @@ command_docgen(void)
while (curr) {
Command *pcmd = curr->data;
- fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
- fprintf(main_fragment, " \n", &pcmd->cmd[1]);
- fprintf(main_fragment, "%s \n", pcmd->cmd);
- fputs("Usage:
\n", main_fragment);
- fprintf(main_fragment, "
%s
\n", pcmd->help.usage);
+ // old style
+ if (pcmd->help.usage) {
+// fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
+// fprintf(main_fragment, " \n", &pcmd->cmd[1]);
+// fprintf(main_fragment, "%s \n", pcmd->cmd);
+// fputs("Usage:
\n", main_fragment);
+// fprintf(main_fragment, "
%s
\n", pcmd->help.usage);
+//
+// fputs("Details:
\n", main_fragment);
+// fputs("
", main_fragment);
+// int i = 2;
+// while (pcmd->help.long_help[i]) {
+// fprintf(main_fragment, "%s\n", pcmd->help.long_help[i++]);
+// }
+// fputs("
\nback to top \n", main_fragment);
+// fputs("\n", main_fragment);
- fputs("Details:
\n", main_fragment);
- fputs("
", main_fragment);
- int i = 2;
- while (pcmd->help.long_help[i]) {
- fprintf(main_fragment, "%s\n", pcmd->help.long_help[i++]);
+ // new style
+ } else {
+ fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
+ fprintf(main_fragment, " \n", &pcmd->cmd[1]);
+ fprintf(main_fragment, "%s \n", pcmd->cmd);
+
+ fputs("Synopsis
\n", main_fragment);
+ fputs("
", main_fragment);
+ int i = 0;
+ while (pcmd->help.synopsis[i]) {
+ char *str1 = str_replace(pcmd->help.synopsis[i], "<", "<");
+ char *str2 = str_replace(str1, ">", ">");
+ fprintf(main_fragment, "%s\n", str2);
+ i++;
+ }
+ fputs("
\n", main_fragment);
+
+ fputs("Description
\n", main_fragment);
+ fputs("", main_fragment);
+ fprintf(main_fragment, "%s\n", pcmd->help.desc);
+ fputs("
\n", main_fragment);
+
+ if (pcmd->help.args[0][0] != NULL) {
+ fputs("Arguments
\n", main_fragment);
+ fputs("", main_fragment);
+ for (i = 0; pcmd->help.args[i][0] != NULL; i++) {
+ fputs("", main_fragment);
+ fputs("", main_fragment);
+ fputs("", main_fragment);
+ char *str1 = str_replace(pcmd->help.args[i][0], "<", "<");
+ char *str2 = str_replace(str1, ">", ">");
+ fprintf(main_fragment, "%s", str2);
+ fputs("
", main_fragment);
+ fputs(" ", main_fragment);
+ fputs("", main_fragment);
+ fprintf(main_fragment, "%s", pcmd->help.args[i][1]);
+ fputs(" ", main_fragment);
+ fputs(" ", main_fragment);
+ }
+ fputs("
\n", main_fragment);
+ }
+
+ if (pcmd->help.examples[0] != NULL) {
+ fputs("Examples
\n", main_fragment);
+ fputs("
", main_fragment);
+ int i = 0;
+ while (pcmd->help.examples[i]) {
+ fprintf(main_fragment, "%s\n", pcmd->help.examples[i]);
+ i++;
+ }
+ fputs("
\n", main_fragment);
+ }
+
+ fputs("back to top \n", main_fragment);
+ fputs("\n", main_fragment);
}
- fputs("
\nback to top \n", main_fragment);
- fputs("\n", main_fragment);
-
curr = g_list_next(curr);
}
From b33f4777d09077b6f3042bc46ed49cfdabfb86bb Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sat, 25 Jul 2015 20:57:21 +0100
Subject: [PATCH 09/25] Fix formatting for variables in new help
---
src/command/command.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index 593adbd9..83e5bc10 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -123,8 +123,8 @@ static struct cmd_t command_defs[] =
},
"Help on using Profanity. Passing no arguments list help areas.",
{
- { "area", "Summary help for commands in a certain area of functionality." },
- { "command", "Full help for a specific command, for example '/help connect'." },
+ { " ", "Summary help for commands in a certain area of functionality." },
+ { "", "Full help for a specific command, for example '/help connect'." },
END_ARGS },
{
"/help commands",
@@ -159,9 +159,9 @@ static struct cmd_t command_defs[] =
"If no account is specified, the default is used if one is configured. "
"A local account is created with the JID as it's name if it doesn't already exist.",
{
- { "account", "The local account you wish to connect with, or a JID if connecting for the first time." },
- { "server ", "Supply a server if it is different to the domain part of your JID." },
- { "port ", "The port to use if different to the default (5222, or 5223 for SSL)." },
+ { "", "The local account you wish to connect with, or a JID if connecting for the first time." },
+ { "server ", "Supply a server if it is different to the domain part of your JID." },
+ { "port ", "The port to use if different to the default (5222, or 5223 for SSL)." },
END_ARGS },
{
"/connect",
@@ -299,8 +299,8 @@ static struct cmd_t command_defs[] =
"Passing no argument in a chat window will use the current recipient. "
"Passing no argument in a chat room will display information about the room.",
{
- { "contact", "The contact you wish to view information about." },
- { "nick", "When in a chat room, the occupant you wish to view information about." },
+ { "", "The contact you wish to view information about." },
+ { "", "When in a chat room, the occupant you wish to view information about." },
END_ARGS },
{
"/info mybuddy@chat.server.org",
@@ -319,8 +319,8 @@ static struct cmd_t command_defs[] =
"Find out a contacts, or room members client software capabilities. "
"If in private chat initiated from a chat room, no parameter is required.",
{
- { "fulljid", "If in the console or a chat window, the full JID for which you wish to see capabilities." },
- { "nick", "If in a chat room, nickname for which you wish to see capabilities." },
+ { "", "If in the console or a chat window, the full JID for which you wish to see capabilities." },
+ { "", "If in a chat room, nickname for which you wish to see capabilities." },
END_ARGS },
{
"/caps mybuddy@chat.server.org/laptop",
@@ -341,8 +341,8 @@ static struct cmd_t command_defs[] =
"If in private chat initiated from a chat room, no parameter is required. "
"If the contact's software does not support software version requests, nothing will be displayed.",
{
- { "fulljid", "If in the console or a chat window, the full JID for which you wish to see software information." },
- { "nick", "If in a chat room, nickname for which you wish to see software information." },
+ { "", "If in the console or a chat window, the full JID for which you wish to see software information." },
+ { "", "If in a chat room, nickname for which you wish to see software information." },
END_ARGS },
{
"/software mybuddy@chat.server.org/laptop",
@@ -362,8 +362,8 @@ static struct cmd_t command_defs[] =
"Find out a contact, or room members presence information. "
"If in a chat window the parameter is not required, the current recipient will be used.",
{
- { "contact", "The contact who's presence you which to see." },
- { "nick", "If in a chat room, the occupant who's presence you wish to see." },
+ { "", "The contact who's presence you which to see." },
+ { "", "If in a chat room, the occupant who's presence you wish to see." },
END_ARGS },
{
"/status buddy@server.com",
@@ -813,7 +813,7 @@ static struct cmd_t command_defs[] =
"/who xa",
"/who online friends",
"/who any family",
- "/who particpant",
+ "/who participant",
"/who admin",
NULL } }
},
@@ -1104,7 +1104,7 @@ static struct cmd_t command_defs[] =
"The setting can be overridden by the -a (--account) command line option.",
{
{ "set ", "Connect with account on start up." },
- { "off", "Disable autoconnect." },
+ { "off", "Disable autoconnect." },
END_ARGS },
{
"/autoconnect set jc@stuntteam.org",
From cb7504e67f6d7e7a48dac96d7d2c6ef1a373873f Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 00:17:16 +0100
Subject: [PATCH 10/25] Moved remaining help to new format
---
helpexample.txt | 89 -----
src/command/command.c | 822 ++++++++++++++++++++++++++----------------
2 files changed, 507 insertions(+), 404 deletions(-)
delete mode 100644 helpexample.txt
diff --git a/helpexample.txt b/helpexample.txt
deleted file mode 100644
index 4dc40169..00000000
--- a/helpexample.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-ROSTER
-
-Synopsis:
-/roster
-/roster online
-/roster show [offline|resource|empty]
-/roster hide [offline|resource|empty]
-/roster by group|presence|none
-/roster size
-/roster add []
-/roster remove
-/roster remove_all contacts
-/roster nick
-/roster clearnick
-
-Description:
-Manage your roster, and roster display settings. Passing no arguments displays your roster.
-
-Arguments:
-online : Show all online contacts in your roster.
-show : Show the roster panel.
-show offline : Show offline contacts in the roster panel.
-show resource : Show contact's connected resources in the roster panel.
-show empty : When grouping by presence, show empty presence groups
-hide : Hide the roster panel.
-hide offline : Hide offline contacts in the roster panel.
-hide resource : Hide contact's connected resources in the roster panel.
-hide empty : When grouping by presence, hide empty presence groups
-by group : Group contacts in the roster panel by roster group.
-by presence : Group contacts in the roster panel by presence.
-by none : No grouping in the roster panel.
-size : Percentage of the screen taken up by the roster (1-99).
-add [] : Add a new item to the roster.
-remove : Removes an item from the roster.
-remove_all contacts : Remove all items from roster.
-nick : Change a contacts nickname.
-clearnick : Removes the current nickname.
-
-Exmaples:
-/roster
-/roster add someone@contacts.org
-/roster add someone@contacts.org Buddy
-/roster remove someone@contacts.org
-/roster nick myfriend@chat.org My Friend
-/roster clearnick kai@server.com
-/roster size 15
-
-OTR
-
-Synopsis:
-/otr gen
-/otr myfp
-/otr theirfp
-/otr start []
-/otr end
-/otr trust
-/otr untrust
-/otr log on|off|redact
-/otr warn on|off
-/otr libver
-/otr policy manual|opportunistic|always
-/otr secret
-/otr question
-/otr answer
-
-Description:
-Off The Record message encryption commands.
-
-Arguments:
-gen : Generate your private key.
-myfp : Show your fingerprint.
-theirfp : Show contacts fingerprint.
-start : Start an OTR session with current recipient.
-start : Start an OTR session with the contact.
-end : End the current OTR session.
-trust : Indicate that you have verified the contact's fingerprint.
-untrust : Indicate the the contact's fingerprint is not verified.
-log on : Enable plaintext logging of OTR messages.
-log off : Disable logging of OTR messages.
-log redact : Log OTR messages as [redacted], the default.
-warn on : Show in the titlebar when unencrypted messaging is being used.
-warn off : Show in the titlebar when unencrypted messaging is being used.
-libver : Show which version of the libotr library is being used.
-policy manual : Set the global OTR policy.
-policy opportunistici : Set the global OTR policy.
-policy always : Set the global OTR policy.
-secret : Verify a contacts identity using a shared secret.
-question : Verify a contacts identity using a question and expected answer.
-answer : Respond to a question answer verification request with your answer.
diff --git a/src/command/command.c b/src/command/command.c
index 83e5bc10..fe332f4b 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1144,399 +1144,591 @@ static struct cmd_t command_defs[] =
NULL } }
},
-
- // OLD STYLE
-
-
{ "/alias",
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
- { "/alias add|remove|list [name value]", "Add your own command aliases.",
- { "/alias add|remove|list [name value]",
- "-----------------------------------",
- "Add, remove or show command aliases.",
- "",
- "add name value : Add a new command alias.",
- "remove name : Remove a command alias.",
- "list : List all aliases.",
- "",
- "Example: /alias add friends /who online friends",
- "Example: /alias add /q /quit",
- "Example: /alias a /away \"I'm in a meeting.\"",
- "Example: /alias remove q",
- "Example: /alias list",
- "",
- "The above aliases will be available as /friends and /a",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/alias list",
+ "/alias add ",
+ "/alias remove ",
+ NULL
+ },
+ "Add, remove or list command aliases.",
+ {
+ { "list", "List all aliases." },
+ { "add ", "Add a new command alias." },
+ { "remove ", "Remove a command alias." },
+ END_ARGS },
+ {
+ "/alias add friends /who online friends",
+ "/alias add /q /quit",
+ "/alias a /away \"I'm in a meeting.\"",
+ "/alias remove q",
+ "/alias list",
+ NULL } }
+ },
{ "/chlog",
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
- { "/chlog on|off", "Chat logging to file.",
- { "/chlog on|off",
- "-------------",
- "Switch chat logging on or off.",
- "This setting will be enabled if /history is set to on.",
- "When disabling this option, /history will also be disabled.",
- "See the /grlog setting for enabling logging of chat room (groupchat) messages.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/chlog on|off",
+ NULL
+ },
+ "Switch chat logging on or off. "
+ "This setting will be enabled if /history is set to on. "
+ "When disabling this option, /history will also be disabled. "
+ "See the /grlog setting for enabling logging of chat room (groupchat) messages.",
+ {
+ { "on|off", "Enable or disable chat logging." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/grlog",
cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
- { "/grlog on|off", "Chat logging of chat rooms to file.",
- { "/grlog on|off",
- "-------------",
- "Switch chat room logging on or off.",
- "See the /chlog setting for enabling logging of one to one chat.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/grlog on|off",
+ NULL
+ },
+ "Switch chat room logging on or off. "
+ "See the /chlog setting for enabling logging of one to one chat.",
+ {
+ { "on|off", "Enable or disable chat room logging." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/states",
cmd_states, parse_args, 1, 1, &cons_states_setting,
- { "/states on|off", "Send chat states during a chat session.",
- { "/states on|off",
- "--------------",
- "Send chat state notifications during chat sessions.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/states on|off",
+ NULL
+ },
+ "Send chat state notifications to recipient during chat sessions, such as typing, paused, active, gone.",
+ {
+ { "on|off", "Enable or disable sending of chat state notifications." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/pgp",
cmd_pgp, parse_args, 1, 3, NULL,
- { "/pgp command [args..]", "Open PGP commands.",
- { "/pgp command [args..]",
- "---------------------",
- "Open PGP commands.",
- "",
- "keys : List all keys.",
- "libver : Show which version of the libgpgme library is being used.",
- "fps : Show known fingerprints.",
- "setkey contact keyid : Manually associate a key ID with a JID.",
- "start [contact] : Start PGP encrypted chat, current contact will be used if not specified.",
- "end : End PGP encrypted chat with the current recipient.",
- "log on|off|redact : PGP message logging, default: redact.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/pgp libver",
+ "/pgp keys",
+ "/pgp fps",
+ "/pgp setkey ",
+ "/pgp start []",
+ "/pgp end",
+ "/pgp log on|off|redact",
+ NULL
+ },
+ "Open PGP commands to manage keys, and perform PGP encryption during chat sessions. "
+ "See the /account command to set your own PGP key.",
+ {
+ { "libver", "Show which version of the libgpgme library is being used." },
+ { "keys", "List all keys." },
+ { "fps", "Show known fingerprints." },
+ { "setkey ", "Manually associate a key ID with a JID." },
+ { "start []", "Start PGP encrypted chat, current contact will be used if not specified." },
+ { "end", "End PGP encrypted chat with the current recipient." },
+ { "log on|off", "Enable or disable plaintext logging of PGP encrypted messages." },
+ { "log redact", "Log PGP encrypted messages, but replace the contents with [redacted]. This is the default." },
+ END_ARGS },
+ {
+ "/pgp log off",
+ "/pgp setkey buddy@buddychat.org BA19CACE5A9592C5",
+ "/pgp start buddy@buddychat.org",
+ "/pgp end",
+ NULL } }
+ },
{ "/otr",
cmd_otr, parse_args, 1, 3, NULL,
- { "/otr command [args..]", "Off The Record encryption commands.",
- { "/otr command [args..]",
- "---------------------",
- "Off The Record encryption commands.",
- "",
- "gen : Generate your private key.",
- "myfp : Show your fingerprint.",
- "theirfp : Show contacts fingerprint.",
- "start [contact] : Start an OTR session with contact, or current recipient if omitted.",
- "end : End the current OTR session,",
- "trust : Indicate that you have verified the contact's fingerprint.",
- "untrust : Indicate the the contact's fingerprint is not verified,",
- "log on|off|redact : OTR message logging, default: redact.",
- "warn on|off : Show in the titlebar when unencrypted messaging is being used.",
- "libver : Show which version of the libotr library is being used.",
- "policy manual|opportunistic|always : Set the global OTR policy.",
- "secret [secret] : Verify a contacts identity using a shared secret.",
- "question [question] [answer] : Verify a contacts identity using a question and expected answer.",
- "answer [answer] : Respond to a question answer verification request with your answer.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/otr libver",
+ "/otr gen",
+ "/otr myfp|theirfp",
+ "/otr start []",
+ "/otr end",
+ "/otr trust|untrust",
+ "/otr secret ",
+ "/otr question ",
+ "/otr answer ",
+ "/otr policy manual|opportunistic|always",
+ "/otr log on|off|redact",
+ NULL
+ },
+ "Off The Record (OTR) commands to manage keys, and perform OTR encryption during chat sessions.",
+ {
+ { "libver", "Show which version of the libotr library is being used." },
+ { "gen", "Generate your private key." },
+ { "myfp", "Show your fingerprint." },
+ { "theirfp", "Show contacts fingerprint." },
+ { "start []", "Start an OTR session with contact, or current recipient if omitted." },
+ { "end", "End the current OTR session," },
+ { "trust|untrust", "Indicate whether or not you trust the contact's fingerprint." },
+ { "secret ", "Verify a contact's identity using a shared secret." },
+ { "question ", "Verify a contact's identity using a question and expected answer." },
+ { "answer ", "Respond to a question answer verification request with your answer." },
+ { "policy manual", "Set the global OTR policy to manual, OTR sessions must be started manually." },
+ { "policy opportunistic", "Set the global OTR policy to opportunistic, and OTR sessions will be attempted upon starting a conversation." },
+ { "policy always", "Set the global OTR policy to always, an error will be displayed if an OTR session cannot be initiated upon starting a conversation." },
+ { "log on|off", "Enable or disable plaintext logging of OTR encrypted messages." },
+ { "log redact", "Log OTR encrypted messages, but replace the contents with [redacted]. This is the default." },
+ END_ARGS },
+ {
+ "/otr log off",
+ "/otr policy manual",
+ "/otr gen",
+ "/otr start buddy@buddychat.org",
+ "/otr myfp",
+ "/otr theirfp",
+ "/otr question \"What is the name of my rabbit?\" fiffi",
+ "/otr end",
+ NULL } }
+ },
{ "/outtype",
cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
- { "/outtype on|off", "Send typing notification to recipient.",
- { "/outtype on|off",
- "---------------",
- "Send typing notifications, chat states (/states) will be enabled if this setting is set.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/outtype on|off",
+ NULL
+ },
+ "Send typing notifications, chat states (/states) will be enabled if this setting is enabled.",
+ {
+ { "on|off", "Enable or disable sending typing notifications." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/gone",
cmd_gone, parse_args, 1, 1, &cons_gone_setting,
- { "/gone minutes", "Send 'gone' state to recipient after a period.",
- { "/gone minutes",
- "-------------",
- "Send a 'gone' state to the recipient after the specified number of minutes.",
- "A value of 0 will disable sending this chat state.",
- "Chat states (/states) will be enabled if this setting is set.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/gone ",
+ NULL
+ },
+ "Send a 'gone' state to the recipient after the specified number of minutes. "
+ "Chat states (/states) will be enabled if this setting is set.",
+ {
+ { "", "Number of minutes of inactivity before sending the 'gone' state, a value of 0 will disable sending this state." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/history",
cmd_history, parse_args, 1, 1, &cons_history_setting,
- { "/history on|off", "Chat history in message windows.",
- { "/history on|off",
- "---------------",
- "Switch chat history on or off, /chlog will automatically be enabled when this setting is on.",
- "When history is enabled, previous messages are shown in chat windows.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/history on|off",
+ NULL
+ },
+ "Switch chat history on or off, /chlog will automatically be enabled when this setting is on. "
+ "When history is enabled, previous messages are shown in chat windows.",
+ {
+ { "on|off", "Enable or disable showing chat history." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/log",
cmd_log, parse_args, 1, 2, &cons_log_setting,
- { "/log where|rotate|maxsize|shared [value]", "Manage system logging settings.",
- { "/log where|rotate|maxsize|shared [value]",
- "----------------------------------------",
- "Manage profanity logging settings.",
- "",
- "where : Show the current log file location.",
- "rotate on|off : Rotate log, default on.",
- "maxsize bytes : With rotate enabled, specifies the max log size, defaults to 1048580 (1MB).",
- "shared on|off : Share logs between all instances, default: on.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/log where",
+ "/log rotate on|off",
+ "/log maxsize ",
+ "/log shared on|off",
+ NULL
+ },
+ "Manage profanity log settings.",
+ {
+ { "where", "Show the current log file location." },
+ { "rotate on|off", "Rotate log, default on." },
+ { "maxsize ", "With rotate enabled, specifies the max log size, defaults to 1048580 (1MB)." },
+ { "shared on|off", "Share logs between all instances, default: on. When off, the process id will be included in the log." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/carbons",
- cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
- { "/carbons on|off", "Message carbons.",
- { "/carbons on|off",
- "---------------",
- "Enable or disable message carbons.",
- "The message carbons feature ensures that both sides of all conversations are shared with all the user's clients that implement this protocol.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
+ { NULL, NULL, { NULL },
+ {
+ "/carbons on|off",
+ NULL
+ },
+ "Enable or disable message carbons. "
+ "Message carbons ensure that both sides of all conversations are shared with all the user's clients that implement this protocol.",
+ {
+ { "on|off", "Enable or disable message carbons." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/receipts",
- cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
- { "/receipts send|request on|off", "Message delivery receipts.",
- { "/receipts send|request on|off",
- "-----------------------------",
- "Enable or disable message delivery receipts. The interface will indicate when a message has been received.",
- "",
- "send on|off : Enable or disable sending of delivery receipts.",
- "request on|off : Enable or disable sending of delivery receipt requests.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
+ { NULL, NULL, { NULL },
+ {
+ "/receipts request on|off",
+ "/receipts send on|off",
+ NULL
+ },
+ "Enable or disable message delivery receipts. The interface will indicate when a message has been received.",
+ {
+ { "request on|off", "Whether or not to request a receipt upon sending a message." },
+ { "send on|off", "Whether or not to send a receipt if one has been requested with a received message." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/reconnect",
cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
- { "/reconnect seconds", "Set reconnect interval.",
- { "/reconnect seconds",
- "------------------",
- "Set the reconnect attempt interval in seconds for when the connection is lost.",
- "A value of 0 will switch off reconnect attempts.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/reconnect ",
+ NULL
+ },
+ "Set the reconnect attempt interval for when the connection is lost.",
+ {
+ { "", "Number of seconds before attempting to reconnect, a value of 0 disables reconnect." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/autoping",
cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
- { "/autoping seconds", "Server ping interval.",
- { "/autoping seconds",
- "-----------------",
- "Set the number of seconds between server pings, so ensure connection kept alive.",
- "A value of 0 will switch off autopinging the server.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/autoping ",
+ NULL
+ },
+ "Set the interval between sending ping requests to the server to ensure the connection is kept alive.",
+ {
+ { "", "Number of seconds between sending pings, a value of 0 disables autoping." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/ping",
cmd_ping, parse_args, 0, 1, NULL,
- { "/ping [target]", "Send ping IQ request.",
- { "/ping [target]",
- "--------------",
- "Sends an IQ ping stanza to the specified target.",
- "If no target is supplied, your chat server will be pinged.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/ping []",
+ NULL
+ },
+ "Sends an IQ ping stanza to the specified JID. "
+ "If no JID is supplied, your chat server will be pinged.",
+ {
+ { "", "The Jabber ID to send the ping request to." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/autoaway",
cmd_autoaway, parse_args_with_freetext, 2, 2, &cons_autoaway_setting,
- { "/autoaway mode|time|message|check value", "Set auto idle/away properties.",
- { "/autoaway mode|time|message|check value",
- "---------------------------------------",
- "Manage autoway properties.",
- "",
- "mode idle : Sends idle time, status remains online.",
- "mode away : Sends an away presence.",
- "mode off : Disabled (default).",
- "time minutes : Number of minutes before the presence change is sent, default: 15.",
- "message text|off : Optional message to send with the presence change, default: off (disabled).",
- "check on|off : When enabled, checks for activity and sends online presence, default: on.",
- "",
- "Example: /autoaway mode idle",
- "Example: /autoaway time 30",
- "Example: /autoaway message I'm not really doing much",
- "Example: /autoaway check off",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/autoaway mode idle|away|off",
+ "/autoaway time ",
+ "/autoaway message |off",
+ "/autoaway check on|off",
+ NULL
+ },
+ "Manage autoway settings for idle time.",
+ {
+ { "mode idle", "Sends idle time, status remains online." },
+ { "mode away", "Sends an away presence." },
+ { "mode off", "Disabled (default)." },
+ { "time ", "Number of minutes before the presence change is sent, default: 15." },
+ { "message ", "Optional message to send with the presence change, default: off (disabled)." },
+ { "message off", "Send no message with autoaway presence." },
+ { "check on|off", "When enabled, checks for activity and sends online presence, default: on." },
+ END_ARGS },
+ {
+ "/autoaway mode idle",
+ "/autoaway time 30",
+ "/autoaway message I'm not really doing much",
+ "/autoaway check off",
+ NULL } }
+ },
{ "/priority",
cmd_priority, parse_args, 1, 1, &cons_priority_setting,
- { "/priority value", "Set priority for the current account.",
- { "/priority value",
- "---------------",
- "Set priority for the current account.",
- "",
- "value : Number between -128 and 127, default: 0.",
- "",
- "See the /account command for specific priority settings per presence status.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/priority ",
+ NULL
+ },
+ "Set priority for the current account. "
+ "See the /account command for specific priority settings per presence status.",
+ {
+ { "", "Number between -128 and 127, default: 0." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/account",
cmd_account, parse_args, 0, 4, NULL,
- { "/account [command] [account] [property] [value]", "Manage accounts.",
- { "/account [command] [account] [property] [value]",
- "-----------------------------------------------",
- "Commands for creating and managing accounts.",
- "",
- "list : List all accounts.",
- "show account : Show information about an account.",
- "enable account : Enable the account, it will be used for autocomplete.",
- "disable account : Disable the account.",
- "default [set|off] [account] : Set the default account.",
- "add account : Create a new account.",
- "remove account : Remove an account.",
- "rename account newname : Rename account to newname.",
- "set account property value : Set 'property' of 'account' to 'value'.",
- "clear account property value : Clear 'property' of 'account'.",
- "",
- "Account properties.",
- "",
- "jid : The Jabber ID of the account, account name will be used if not set.",
- "server : The chat server, if different to the domainpart of the JID.",
- "port : The port used for connecting if not the default (5222, or 5223 for SSL).",
- "status : The presence status to use on login, use 'last' to use your last status before logging out.",
- "online|chat|away|xa|dnd : Priority for the specified presence.",
- "resource : The resource to be used.",
- "password : Password for the account, note this is currently stored in plaintext if set.",
- "eval_password : Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring.",
- "muc : The default MUC chat service to use.",
- "nick : The default nickname to use when joining chat rooms.",
- "otr : Override global OTR policy for this account: manual, opportunistic or always.",
- "",
- "Example: /account add me",
- "Example: /account set me jid me@chatty",
- "Example: /account set me server talk.chat.com",
- "Example: /account set me port 5111",
- "Example: /account set me muc chatservice.mycompany.com",
- "Example: /account set me nick dennis",
- "Example: /account set me status dnd",
- "Example: /account set me dnd -1",
- "Example: /account rename me gtalk",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/account",
+ "/account list",
+ "/account show ",
+ "/account enable|disable ",
+ "/account default set ",
+ "/account default off",
+ "/account add ",
+ "/account remove ",
+ "/account rename ",
+ "/account set jid ",
+ "/account set server ",
+ "/account set port ",
+ "/account set status ",
+ "/account set online|chat|away|xa|dnd ",
+ "/account set resource ",
+ "/account set password ",
+ "/account set eval_password ",
+ "/account set muc ",
+ "/account set nick ",
+ "/account set otr manual|opportunistic|always",
+ "/account set pgpkeyid ",
+ "/account clear password",
+ "/account clear eval_password",
+ "/account clear server",
+ "/account clear port",
+ "/account clear otr",
+ "/account clear pgpkeyid",
+ NULL
+ },
+ "Commands for creating and managing accounts. "
+ "Calling with no arguments will display information for the current account.",
+ {
+ { "list", "List all accounts." },
+ { "show ", "Show details for the specified account." },
+ { "enable ", "Enable the account, it will be used for autocompletion." },
+ { "disable ", "Disable the account." },
+ { "default set ", "Set the default account, used when no argument passed to the /connect command." },
+ { "default off", "Clear the default account setting." },
+ { "add ", "Create a new account." },
+ { "remove ", "Remove an account." },
+ { "rename ", "Rename 'account' to 'newaccount'." },
+ { "set jid ", "Set the Jabber ID for the account, account name will be used if not set." },
+ { "set server ", "The chat server, if different to the domainpart of the JID." },
+ { "set port ", "The port used for connecting if not the default (5222, or 5223 for SSL)." },
+ { "set status ", "The presence status to use on login, use 'last' to use your last status before logging out." },
+ { "set online|chat|away|xa|dnd ", "Set the priority (-128..127) to use for the specified presence." },
+ { "set resource ", "The resource to be used for this account." },
+ { "set password ", "Password for the account, note this is currently stored in plaintext if set." },
+ { "set eval_password ", "Shell command evaluated to retrieve password for the account. Can be used to retrieve password from keyring." },
+ { "set muc ", "The default MUC chat service to use, defaults to 'conference.' where the domain part is from the account JID." },
+ { "set nick ", "The default nickname to use when joining chat rooms." },
+ { "set otr manual|opportunistic|always", "Override global OTR policy for this account, see /otr." },
+ { "set pgpkeyid ", "Set the ID of the PGP key for this account, see /pgp." },
+ { "clear server", "Remove the server setting for this account." },
+ { "clear port", "Remove the port setting for this account." },
+ { "clear password", "Remove the password setting for this account." },
+ { "clear eval_password", "Remove the eval_password setting for this account." },
+ { "clear otr", "Remove the OTR policy setting for this account." },
+ { "clear pgpkeyid", "Remove pgpkeyid associated with this account." },
+ END_ARGS },
+ {
+ "/account add me",
+ "/account set me jid me@chatty",
+ "/account set me server talk.chat.com",
+ "/account set me port 5111",
+ "/account set me muc chatservice.mycompany.com",
+ "/account set me nick dennis",
+ "/account set me status dnd",
+ "/account set me dnd -1",
+ "/account rename me gtalk",
+ NULL } }
+ },
{ "/prefs",
cmd_prefs, parse_args, 0, 1, NULL,
- { "/prefs [ui|desktop|chat|log|conn|presence]", "Show configuration.",
- { "/prefs [ui|desktop|chat|log|conn|presence]",
- "------------------------------------------",
- "Show preferences for different areas of functionality.",
- "",
- "ui : User interface preferences.",
- "desktop : Desktop notification preferences.",
- "chat : Chat state preferences.",
- "log : Logging preferences.",
- "conn : Connection handling preferences.",
- "presence : Chat presence preferences.",
- "",
- "No argument shows all preferences.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/prefs [ui|desktop|chat|log|conn|presence]",
+ NULL
+ },
+ "Show preferences for different areas of functionality. "
+ "Passing no arguments shows all preferences.",
+ {
+ { "ui", "User interface preferences." },
+ { "desktop", "Desktop notification preferences." },
+ { "chat", "Chat state preferences." },
+ { "log", "Logging preferences." },
+ { "conn", "Connection handling preferences." },
+ { "presence", "Chat presence preferences." },
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/theme",
cmd_theme, parse_args, 1, 2, &cons_theme_setting,
- { "/theme list|load|colours [theme-name]", "Change colour theme.",
- { "/theme list|load|colours [theme-name]",
- "-------------------------------------",
- "Load a theme, includes colours and UI options.",
- "",
- "list : List all available themes.",
- "load theme-name : Load the named theme. 'default' will reset to the default theme.",
- "colours : Show the colour values as rendered by the terminal.",
- "",
- "Example: /theme list",
- "Example: /theme load mycooltheme",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/theme list",
+ "/theme load ",
+ "/theme colours",
+ NULL
+ },
+ "Load a theme, includes colours and UI options.",
+ {
+ { "list", "List all available themes." },
+ { "load ", "Load the specified theme. 'default' will reset to the default theme." },
+ { "colours", "Show the colour values as rendered by the terminal." },
+ END_ARGS },
+ {
+ "/theme list",
+ "/theme load forest",
+ NULL } }
+ },
{ "/statuses",
cmd_statuses, parse_args, 2, 2, &cons_statuses_setting,
- { "/statuses console|chat|muc setting", "Set preferences for presence change messages.",
- { "/statuses console|chat|muc setting",
- "----------------------------------",
- "Configure which presence changes are displayed in various windows.",
- "",
- "console : Configure what is displayed in the console window.",
- "chat : Configure what is displayed in chat windows.",
- "muc : Configure what is displayed in chat room windows.",
- "",
- "Available options are:",
- "",
- "all : Show all presence changes.",
- "online : Show only online/offline changes.",
- "none : Don't show any presence changes.",
- "",
- "The default is 'all' for all windows.",
- "",
- "Example: /statuses console none",
- "Example: /statuses chat online",
- "Example: /statuses muc all",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/statuses console|chat|muc all|online|none",
+ NULL
+ },
+ "Configure which presence changes are displayed in various windows. "
+ "The default is 'all' for all windows.",
+ {
+ { "console", "Configure what is displayed in the console window." },
+ { "chat", "Configure what is displayed in chat windows." },
+ { "muc", "Configure what is displayed in chat room windows." },
+ { "all", "Show all presence changes." },
+ { "online", "Show only online/offline changes." },
+ { "none", "Don't show any presence changes." },
+ END_ARGS },
+ {
+ "/statuses console none",
+ "/statuses chat online",
+ "/statuses muc all",
+ NULL } }
+ },
{ "/xmlconsole",
cmd_xmlconsole, parse_args, 0, 0, NULL,
- { "/xmlconsole", "Open the XML console",
- { "/xmlconsole",
- "-----------",
- "Open the XML console to view incoming and outgoing XMPP traffic.",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/xmlconsole",
+ NULL
+ },
+ "Open the XML console to view incoming and outgoing XMPP traffic.",
+ {
+ END_ARGS },
+ {
+ NULL } }
+ },
{ "/away",
cmd_away, parse_args_with_freetext, 0, 1, NULL,
- { "/away [message]", "Set status to away.",
- { "/away [message]",
- "---------------",
- "Set your status to 'away' with the optional message.",
- "",
- "Example: /away Gone for lunch",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/away []",
+ NULL
+ },
+ "Set your status to 'away'.",
+ {
+ { "", "Optional message to use with the status." },
+ END_ARGS },
+ {
+ "/away",
+ "/away Gone for lunch",
+ NULL } }
+ },
{ "/chat",
cmd_chat, parse_args_with_freetext, 0, 1, NULL,
- { "/chat [message]", "Set status to chat (available for chat).",
- { "/chat [message]",
- "---------------",
- "Set your status to 'chat', meaning 'available for chat', with the optional message.",
- "",
- "Example: /chat Please talk to me!",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/chat []",
+ NULL
+ },
+ "Set your status to 'chat' (available for chat).",
+ {
+ { "", "Optional message to use with the status." },
+ END_ARGS },
+ {
+ "/chat",
+ "/chat Please talk to me!",
+ NULL } }
+ },
{ "/dnd",
cmd_dnd, parse_args_with_freetext, 0, 1, NULL,
- { "/dnd [message]", "Set status to dnd (do not disturb).",
- { "/dnd [message]",
- "--------------",
- "Set your status to 'dnd', meaning 'do not disturb', with the optional message.",
- "",
- "Example: /dnd I'm in the zone",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/dnd []",
+ NULL
+ },
+ "Set your status to 'dnd' (do not disturb).",
+ {
+ { "", "Optional message to use with the status." },
+ END_ARGS },
+ {
+ "/dnd",
+ "/dnd I'm in the zone",
+ NULL } }
+ },
{ "/online",
cmd_online, parse_args_with_freetext, 0, 1, NULL,
- { "/online [message]", "Set status to online.",
- { "/online [message]",
- "-----------------",
- "Set your status to 'online' with the optional message.",
- "",
- "Example: /online Up the Irons!",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/online []",
+ NULL
+ },
+ "Set your status to 'online'.",
+ {
+ { "", "Optional message to use with the status." },
+ END_ARGS },
+ {
+ "/online",
+ "/online Up the Irons!",
+ NULL } }
+ },
{ "/xa",
cmd_xa, parse_args_with_freetext, 0, 1, NULL,
- { "/xa [message]", "Set status to xa (extended away).",
- { "/xa [message]",
- "-------------",
- "Set your status to 'xa', meaning 'extended away', with the optional message.",
- "",
- "Example: /xa This meeting is going to be a long one",
- NULL,
- NULL, NULL, NULL, NULL } } },
+ { NULL, NULL, { NULL },
+ {
+ "/xa []",
+ NULL
+ },
+ "Set your status to 'xa' (extended away).",
+ {
+ { "", "Optional message to use with the status." },
+ END_ARGS },
+ {
+ "/xa",
+ "/xa This meeting is going to be a long one",
+ NULL } }
+ },
};
static Autocomplete commands_ac;
From 36ebf0fc17f271e79445bfc320bef137bf3582bf Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 01:27:42 +0100
Subject: [PATCH 11/25] Updated help category output
---
src/command/command.c | 111 +++++++++++++++++------------------------
src/command/commands.c | 81 +++++++++++++++++++-----------
src/ui/console.c | 4 +-
3 files changed, 100 insertions(+), 96 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index fe332f4b..72b4a07a 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -3702,80 +3702,60 @@ command_docgen(void)
while (curr) {
Command *pcmd = curr->data;
+ fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
+ fprintf(main_fragment, " \n", &pcmd->cmd[1]);
+ fprintf(main_fragment, "%s \n", pcmd->cmd);
- // old style
- if (pcmd->help.usage) {
-// fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
-// fprintf(main_fragment, " \n", &pcmd->cmd[1]);
-// fprintf(main_fragment, "%s \n", pcmd->cmd);
-// fputs("Usage:
\n", main_fragment);
-// fprintf(main_fragment, "
%s
\n", pcmd->help.usage);
-//
-// fputs("Details:
\n", main_fragment);
-// fputs("
", main_fragment);
-// int i = 2;
-// while (pcmd->help.long_help[i]) {
-// fprintf(main_fragment, "%s\n", pcmd->help.long_help[i++]);
-// }
-// fputs("
\nback to top \n", main_fragment);
-// fputs("\n", main_fragment);
+ fputs("Synopsis
\n", main_fragment);
+ fputs("
", main_fragment);
+ int i = 0;
+ while (pcmd->help.synopsis[i]) {
+ char *str1 = str_replace(pcmd->help.synopsis[i], "<", "<");
+ char *str2 = str_replace(str1, ">", ">");
+ fprintf(main_fragment, "%s\n", str2);
+ i++;
+ }
+ fputs("
\n", main_fragment);
- // new style
- } else {
- fprintf(toc_fragment, "%s ,\n", &pcmd->cmd[1], pcmd->cmd);
- fprintf(main_fragment, " \n", &pcmd->cmd[1]);
- fprintf(main_fragment, "%s \n", pcmd->cmd);
+ fputs("Description
\n", main_fragment);
+ fputs("", main_fragment);
+ fprintf(main_fragment, "%s\n", pcmd->help.desc);
+ fputs("
\n", main_fragment);
- fputs("Synopsis
\n", main_fragment);
+ if (pcmd->help.args[0][0] != NULL) {
+ fputs("Arguments
\n", main_fragment);
+ fputs("", main_fragment);
+ for (i = 0; pcmd->help.args[i][0] != NULL; i++) {
+ fputs("", main_fragment);
+ fputs("", main_fragment);
+ fputs("", main_fragment);
+ char *str1 = str_replace(pcmd->help.args[i][0], "<", "<");
+ char *str2 = str_replace(str1, ">", ">");
+ fprintf(main_fragment, "%s", str2);
+ fputs("
", main_fragment);
+ fputs(" ", main_fragment);
+ fputs("", main_fragment);
+ fprintf(main_fragment, "%s", pcmd->help.args[i][1]);
+ fputs(" ", main_fragment);
+ fputs(" ", main_fragment);
+ }
+ fputs("
\n", main_fragment);
+ }
+
+ if (pcmd->help.examples[0] != NULL) {
+ fputs("Examples
\n", main_fragment);
fputs("
", main_fragment);
int i = 0;
- while (pcmd->help.synopsis[i]) {
- char *str1 = str_replace(pcmd->help.synopsis[i], "<", "<");
- char *str2 = str_replace(str1, ">", ">");
- fprintf(main_fragment, "%s\n", str2);
+ while (pcmd->help.examples[i]) {
+ fprintf(main_fragment, "%s\n", pcmd->help.examples[i]);
i++;
}
fputs("
\n", main_fragment);
-
- fputs("Description
\n", main_fragment);
- fputs("", main_fragment);
- fprintf(main_fragment, "%s\n", pcmd->help.desc);
- fputs("
\n", main_fragment);
-
- if (pcmd->help.args[0][0] != NULL) {
- fputs("Arguments
\n", main_fragment);
- fputs("", main_fragment);
- for (i = 0; pcmd->help.args[i][0] != NULL; i++) {
- fputs("", main_fragment);
- fputs("", main_fragment);
- fputs("", main_fragment);
- char *str1 = str_replace(pcmd->help.args[i][0], "<", "<");
- char *str2 = str_replace(str1, ">", ">");
- fprintf(main_fragment, "%s", str2);
- fputs("
", main_fragment);
- fputs(" ", main_fragment);
- fputs("", main_fragment);
- fprintf(main_fragment, "%s", pcmd->help.args[i][1]);
- fputs(" ", main_fragment);
- fputs(" ", main_fragment);
- }
- fputs("
\n", main_fragment);
- }
-
- if (pcmd->help.examples[0] != NULL) {
- fputs("Examples
\n", main_fragment);
- fputs("
", main_fragment);
- int i = 0;
- while (pcmd->help.examples[i]) {
- fprintf(main_fragment, "%s\n", pcmd->help.examples[i]);
- i++;
- }
- fputs("
\n", main_fragment);
- }
-
- fputs("back to top \n", main_fragment);
- fputs("\n", main_fragment);
}
+
+ fputs("back to top \n", main_fragment);
+ fputs("\n", main_fragment);
+
curr = g_list_next(curr);
}
@@ -3783,5 +3763,6 @@ command_docgen(void)
fclose(toc_fragment);
fclose(main_fragment);
+ printf("\nProcessed %d commands.\n\n", g_list_length(cmds));
g_list_free(cmds);
}
diff --git a/src/command/commands.c b/src/command/commands.c
index b5babf3c..f8979aec 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -76,7 +76,6 @@ static void _update_presence(const resource_presence_t presence,
static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
const char * const display, preference_t pref);
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
-static gint _compare_commands(Command *a, Command *b);
static void _who_room(ProfWin *window, gchar **args, struct cmd_help_t help);
static void _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help);
@@ -779,8 +778,8 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_help();
} else if (strcmp(args[0], "commands") == 0) {
cons_show("");
- cons_show("All commands");
- cons_show("");
+ ProfWin *console = wins_get_console();
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "All commands");
GList *ordered_commands = NULL;
GHashTableIter iter;
@@ -789,15 +788,36 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
g_hash_table_iter_init(&iter, commands);
while (g_hash_table_iter_next(&iter, &key, &value)) {
- ordered_commands = g_list_insert_sorted(ordered_commands, value, (GCompareFunc)_compare_commands);
+ Command *pcmd = (Command *)value;
+ ordered_commands = g_list_insert_sorted(ordered_commands, pcmd->cmd, (GCompareFunc)g_strcmp0);
}
+ int maxlen = 0;
GList *curr = ordered_commands;
while (curr) {
- Command *cmd = curr->data;
- cons_show("%-13s: %s", cmd->cmd, cmd->help.short_help);
+ gchar *cmd = curr->data;
+ int len = strlen(cmd);
+ if (len > maxlen) maxlen = len;
curr = g_list_next(curr);
}
+
+ GString *cmds = g_string_new("");
+ curr = ordered_commands;
+ int count = 0;
+ while (curr) {
+ gchar *cmd = curr->data;
+ if (count == 5) {
+ cons_show(cmds->str);
+ g_string_free(cmds, TRUE);
+ cmds = g_string_new("");
+ count = 0;
+ }
+ g_string_append_printf(cmds, "%-*s", maxlen + 1, cmd);
+ curr = g_list_next(curr);
+ count++;
+ }
+ cons_show(cmds->str);
+ g_string_free(cmds, TRUE);
g_list_free(ordered_commands);
g_list_free(curr);
@@ -4748,23 +4768,43 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
static void
_cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size)
{
+ ProfWin *console = wins_get_console();
cons_show("");
- cons_show("%s", heading);
- cons_show("");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", heading);
GList *ordered_commands = NULL;
int i;
for (i = 0; i < filter_size; i++) {
- Command *cmd = g_hash_table_lookup(commands, cmd_filter[i]);
- ordered_commands = g_list_insert_sorted(ordered_commands, cmd, (GCompareFunc)_compare_commands);
+ Command *pcmd = g_hash_table_lookup(commands, cmd_filter[i]);
+ ordered_commands = g_list_insert_sorted(ordered_commands, pcmd->cmd, (GCompareFunc)g_strcmp0);
}
+ int maxlen = 0;
GList *curr = ordered_commands;
while (curr) {
- Command *cmd = curr->data;
- cons_show("%-12s: %s", cmd->cmd, cmd->help.short_help);
+ gchar *cmd = curr->data;
+ int len = strlen(cmd);
+ if (len > maxlen) maxlen = len;
curr = g_list_next(curr);
}
+
+ GString *cmds = g_string_new("");
+ curr = ordered_commands;
+ int count = 0;
+ while (curr) {
+ gchar *cmd = curr->data;
+ if (count == 5) {
+ cons_show(cmds->str);
+ g_string_free(cmds, TRUE);
+ cmds = g_string_new("");
+ count = 0;
+ }
+ g_string_append_printf(cmds, "%-*s", maxlen + 1, cmd);
+ curr = g_list_next(curr);
+ count++;
+ }
+ cons_show(cmds->str);
+ g_string_free(cmds, TRUE);
g_list_free(ordered_commands);
g_list_free(curr);
@@ -4772,20 +4812,3 @@ _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size)
cons_show("Use /help [command] without the leading slash, for help on a specific command");
cons_show("");
}
-
-static
-gint _compare_commands(Command *a, Command *b)
-{
- const char * utf8_str_a = a->cmd;
- const char * utf8_str_b = b->cmd;
-
- gchar *key_a = g_utf8_collate_key(utf8_str_a, -1);
- gchar *key_b = g_utf8_collate_key(utf8_str_b, -1);
-
- gint result = g_strcmp0(key_a, key_b);
-
- g_free(key_a);
- g_free(key_b);
-
- return result;
-}
diff --git a/src/ui/console.c b/src/ui/console.c
index 20f6803e..67c1da58 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1533,9 +1533,9 @@ cons_help(void)
void
cons_navigation_help(void)
{
+ ProfWin *console = wins_get_console();
cons_show("");
- cons_show("Navigation:");
- cons_show("");
+ win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Navigation");
cons_show("Alt-1..Alt-0, F1..F10 : Choose window.");
cons_show("Alt-LEFT, Alt-RIGHT : Previous/next chat window");
cons_show("PAGEUP, PAGEDOWN : Page the main window.");
From 34537e2fb190505a7cf28ac5ca272f831c4b3b2e Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 02:05:53 +0100
Subject: [PATCH 12/25] Removed old command help
---
src/command/command.c | 162 +++++++-------
src/command/commands.c | 484 ++++++++++++++++++++---------------------
src/command/commands.h | 164 +++++++-------
src/ui/console.c | 12 +
src/ui/core.c | 15 +-
src/ui/ui.h | 3 +-
6 files changed, 414 insertions(+), 426 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index 72b4a07a..e5cda05c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -116,7 +116,7 @@ static struct cmd_t command_defs[] =
// NEW STYLE
{ "/help",
cmd_help, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/help [ |]",
NULL
@@ -135,7 +135,7 @@ static struct cmd_t command_defs[] =
{ "/about",
cmd_about, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/about",
NULL
@@ -149,7 +149,7 @@ static struct cmd_t command_defs[] =
{ "/connect",
cmd_connect, parse_args, 0, 5, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/connect []",
"/connect [server ] [port ]",
@@ -174,7 +174,7 @@ static struct cmd_t command_defs[] =
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/disconnect",
NULL
@@ -188,7 +188,7 @@ static struct cmd_t command_defs[] =
{ "/msg",
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/msg []",
"/msg []",
@@ -213,7 +213,7 @@ static struct cmd_t command_defs[] =
{ "/roster",
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/roster",
"/roster online",
@@ -264,7 +264,7 @@ static struct cmd_t command_defs[] =
{ "/group",
cmd_group, parse_args_with_freetext, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/group",
"/group show ",
@@ -289,7 +289,7 @@ static struct cmd_t command_defs[] =
{ "/info",
cmd_info, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/info",
"/info |",
@@ -310,7 +310,7 @@ static struct cmd_t command_defs[] =
{ "/caps",
cmd_caps, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/caps",
"/caps |",
@@ -331,7 +331,7 @@ static struct cmd_t command_defs[] =
{ "/software",
cmd_software, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/software",
"/software |",
@@ -353,7 +353,7 @@ static struct cmd_t command_defs[] =
{ "/status",
cmd_status, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/status",
"/status |",
@@ -373,7 +373,7 @@ static struct cmd_t command_defs[] =
{ "/resource",
cmd_resource, parse_args, 1, 2, &cons_resource_setting,
- { NULL, NULL, { NULL },
+ {
{
"/resource set ",
"/resource off",
@@ -394,7 +394,7 @@ static struct cmd_t command_defs[] =
{ "/join",
cmd_join, parse_args, 0, 5, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/join",
"/join [nick ] [password ]",
@@ -421,7 +421,7 @@ static struct cmd_t command_defs[] =
{ "/leave",
cmd_leave, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/leave",
NULL
@@ -435,7 +435,7 @@ static struct cmd_t command_defs[] =
{ "/invite",
cmd_invite, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/invite []",
NULL
@@ -451,7 +451,7 @@ static struct cmd_t command_defs[] =
{ "/invites",
cmd_invites, parse_args_with_freetext, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/invites",
NULL
@@ -465,7 +465,7 @@ static struct cmd_t command_defs[] =
{ "/decline",
cmd_decline, parse_args_with_freetext, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/decline ",
NULL
@@ -480,7 +480,7 @@ static struct cmd_t command_defs[] =
{ "/room",
cmd_room, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/room accept|destroy|config",
NULL
@@ -497,7 +497,7 @@ static struct cmd_t command_defs[] =
{ "/kick",
cmd_kick, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/kick []",
NULL
@@ -513,7 +513,7 @@ static struct cmd_t command_defs[] =
{ "/ban",
cmd_ban, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/ban []",
NULL
@@ -529,7 +529,7 @@ static struct cmd_t command_defs[] =
{ "/subject",
cmd_subject, parse_args_with_freetext, 0, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/subject set ",
"/subject clear",
@@ -546,7 +546,7 @@ static struct cmd_t command_defs[] =
{ "/affiliation",
cmd_affiliation, parse_args_with_freetext, 1, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/affiliation set []",
"/list []",
@@ -564,7 +564,7 @@ static struct cmd_t command_defs[] =
{ "/role",
cmd_role, parse_args_with_freetext, 1, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/role set []",
"/list []",
@@ -582,7 +582,7 @@ static struct cmd_t command_defs[] =
{ "/occupants",
cmd_occupants, parse_args, 1, 3, cons_occupants_setting,
- { NULL, NULL, { NULL },
+ {
{
"/occupants show|hide [jid]",
"/occupants default show|hide [jid]",
@@ -605,7 +605,7 @@ static struct cmd_t command_defs[] =
{ "/form",
cmd_form, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/form show",
"/form submit",
@@ -626,7 +626,7 @@ static struct cmd_t command_defs[] =
{ "/rooms",
cmd_rooms, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/rooms []",
NULL
@@ -643,7 +643,7 @@ static struct cmd_t command_defs[] =
{ "/bookmark",
cmd_bookmark, parse_args, 0, 8, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/bookmark",
"/bookmark list",
@@ -671,7 +671,7 @@ static struct cmd_t command_defs[] =
{ "/disco",
cmd_disco, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/disco info []",
"/disco items []",
@@ -693,7 +693,7 @@ static struct cmd_t command_defs[] =
{ "/nick",
cmd_nick, parse_args_with_freetext, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/nick ",
NULL
@@ -708,7 +708,7 @@ static struct cmd_t command_defs[] =
{ "/win",
cmd_win, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/win ",
NULL
@@ -723,7 +723,7 @@ static struct cmd_t command_defs[] =
{ "/wins",
cmd_wins, parse_args, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/wins tidy",
"/wins prune",
@@ -743,7 +743,7 @@ static struct cmd_t command_defs[] =
{ "/sub",
cmd_sub, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/sub request []",
"/sub allow []",
@@ -773,7 +773,7 @@ static struct cmd_t command_defs[] =
{ "/tiny",
cmd_tiny, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/tiny ",
NULL
@@ -789,7 +789,7 @@ static struct cmd_t command_defs[] =
{ "/who",
cmd_who, parse_args, 0, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/who",
"/who online|offline|away|dnd|xa|chat|available|unavailable|any []",
@@ -820,7 +820,7 @@ static struct cmd_t command_defs[] =
{ "/close",
cmd_close, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/close []",
"/close all|read",
@@ -839,7 +839,7 @@ static struct cmd_t command_defs[] =
{ "/clear",
cmd_clear, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/clear",
NULL
@@ -853,7 +853,7 @@ static struct cmd_t command_defs[] =
{ "/quit",
cmd_quit, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/quit",
NULL
@@ -867,7 +867,7 @@ static struct cmd_t command_defs[] =
{ "/privileges",
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
- { NULL, NULL, { NULL },
+ {
{
"/privileges on|off",
NULL
@@ -882,7 +882,7 @@ static struct cmd_t command_defs[] =
{ "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
- { NULL, NULL, { NULL },
+ {
{
"/beep on|off",
NULL
@@ -899,7 +899,7 @@ static struct cmd_t command_defs[] =
{ "/encwarn",
cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting,
- { NULL, NULL, { NULL },
+ {
{
"/encwarn on|off",
NULL
@@ -914,7 +914,7 @@ static struct cmd_t command_defs[] =
{ "/presence",
cmd_presence, parse_args, 1, 1, &cons_presence_setting,
- { NULL, NULL, { NULL },
+ {
{
"/presence on|off",
NULL
@@ -929,7 +929,7 @@ static struct cmd_t command_defs[] =
{ "/wrap",
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
- { NULL, NULL, { NULL },
+ {
{
"/wrap on|off",
NULL
@@ -944,7 +944,7 @@ static struct cmd_t command_defs[] =
{ "/winstidy",
cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting,
- { NULL, NULL, { NULL },
+ {
{
"/winstidy on|off",
NULL
@@ -959,7 +959,7 @@ static struct cmd_t command_defs[] =
{ "/time",
cmd_time, parse_args, 1, 3, &cons_time_setting,
- { NULL, NULL, { NULL },
+ {
{
"/time main set ",
"/time main off",
@@ -987,7 +987,7 @@ static struct cmd_t command_defs[] =
{ "/inpblock",
cmd_inpblock, parse_args, 2, 2, &cons_inpblock_setting,
- { NULL, NULL, { NULL },
+ {
{
"/inpblock timeout ",
"/inpblock dynamic on|off",
@@ -1004,7 +1004,7 @@ static struct cmd_t command_defs[] =
{ "/notify",
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
- { NULL, NULL, { NULL },
+ {
{
"/notify message on|off",
"/notify message current on|off",
@@ -1047,7 +1047,7 @@ static struct cmd_t command_defs[] =
{ "/flash",
cmd_flash, parse_args, 1, 1, &cons_flash_setting,
- { NULL, NULL, { NULL },
+ {
{
"/flash on|off",
NULL
@@ -1063,7 +1063,7 @@ static struct cmd_t command_defs[] =
{ "/intype",
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
- { NULL, NULL, { NULL },
+ {
{
"/intype on|off",
NULL
@@ -1079,7 +1079,7 @@ static struct cmd_t command_defs[] =
{ "/splash",
cmd_splash, parse_args, 1, 1, &cons_splash_setting,
- { NULL, NULL, { NULL },
+ {
{
"/splash on|off",
NULL
@@ -1094,7 +1094,7 @@ static struct cmd_t command_defs[] =
{ "/autoconnect",
cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoconnect set ",
"/autoconnect off",
@@ -1114,7 +1114,7 @@ static struct cmd_t command_defs[] =
{ "/vercheck",
cmd_vercheck, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/vercheck on|off",
NULL
@@ -1129,7 +1129,7 @@ static struct cmd_t command_defs[] =
{ "/titlebar",
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
- { NULL, NULL, { NULL },
+ {
{
"/titlebar show on|off",
"/titlebar goodbye on|off",
@@ -1146,7 +1146,7 @@ static struct cmd_t command_defs[] =
{ "/alias",
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/alias list",
"/alias add ",
@@ -1170,7 +1170,7 @@ static struct cmd_t command_defs[] =
{ "/chlog",
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
- { NULL, NULL, { NULL },
+ {
{
"/chlog on|off",
NULL
@@ -1188,7 +1188,7 @@ static struct cmd_t command_defs[] =
{ "/grlog",
cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
- { NULL, NULL, { NULL },
+ {
{
"/grlog on|off",
NULL
@@ -1204,7 +1204,7 @@ static struct cmd_t command_defs[] =
{ "/states",
cmd_states, parse_args, 1, 1, &cons_states_setting,
- { NULL, NULL, { NULL },
+ {
{
"/states on|off",
NULL
@@ -1219,7 +1219,7 @@ static struct cmd_t command_defs[] =
{ "/pgp",
cmd_pgp, parse_args, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/pgp libver",
"/pgp keys",
@@ -1252,7 +1252,7 @@ static struct cmd_t command_defs[] =
{ "/otr",
cmd_otr, parse_args, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/otr libver",
"/otr gen",
@@ -1299,7 +1299,7 @@ static struct cmd_t command_defs[] =
{ "/outtype",
cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
- { NULL, NULL, { NULL },
+ {
{
"/outtype on|off",
NULL
@@ -1314,7 +1314,7 @@ static struct cmd_t command_defs[] =
{ "/gone",
cmd_gone, parse_args, 1, 1, &cons_gone_setting,
- { NULL, NULL, { NULL },
+ {
{
"/gone ",
NULL
@@ -1330,7 +1330,7 @@ static struct cmd_t command_defs[] =
{ "/history",
cmd_history, parse_args, 1, 1, &cons_history_setting,
- { NULL, NULL, { NULL },
+ {
{
"/history on|off",
NULL
@@ -1346,7 +1346,7 @@ static struct cmd_t command_defs[] =
{ "/log",
cmd_log, parse_args, 1, 2, &cons_log_setting,
- { NULL, NULL, { NULL },
+ {
{
"/log where",
"/log rotate on|off",
@@ -1367,7 +1367,7 @@ static struct cmd_t command_defs[] =
{ "/carbons",
cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
- { NULL, NULL, { NULL },
+ {
{
"/carbons on|off",
NULL
@@ -1383,7 +1383,7 @@ static struct cmd_t command_defs[] =
{ "/receipts",
cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
- { NULL, NULL, { NULL },
+ {
{
"/receipts request on|off",
"/receipts send on|off",
@@ -1400,7 +1400,7 @@ static struct cmd_t command_defs[] =
{ "/reconnect",
cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
- { NULL, NULL, { NULL },
+ {
{
"/reconnect ",
NULL
@@ -1415,7 +1415,7 @@ static struct cmd_t command_defs[] =
{ "/autoping",
cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoping ",
NULL
@@ -1430,7 +1430,7 @@ static struct cmd_t command_defs[] =
{ "/ping",
cmd_ping, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/ping []",
NULL
@@ -1446,7 +1446,7 @@ static struct cmd_t command_defs[] =
{ "/autoaway",
cmd_autoaway, parse_args_with_freetext, 2, 2, &cons_autoaway_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoaway mode idle|away|off",
"/autoaway time ",
@@ -1474,7 +1474,7 @@ static struct cmd_t command_defs[] =
{ "/priority",
cmd_priority, parse_args, 1, 1, &cons_priority_setting,
- { NULL, NULL, { NULL },
+ {
{
"/priority ",
NULL
@@ -1490,7 +1490,7 @@ static struct cmd_t command_defs[] =
{ "/account",
cmd_account, parse_args, 0, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/account",
"/account list",
@@ -1567,7 +1567,7 @@ static struct cmd_t command_defs[] =
{ "/prefs",
cmd_prefs, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/prefs [ui|desktop|chat|log|conn|presence]",
NULL
@@ -1588,7 +1588,7 @@ static struct cmd_t command_defs[] =
{ "/theme",
cmd_theme, parse_args, 1, 2, &cons_theme_setting,
- { NULL, NULL, { NULL },
+ {
{
"/theme list",
"/theme load ",
@@ -1609,7 +1609,7 @@ static struct cmd_t command_defs[] =
{ "/statuses",
cmd_statuses, parse_args, 2, 2, &cons_statuses_setting,
- { NULL, NULL, { NULL },
+ {
{
"/statuses console|chat|muc all|online|none",
NULL
@@ -1633,7 +1633,7 @@ static struct cmd_t command_defs[] =
{ "/xmlconsole",
cmd_xmlconsole, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/xmlconsole",
NULL
@@ -1647,7 +1647,7 @@ static struct cmd_t command_defs[] =
{ "/away",
cmd_away, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/away []",
NULL
@@ -1664,7 +1664,7 @@ static struct cmd_t command_defs[] =
{ "/chat",
cmd_chat, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/chat []",
NULL
@@ -1681,7 +1681,7 @@ static struct cmd_t command_defs[] =
{ "/dnd",
cmd_dnd, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/dnd []",
NULL
@@ -1698,7 +1698,7 @@ static struct cmd_t command_defs[] =
{ "/online",
cmd_online, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/online []",
NULL
@@ -1715,7 +1715,7 @@ static struct cmd_t command_defs[] =
{ "/xa",
cmd_xa, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/xa []",
NULL
@@ -2502,10 +2502,10 @@ _cmd_execute(ProfWin *window, const char * const command, const char * const inp
if (cmd) {
gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
if (result == FALSE) {
- ui_invalid_command_usage(cmd->help.usage, cmd->setting_func);
+ ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
return TRUE;
} else {
- gboolean result = cmd->func(window, args, cmd->help);
+ gboolean result = cmd->func(window, args, command);
g_strfreev(args);
return result;
}
diff --git a/src/command/commands.c b/src/command/commands.c
index f8979aec..6f12f502 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -73,11 +73,11 @@
static void _update_presence(const resource_presence_t presence,
const char * const show, gchar **args);
-static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
+static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command,
const char * const display, preference_t pref);
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
-static void _who_room(ProfWin *window, gchar **args, struct cmd_help_t help);
-static void _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help);
+static void _who_room(ProfWin *window, gchar **args, const char * const command);
+static void _who_roster(ProfWin *window, gchar **args, const char * const command);
extern GHashTable *commands;
@@ -157,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
}
gboolean
-cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_connect(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
@@ -170,7 +170,7 @@ cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -261,26 +261,26 @@ cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_account(ProfWin *window, gchar **args, const char * const command)
{
- char *command = args[0];
+ char *subcmd = args[0];
- if (command == NULL) {
+ if (subcmd == NULL) {
if (jabber_get_connection_status() != JABBER_CONNECTED) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
ProfAccount *account = accounts_get_account(jabber_get_account_name());
cons_show_account(account);
account_free(account);
}
- } else if (strcmp(command, "list") == 0) {
+ } else if (strcmp(subcmd, "list") == 0) {
gchar **accounts = accounts_get_list();
cons_show_account_list(accounts);
g_strfreev(accounts);
- } else if (strcmp(command, "show") == 0) {
+ } else if (strcmp(subcmd, "show") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
ProfAccount *account = accounts_get_account(account_name);
if (account == NULL) {
@@ -291,19 +291,19 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
account_free(account);
}
}
- } else if (strcmp(command, "add") == 0) {
+ } else if (strcmp(subcmd, "add") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
accounts_add(account_name, NULL, 0);
cons_show("Account created.");
cons_show("");
}
- } else if (strcmp(command, "remove") == 0) {
+ } else if (strcmp(subcmd, "remove") == 0) {
char *account_name = args[1];
if(!account_name) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if(accounts_remove(account_name)){
@@ -319,10 +319,10 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
g_free(def);
}
- } else if (strcmp(command, "enable") == 0) {
+ } else if (strcmp(subcmd, "enable") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
if (accounts_enable(account_name)) {
cons_show("Account enabled.");
@@ -332,10 +332,10 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "disable") == 0) {
+ } else if (strcmp(subcmd, "disable") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
if (accounts_disable(account_name)) {
cons_show("Account disabled.");
@@ -345,9 +345,9 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "rename") == 0) {
+ } else if (strcmp(subcmd, "rename") == 0) {
if (g_strv_length(args) != 3) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *new_name = args[2];
@@ -360,7 +360,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "default") == 0) {
+ } else if (strcmp(subcmd, "default") == 0) {
if(g_strv_length(args) == 1){
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
@@ -375,7 +375,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_set_string(PREF_DEFAULT_ACCOUNT, NULL);
cons_show("Removed default account.");
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
} else if(g_strv_length(args) == 3) {
if(strcmp(args[1], "set") == 0){
@@ -386,14 +386,14 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Account %s does not exist.", args[2]);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
- } else if (strcmp(command, "set") == 0) {
+ } else if (strcmp(subcmd, "set") == 0) {
if (g_strv_length(args) != 4) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *property = args[2];
@@ -536,9 +536,9 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
}
- } else if (strcmp(command, "clear") == 0) {
+ } else if (strcmp(subcmd, "clear") == 0) {
if (g_strv_length(args) != 3) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *property = args[2];
@@ -578,6 +578,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
} else {
+ cons_bad_cmd_usage(command);
cons_show("");
}
@@ -585,7 +586,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_sub(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -599,7 +600,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
jid = args[1];
if (subcmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -666,7 +667,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
jid_destroy(jidp);
@@ -675,7 +676,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_disconnect(ProfWin *window, gchar **args, const char * const command)
{
if (jabber_get_connection_status() == JABBER_CONNECTED) {
char *jid = strdup(jabber_get_fulljid());
@@ -697,7 +698,7 @@ cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_quit(ProfWin *window, gchar **args, const char * const command)
{
log_info("Profanity is shutting down...");
exit(0);
@@ -705,7 +706,7 @@ cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_wins(ProfWin *window, gchar **args, const char * const command)
{
if (args[0] == NULL) {
cons_show_wins();
@@ -719,7 +720,7 @@ cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_prune_wins();
} else if (strcmp(args[0], "swap") == 0) {
if ((args[1] == NULL) || (args[2] == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
int source_win = atoi(args[1]);
int target_win = atoi(args[2]);
@@ -744,9 +745,9 @@ cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_winstidy(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
if (result && g_strcmp0(args[0], "on") == 0) {
ui_tidy_wins();
@@ -756,7 +757,7 @@ cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_win(ProfWin *window, gchar **args, const char * const command)
{
int num = atoi(args[0]);
@@ -771,7 +772,7 @@ cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_help(ProfWin *window, gchar **args, const char * const command)
{
int num_args = g_strv_length(args);
if (num_args == 0) {
@@ -874,17 +875,7 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
Command *command = g_hash_table_lookup(commands, cmd_with_slash);
if (command) {
- // old
- if (command->help.usage) {
- const gchar **help_text = command->help.long_help;
- ProfWin *console = wins_get_console();
- cons_show("");
- ui_show_lines(console, help_text);
-
- // new
- } else {
- cons_show_help(command);
- }
+ cons_show_help(command);
} else {
cons_show("No such command.");
}
@@ -895,14 +886,14 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_about(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_about(ProfWin *window, gchar **args, const char * const command)
{
ui_about();
return TRUE;
}
gboolean
-cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_prefs(ProfWin *window, gchar **args, const char * const command)
{
if (args[0] == NULL) {
cons_prefs();
@@ -940,14 +931,14 @@ cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show_pgp_prefs();
cons_show("");
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_theme(ProfWin *window, gchar **args, const char * const command)
{
// list themes
if (g_strcmp0(args[0], "list") == 0) {
@@ -958,7 +949,7 @@ cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
// load a theme
} else if (g_strcmp0(args[0], "load") == 0) {
if (args[1] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else if (theme_load(args[1])) {
ui_load_colours();
prefs_set_string(PREF_THEME, args[1]);
@@ -982,14 +973,14 @@ cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (g_strcmp0(args[0], "colours") == 0) {
cons_theme_colours();
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
static void
-_who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
+_who_room(ProfWin *window, gchar **args, const char * const command)
{
if ((g_strv_length(args) == 2) && args[1]) {
cons_show("Argument group is not applicable to chat rooms.");
@@ -1013,7 +1004,7 @@ _who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(args[0], "admin") != 0) &&
(g_strcmp0(args[0], "member") != 0) &&
(g_strcmp0(args[0], "outcast") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return;
}
@@ -1119,7 +1110,7 @@ _who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
}
static void
-_who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
+_who_roster(ProfWin *window, gchar **args, const char * const command)
{
char *presence = args[0];
@@ -1134,7 +1125,7 @@ _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
&& (strcmp(presence, "xa") != 0)
&& (strcmp(presence, "dnd") != 0)
&& (strcmp(presence, "any") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return;
}
@@ -1332,16 +1323,16 @@ _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_who(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else if (window->type == WIN_MUC) {
- _who_room(window, args, help);
+ _who_room(window, args, command);
} else {
- _who_roster(window, args, help);
+ _who_roster(window, args, command);
}
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
@@ -1352,7 +1343,7 @@ cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_msg(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
char *msg = args[1];
@@ -1419,7 +1410,7 @@ cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_group(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1450,7 +1441,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
if (strcmp(args[0], "show") == 0) {
char *group = args[1];
if (group == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1465,7 +1456,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
char *contact = args[2];
if ((group == NULL) || (contact == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1496,7 +1487,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
char *contact = args[2];
if ((group == NULL) || (contact == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1521,12 +1512,12 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_roster(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1557,7 +1548,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
// set roster size
} else if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
int intval = 0;
@@ -1607,7 +1598,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else if (g_strcmp0(args[0], "hide") == 0) {
@@ -1640,7 +1631,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
// roster grouping
@@ -1667,7 +1658,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
// add contact
@@ -1678,7 +1669,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *name = args[2];
roster_send_add_new(jid, name);
@@ -1693,7 +1684,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
roster_send_remove(jid);
}
@@ -1701,7 +1692,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (strcmp(args[0], "remove_all") == 0) {
if (g_strcmp0(args[1], "contacts") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (conn_status != JABBER_CONNECTED) {
@@ -1728,13 +1719,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *name = args[2];
if (name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1762,7 +1753,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1782,31 +1773,31 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_resource(ProfWin *window, gchar **args, const char * const command)
{
char *cmd = args[0];
char *setting = NULL;
if (g_strcmp0(cmd, "message") == 0) {
setting = args[1];
if (!setting) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
- return _cmd_set_boolean_preference(setting, help, "Message resource", PREF_RESOURCE_MESSAGE);
+ return _cmd_set_boolean_preference(setting, command, "Message resource", PREF_RESOURCE_MESSAGE);
}
} else if (g_strcmp0(cmd, "title") == 0) {
setting = args[1];
if (!setting) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
- return _cmd_set_boolean_preference(setting, help, "Title resource", PREF_RESOURCE_TITLE);
+ return _cmd_set_boolean_preference(setting, command, "Title resource", PREF_RESOURCE_TITLE);
}
}
@@ -1819,7 +1810,7 @@ cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
char *resource = args[1];
if (!resource) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1854,13 +1845,13 @@ cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
chat_session_remove(chatwin->barejid);
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_status(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
@@ -1925,7 +1916,7 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
}
cons_show_status(usr_jid);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
break;
default:
@@ -1936,7 +1927,7 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_info(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
@@ -2011,7 +2002,7 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("No such contact \"%s\" in roster.", usr);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
break;
default:
@@ -2022,7 +2013,7 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_caps(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
@@ -2099,7 +2090,7 @@ cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
gboolean
-cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_software(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
@@ -2163,7 +2154,7 @@ cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_join(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
@@ -2225,7 +2216,7 @@ cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[1], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
jid_destroy(room_arg);
return TRUE;
@@ -2261,7 +2252,7 @@ cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_invite(ProfWin *window, gchar **args, const char * const command)
{
char *contact = args[0];
char *reason = args[1];
@@ -2297,7 +2288,7 @@ cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_invites(ProfWin *window, gchar **args, const char * const command)
{
GSList *invites = muc_invites();
cons_show_room_invites(invites);
@@ -2306,7 +2297,7 @@ cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_decline(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_decline(ProfWin *window, gchar **args, const char * const command)
{
if (!muc_invites_contain(args[0])) {
cons_show("No such invite exists.");
@@ -2537,7 +2528,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
gboolean
-cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_form(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2555,7 +2546,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(args[0], "cancel") != 0) &&
(g_strcmp0(args[0], "show") != 0) &&
(g_strcmp0(args[0], "help") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2578,7 +2569,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
Command *command = g_hash_table_lookup(commands, "/form");
if (command) {
- help_text = command->help.long_help;
+ help_text = command->help.synopsis;
}
ui_show_lines((ProfWin*) confwin, help_text);
@@ -2611,7 +2602,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_kick(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2637,14 +2628,14 @@ cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help)
win_vprint((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_ban(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2666,13 +2657,13 @@ cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help)
char *reason = args[1];
iq_room_affiliation_set(mucwin->roomjid, jid, "outcast", reason);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_subject(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2704,7 +2695,7 @@ cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
if (args[1]) {
message_send_groupchat_subject(mucwin->roomjid, args[1]);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
@@ -2714,12 +2705,12 @@ cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_affiliation(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2735,7 +2726,7 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
char *cmd = args[0];
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2746,7 +2737,7 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(affiliation, "member") != 0) &&
(g_strcmp0(affiliation, "none") != 0) &&
(g_strcmp0(affiliation, "outcast") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2769,13 +2760,13 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
if (!affiliation) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *jid = args[2];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *reason = args[3];
@@ -2784,12 +2775,12 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_role(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2805,7 +2796,7 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
char *cmd = args[0];
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2815,7 +2806,7 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(role, "participant") != 0) &&
(g_strcmp0(role, "moderator") != 0) &&
(g_strcmp0(role, "none") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2837,13 +2828,13 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
if (!role) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *nick = args[2];
if (nick == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *reason = args[3];
@@ -2852,12 +2843,12 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_room(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2874,7 +2865,7 @@ cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
if ((g_strcmp0(args[0], "accept") != 0) &&
(g_strcmp0(args[0], "destroy") != 0) &&
(g_strcmp0(args[0], "config") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2920,7 +2911,7 @@ cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_occupants(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2931,7 +2922,7 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
int intval = 0;
@@ -2970,7 +2961,7 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
@@ -2998,14 +2989,14 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_room_hide_occupants(mucwin->roomjid);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_rooms(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3026,7 +3017,7 @@ cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_bookmark(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3052,7 +3043,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
} else {
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3062,7 +3053,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
} else {
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3090,7 +3081,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[2], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3101,7 +3092,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
if (autojoin) {
if ((strcmp(autojoin, "on") != 0) && (strcmp(autojoin, "off") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3126,7 +3117,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("No bookmark exists for %s.", jid);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
options_destroy(options);
@@ -3137,7 +3128,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_disco(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3167,7 +3158,7 @@ cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_nick(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3189,14 +3180,14 @@ cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_alias(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
if (strcmp(subcmd, "add") == 0) {
char *alias = args[1];
if (alias == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *alias_p = alias;
@@ -3211,7 +3202,7 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
char *value = args[2];
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
g_string_free(ac_value, TRUE);
return TRUE;
} else if (cmd_exists(ac_value->str)) {
@@ -3230,7 +3221,7 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (strcmp(subcmd, "remove") == 0) {
char *alias = args[1];
if (alias == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
if (alias[0] == '/') {
@@ -3255,13 +3246,13 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_free_aliases(aliases);
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_tiny(ProfWin *window, gchar **args, const char * const command)
{
char *url = args[0];
@@ -3313,14 +3304,14 @@ cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_clear(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_clear(ProfWin *window, gchar **args, const char * const command)
{
ui_clear_win(window);
return TRUE;
}
gboolean
-cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_close(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = 0;
@@ -3392,7 +3383,7 @@ cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_leave(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = wins_get_current_num();
@@ -3415,9 +3406,9 @@ cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_privileges(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "MUC privileges", PREF_MUC_PRIVILEGES);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES);
ui_redraw_all_room_rosters();
@@ -3425,21 +3416,21 @@ cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_beep(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_beep(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Sound", PREF_BEEP);
+ return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
}
gboolean
-cmd_presence(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_presence(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Contact presence", PREF_PRESENCE);
+ return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
}
gboolean
-cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_wrap(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Word wrap", PREF_WRAP);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP);
wins_resize_all();
@@ -3447,7 +3438,7 @@ cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_time(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) {
@@ -3464,7 +3455,7 @@ cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_redraw();
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else if (g_strcmp0(args[0], "main") == 0) {
@@ -3482,19 +3473,19 @@ cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
wins_resize_all();
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_states(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Sending chat states",
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states",
PREF_STATES);
// if disabled, disable outtype and gone
@@ -3507,26 +3498,26 @@ cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_titlebar(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_titlebar(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (g_strcmp0(args[0], "show") == 0 && g_strcmp0(args[1], "off") == 0) {
ui_clear_win_title();
}
if (g_strcmp0(args[0], "show") == 0) {
- return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
+ return _cmd_set_boolean_preference(args[1], command, "Titlebar show", PREF_TITLEBAR_SHOW);
} else {
- return _cmd_set_boolean_preference(args[1], help, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
+ return _cmd_set_boolean_preference(args[1], command, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
}
}
gboolean
-cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_outtype(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
+ gboolean result = _cmd_set_boolean_preference(args[0], command,
"Sending typing notifications", PREF_OUTTYPE);
// if enabled, enable states
@@ -3538,7 +3529,7 @@ cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_gone(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3562,7 +3553,7 @@ cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help)
gboolean
-cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_notify(ProfWin *window, gchar **args, const char * const command)
{
char *kind = args[0];
@@ -3570,7 +3561,7 @@ cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
if ((strcmp(kind, "message") != 0) && (strcmp(kind, "typing") != 0) &&
(strcmp(kind, "remind") != 0) && (strcmp(kind, "invite") != 0) &&
(strcmp(kind, "sub") != 0) && (strcmp(kind, "room") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
// set message setting
} else if (strcmp(kind, "message") == 0) {
@@ -3705,14 +3696,14 @@ cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_inpblock(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
char *value = args[1];
if (g_strcmp0(subcmd, "timeout") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3733,7 +3724,7 @@ cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(subcmd, "dynamic") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3742,23 +3733,23 @@ cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- return _cmd_set_boolean_preference(value, help, "Dynamic input blocking", PREF_INPBLOCK_DYNAMIC);
+ return _cmd_set_boolean_preference(value, command, "Dynamic input blocking", PREF_INPBLOCK_DYNAMIC);
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_log(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
char *value = args[1];
if (strcmp(subcmd, "maxsize") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3777,18 +3768,18 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
if (strcmp(subcmd, "rotate") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
- return _cmd_set_boolean_preference(value, help, "Log rotate", PREF_LOG_ROTATE);
+ return _cmd_set_boolean_preference(value, command, "Log rotate", PREF_LOG_ROTATE);
}
if (strcmp(subcmd, "shared") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
- gboolean result = _cmd_set_boolean_preference(value, help, "Shared log", PREF_LOG_SHARED);
+ gboolean result = _cmd_set_boolean_preference(value, command, "Shared log", PREF_LOG_SHARED);
log_reinit();
return result;
}
@@ -3799,7 +3790,7 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
/* TODO: make 'level' subcommand for debug level */
@@ -3807,7 +3798,7 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_reconnect(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3823,7 +3814,7 @@ cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
} else {
cons_show(err_msg);
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
free(err_msg);
}
@@ -3831,7 +3822,7 @@ cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoping(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3848,7 +3839,7 @@ cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
} else {
cons_show(err_msg);
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
free(err_msg);
}
@@ -3856,7 +3847,7 @@ cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_ping(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3876,7 +3867,7 @@ cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoaway(ProfWin *window, gchar **args, const char * const command)
{
char *setting = args[0];
char *value = args[1];
@@ -3927,15 +3918,14 @@ cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help)
}
if (strcmp(setting, "check") == 0) {
- return _cmd_set_boolean_preference(value, help, "Online check",
- PREF_AUTOAWAY_CHECK);
+ return _cmd_set_boolean_preference(value, command, "Online check", PREF_AUTOAWAY_CHECK);
}
return TRUE;
}
gboolean
-cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_priority(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3963,19 +3953,19 @@ cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_statuses(ProfWin *window, gchar **args, const char * const command)
{
if (strcmp(args[0], "console") != 0 &&
strcmp(args[0], "chat") != 0 &&
strcmp(args[0], "muc") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (strcmp(args[1], "all") != 0 &&
strcmp(args[1], "online") != 0 &&
strcmp(args[1], "none") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4016,7 +4006,7 @@ cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_vercheck(ProfWin *window, gchar **args, const char * const command)
{
int num_args = g_strv_length(args);
@@ -4024,13 +4014,12 @@ cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_check_version(TRUE);
return TRUE;
} else {
- return _cmd_set_boolean_preference(args[0], help,
- "Version checking", PREF_VERCHECK);
+ return _cmd_set_boolean_preference(args[0], command, "Version checking", PREF_VERCHECK);
}
}
gboolean
-cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command)
{
if (!ui_xmlconsole_exists()) {
ui_create_xmlconsole_win();
@@ -4042,28 +4031,25 @@ cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_flash(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_flash(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Screen flash", PREF_FLASH);
+ return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
}
gboolean
-cmd_intype(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_intype(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Show contact typing", PREF_INTYPE);
+ return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
}
gboolean
-cmd_splash(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_splash(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Splash screen", PREF_SPLASH);
+ return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
}
gboolean
-cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoconnect(ProfWin *window, gchar **args, const char * const command)
{
if (strcmp(args[0], "off") == 0) {
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
@@ -4072,16 +4058,15 @@ cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
cons_show("Autoconnect account set to: %s.", args[1]);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return true;
}
gboolean
-cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_chlog(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Chat logging", PREF_CHLOG);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
// if set to off, disable history
if (result == TRUE && (strcmp(args[0], "off") == 0)) {
@@ -4092,19 +4077,17 @@ cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_grlog(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_grlog(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Groupchat logging", PREF_GRLOG);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
return result;
}
gboolean
-cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_history(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Chat history", PREF_HISTORY);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
// if set to on, set chlog
if (result == TRUE && (strcmp(args[0], "on") == 0)) {
@@ -4115,10 +4098,9 @@ cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_carbons(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Message carbons preference", PREF_CARBONS);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -4136,61 +4118,59 @@ cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_receipts(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_receipts(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "send") == 0) {
- return _cmd_set_boolean_preference(args[1], help,
- "Send delivery receipts", PREF_RECEIPTS_SEND);
+ return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
} else if (g_strcmp0(args[0], "request") == 0) {
- return _cmd_set_boolean_preference(args[1], help,
- "Request delivery receipets", PREF_RECEIPTS_REQUEST);
+ return _cmd_set_boolean_preference(args[1], command, "Request delivery receipets", PREF_RECEIPTS_REQUEST);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_away(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_away(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_AWAY, "away", args);
return TRUE;
}
gboolean
-cmd_online(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_online(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_ONLINE, "online", args);
return TRUE;
}
gboolean
-cmd_dnd(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_dnd(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_DND, "dnd", args);
return TRUE;
}
gboolean
-cmd_chat(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_chat(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_CHAT, "chat", args);
return TRUE;
}
gboolean
-cmd_xa(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_xa(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_XA, "xa", args);
return TRUE;
}
gboolean
-cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_pgp(ProfWin *window, gchar **args, const char * const command)
{
#ifdef HAVE_LIBGPGME
if (args[0] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4212,7 +4192,7 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
@@ -4246,13 +4226,13 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
char *jid = args[1];
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *keyid = args[2];
if (!args[2]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4388,7 +4368,7 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
#else
cons_show("This version of Profanity has not been built with PGP support enabled");
@@ -4398,11 +4378,11 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_otr(ProfWin *window, gchar **args, const char * const command)
{
#ifdef HAVE_LIBOTR
if (args[0] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4424,7 +4404,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
@@ -4643,7 +4623,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *secret = args[1];
if (secret == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4654,7 +4634,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *question = args[1];
char *answer = args[2];
if (question == NULL || answer == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4688,7 +4668,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *answer = args[1];
if (answer == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4696,7 +4676,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
#else
@@ -4706,9 +4686,9 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_encwarn(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_encwarn(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Encryption warning message", PREF_ENC_WARN);
+ return _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN);
}
// helper function for status change commands
@@ -4734,7 +4714,7 @@ _update_presence(const resource_presence_t resource_presence,
// helper function for boolean preference commands
static gboolean
-_cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
+_cmd_set_boolean_preference(gchar *arg, const char * const command,
const char * const display, preference_t pref)
{
GString *enabled = g_string_new(display);
@@ -4744,9 +4724,7 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
g_string_append(disabled, " disabled.");
if (arg == NULL) {
- char usage[strlen(help.usage) + 8];
- sprintf(usage, "Usage: %s", help.usage);
- cons_show(usage);
+ cons_bad_cmd_usage(command);
} else if (strcmp(arg, "on") == 0) {
cons_show(enabled->str);
prefs_set_boolean(pref, TRUE);
@@ -4754,9 +4732,7 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
cons_show(disabled->str);
prefs_set_boolean(pref, FALSE);
} else {
- char usage[strlen(help.usage) + 8];
- sprintf(usage, "Usage: %s", help.usage);
- cons_show(usage);
+ cons_bad_cmd_usage(command);
}
g_string_free(enabled, TRUE);
diff --git a/src/command/commands.h b/src/command/commands.h
index bf0f94ae..70d5d5e0 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -39,10 +39,6 @@
// Command help strings
typedef struct cmd_help_t {
- const gchar *usage;
- const gchar *short_help;
- const gchar *long_help[50];
-
const gchar *synopsis[50];
const gchar *desc;
const gchar *args[50][2];
@@ -61,7 +57,7 @@ typedef struct cmd_help_t {
*/
typedef struct cmd_t {
gchar *cmd;
- gboolean (*func)(ProfWin *window, gchar **args, struct cmd_help_t help);
+ gboolean (*func)(ProfWin *window, gchar **args, const char * const command);
gchar** (*parser)(const char * const inp, int min, int max, gboolean *result);
int min_args;
int max_args;
@@ -72,85 +68,85 @@ typedef struct cmd_t {
gboolean cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran);
gboolean cmd_execute_default(ProfWin *window, const char * inp);
-gboolean cmd_about(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_away(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_beep(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_chat(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_clear(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_decline(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_dnd(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_flash(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_grlog(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_receipts(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_intype(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_online(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_splash(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_titlebar(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_xa(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_presence(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_encwarn(ProfWin *window, gchar **args, struct cmd_help_t help);
+gboolean cmd_about(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_account(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoaway(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoping(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_away(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_beep(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_caps(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_chat(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_chlog(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_clear(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_close(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_connect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_decline(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_disco(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_disconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_dnd(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_flash(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_gone(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_grlog(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_group(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_help(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_history(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_carbons(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_receipts(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_info(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_intype(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_invite(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_invites(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_join(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_leave(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_log(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_msg(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_nick(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_notify(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_online(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_otr(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_pgp(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_outtype(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_prefs(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_priority(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_quit(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_reconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_room(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_rooms(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_bookmark(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_roster(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_software(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_splash(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_states(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_status(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_statuses(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_sub(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_theme(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_tiny(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_titlebar(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_vercheck(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_who(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_win(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_wins(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_winstidy(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_xa(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_alias(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_ping(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_form(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_occupants(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_kick(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_ban(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_subject(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_affiliation(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_role(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_privileges(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_presence(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_wrap(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_time(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_resource(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_inpblock(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_encwarn(ProfWin *window, gchar **args, const char * const command);
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
diff --git a/src/ui/console.c b/src/ui/console.c
index 67c1da58..027f9e73 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -141,6 +141,18 @@ cons_show_help(Command *command)
}
}
+void
+cons_bad_cmd_usage(const char * const cmd)
+{
+ GString *msg = g_string_new("");
+ g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]);
+
+ cons_show("");
+ cons_show(msg->str);
+
+ g_string_free(msg, TRUE);
+}
+
void
cons_show_error(const char * const msg, ...)
{
diff --git a/src/ui/core.c b/src/ui/core.c
index 5f85a3cd..821de9fe 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -667,22 +667,25 @@ ui_handle_error(const char * const err_msg)
}
void
-ui_invalid_command_usage(const char * const usage, void (*setting_func)(void))
+ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void))
{
+ GString *msg = g_string_new("");
+ g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]);
+
if (setting_func) {
cons_show("");
(*setting_func)();
- cons_show("Usage: %s", usage);
+ cons_show(msg->str);
} else {
cons_show("");
- cons_show("Usage: %s", usage);
+ cons_show(msg->str);
ProfWin *current = wins_get_current();
if (current->type == WIN_CHAT) {
- char usage_cpy[strlen(usage) + 8];
- sprintf(usage_cpy, "Usage: %s", usage);
- ui_current_print_line(usage_cpy);
+ ui_current_print_line(msg->str);
}
}
+
+ g_string_free(msg, TRUE);
}
void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 58f1ee98..dba90d2b 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -228,7 +228,7 @@ void ui_input_clear(void);
void ui_input_nonblocking(gboolean);
void ui_write(char *line, int offset);
-void ui_invalid_command_usage(const char * const usage, void (*setting_func)(void));
+void ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void));
void ui_create_xmlconsole_win(void);
gboolean ui_xmlconsole_exists(void);
@@ -243,6 +243,7 @@ void cons_show(const char * const msg, ...);
void cons_about(void);
void cons_help(void);
void cons_show_help(Command *command);
+void cons_bad_cmd_usage(const char * const cmd);
void cons_navigation_help(void);
void cons_prefs(void);
void cons_show_ui_prefs(void);
From 4f9a8484292a02e283324b6e7a86ebd95f621127 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 02:09:01 +0100
Subject: [PATCH 13/25] Added message for invalid /wins usage
---
src/command/commands.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/command/commands.c b/src/command/commands.c
index 6f12f502..6f3dfbf3 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -739,6 +739,8 @@ cmd_wins(ProfWin *window, gchar **args, const char * const command)
cons_show("Same source and target window supplied.");
}
}
+ } else {
+ cons_bad_cmd_usage(command);
}
return TRUE;
From 2b725f9144570c8848a050dc52b7e9668c5fcde5 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 02:28:45 +0100
Subject: [PATCH 14/25] Reordered command arguments
---
src/command/command.c | 2 +-
src/command/commands.c | 170 ++++++++++++++++++++---------------------
src/command/commands.h | 160 +++++++++++++++++++-------------------
3 files changed, 166 insertions(+), 166 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index e5cda05c..3c8387dc 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -2505,7 +2505,7 @@ _cmd_execute(ProfWin *window, const char * const command, const char * const inp
ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
return TRUE;
} else {
- gboolean result = cmd->func(window, args, command);
+ gboolean result = cmd->func(window, command, args);
g_strfreev(args);
return result;
}
diff --git a/src/command/commands.c b/src/command/commands.c
index 6f3dfbf3..1f240cba 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -76,8 +76,8 @@ static void _update_presence(const resource_presence_t presence,
static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command,
const char * const display, preference_t pref);
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
-static void _who_room(ProfWin *window, gchar **args, const char * const command);
-static void _who_roster(ProfWin *window, gchar **args, const char * const command);
+static void _who_room(ProfWin *window, const char * const command, gchar **args);
+static void _who_roster(ProfWin *window, const char * const command, gchar **args);
extern GHashTable *commands;
@@ -157,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
}
gboolean
-cmd_connect(ProfWin *window, gchar **args, const char * const command)
+cmd_connect(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
@@ -261,7 +261,7 @@ cmd_connect(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_account(ProfWin *window, gchar **args, const char * const command)
+cmd_account(ProfWin *window, const char * const command, gchar **args)
{
char *subcmd = args[0];
@@ -586,7 +586,7 @@ cmd_account(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_sub(ProfWin *window, gchar **args, const char * const command)
+cmd_sub(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -676,7 +676,7 @@ cmd_sub(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_disconnect(ProfWin *window, gchar **args, const char * const command)
+cmd_disconnect(ProfWin *window, const char * const command, gchar **args)
{
if (jabber_get_connection_status() == JABBER_CONNECTED) {
char *jid = strdup(jabber_get_fulljid());
@@ -698,7 +698,7 @@ cmd_disconnect(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_quit(ProfWin *window, gchar **args, const char * const command)
+cmd_quit(ProfWin *window, const char * const command, gchar **args)
{
log_info("Profanity is shutting down...");
exit(0);
@@ -706,7 +706,7 @@ cmd_quit(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_wins(ProfWin *window, gchar **args, const char * const command)
+cmd_wins(ProfWin *window, const char * const command, gchar **args)
{
if (args[0] == NULL) {
cons_show_wins();
@@ -747,7 +747,7 @@ cmd_wins(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_winstidy(ProfWin *window, gchar **args, const char * const command)
+cmd_winstidy(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
@@ -759,7 +759,7 @@ cmd_winstidy(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_win(ProfWin *window, gchar **args, const char * const command)
+cmd_win(ProfWin *window, const char * const command, gchar **args)
{
int num = atoi(args[0]);
@@ -774,7 +774,7 @@ cmd_win(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_help(ProfWin *window, gchar **args, const char * const command)
+cmd_help(ProfWin *window, const char * const command, gchar **args)
{
int num_args = g_strv_length(args);
if (num_args == 0) {
@@ -888,14 +888,14 @@ cmd_help(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_about(ProfWin *window, gchar **args, const char * const command)
+cmd_about(ProfWin *window, const char * const command, gchar **args)
{
ui_about();
return TRUE;
}
gboolean
-cmd_prefs(ProfWin *window, gchar **args, const char * const command)
+cmd_prefs(ProfWin *window, const char * const command, gchar **args)
{
if (args[0] == NULL) {
cons_prefs();
@@ -940,7 +940,7 @@ cmd_prefs(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_theme(ProfWin *window, gchar **args, const char * const command)
+cmd_theme(ProfWin *window, const char * const command, gchar **args)
{
// list themes
if (g_strcmp0(args[0], "list") == 0) {
@@ -982,7 +982,7 @@ cmd_theme(ProfWin *window, gchar **args, const char * const command)
}
static void
-_who_room(ProfWin *window, gchar **args, const char * const command)
+_who_room(ProfWin *window, const char * const command, gchar **args)
{
if ((g_strv_length(args) == 2) && args[1]) {
cons_show("Argument group is not applicable to chat rooms.");
@@ -1112,7 +1112,7 @@ _who_room(ProfWin *window, gchar **args, const char * const command)
}
static void
-_who_roster(ProfWin *window, gchar **args, const char * const command)
+_who_roster(ProfWin *window, const char * const command, gchar **args)
{
char *presence = args[0];
@@ -1325,16 +1325,16 @@ _who_roster(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_who(ProfWin *window, gchar **args, const char * const command)
+cmd_who(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else if (window->type == WIN_MUC) {
- _who_room(window, args, command);
+ _who_room(window, command, args);
} else {
- _who_roster(window, args, command);
+ _who_roster(window, command, args);
}
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
@@ -1345,7 +1345,7 @@ cmd_who(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_msg(ProfWin *window, gchar **args, const char * const command)
+cmd_msg(ProfWin *window, const char * const command, gchar **args)
{
char *usr = args[0];
char *msg = args[1];
@@ -1412,7 +1412,7 @@ cmd_msg(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_group(ProfWin *window, gchar **args, const char * const command)
+cmd_group(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1519,7 +1519,7 @@ cmd_group(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_roster(ProfWin *window, gchar **args, const char * const command)
+cmd_roster(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1781,7 +1781,7 @@ cmd_roster(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_resource(ProfWin *window, gchar **args, const char * const command)
+cmd_resource(ProfWin *window, const char * const command, gchar **args)
{
char *cmd = args[0];
char *setting = NULL;
@@ -1853,7 +1853,7 @@ cmd_resource(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_status(ProfWin *window, gchar **args, const char * const command)
+cmd_status(ProfWin *window, const char * const command, gchar **args)
{
char *usr = args[0];
@@ -1929,7 +1929,7 @@ cmd_status(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_info(ProfWin *window, gchar **args, const char * const command)
+cmd_info(ProfWin *window, const char * const command, gchar **args)
{
char *usr = args[0];
@@ -2015,7 +2015,7 @@ cmd_info(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_caps(ProfWin *window, gchar **args, const char * const command)
+cmd_caps(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
@@ -2092,7 +2092,7 @@ cmd_caps(ProfWin *window, gchar **args, const char * const command)
gboolean
-cmd_software(ProfWin *window, gchar **args, const char * const command)
+cmd_software(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
@@ -2156,7 +2156,7 @@ cmd_software(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_join(ProfWin *window, gchar **args, const char * const command)
+cmd_join(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
@@ -2254,7 +2254,7 @@ cmd_join(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_invite(ProfWin *window, gchar **args, const char * const command)
+cmd_invite(ProfWin *window, const char * const command, gchar **args)
{
char *contact = args[0];
char *reason = args[1];
@@ -2290,7 +2290,7 @@ cmd_invite(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_invites(ProfWin *window, gchar **args, const char * const command)
+cmd_invites(ProfWin *window, const char * const command, gchar **args)
{
GSList *invites = muc_invites();
cons_show_room_invites(invites);
@@ -2299,7 +2299,7 @@ cmd_invites(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_decline(ProfWin *window, gchar **args, const char * const command)
+cmd_decline(ProfWin *window, const char * const command, gchar **args)
{
if (!muc_invites_contain(args[0])) {
cons_show("No such invite exists.");
@@ -2530,7 +2530,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
gboolean
-cmd_form(ProfWin *window, gchar **args, const char * const command)
+cmd_form(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2604,7 +2604,7 @@ cmd_form(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_kick(ProfWin *window, gchar **args, const char * const command)
+cmd_kick(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2637,7 +2637,7 @@ cmd_kick(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_ban(ProfWin *window, gchar **args, const char * const command)
+cmd_ban(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2665,7 +2665,7 @@ cmd_ban(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_subject(ProfWin *window, gchar **args, const char * const command)
+cmd_subject(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2712,7 +2712,7 @@ cmd_subject(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_affiliation(ProfWin *window, gchar **args, const char * const command)
+cmd_affiliation(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2782,7 +2782,7 @@ cmd_affiliation(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_role(ProfWin *window, gchar **args, const char * const command)
+cmd_role(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2850,7 +2850,7 @@ cmd_role(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_room(ProfWin *window, gchar **args, const char * const command)
+cmd_room(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2913,7 +2913,7 @@ cmd_room(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_occupants(ProfWin *window, gchar **args, const char * const command)
+cmd_occupants(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2998,7 +2998,7 @@ cmd_occupants(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_rooms(ProfWin *window, gchar **args, const char * const command)
+cmd_rooms(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3019,7 +3019,7 @@ cmd_rooms(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_bookmark(ProfWin *window, gchar **args, const char * const command)
+cmd_bookmark(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3130,7 +3130,7 @@ cmd_bookmark(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_disco(ProfWin *window, gchar **args, const char * const command)
+cmd_disco(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3160,7 +3160,7 @@ cmd_disco(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_nick(ProfWin *window, gchar **args, const char * const command)
+cmd_nick(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3182,7 +3182,7 @@ cmd_nick(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_alias(ProfWin *window, gchar **args, const char * const command)
+cmd_alias(ProfWin *window, const char * const command, gchar **args)
{
char *subcmd = args[0];
@@ -3254,7 +3254,7 @@ cmd_alias(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_tiny(ProfWin *window, gchar **args, const char * const command)
+cmd_tiny(ProfWin *window, const char * const command, gchar **args)
{
char *url = args[0];
@@ -3306,14 +3306,14 @@ cmd_tiny(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_clear(ProfWin *window, gchar **args, const char * const command)
+cmd_clear(ProfWin *window, const char * const command, gchar **args)
{
ui_clear_win(window);
return TRUE;
}
gboolean
-cmd_close(ProfWin *window, gchar **args, const char * const command)
+cmd_close(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = 0;
@@ -3385,7 +3385,7 @@ cmd_close(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_leave(ProfWin *window, gchar **args, const char * const command)
+cmd_leave(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = wins_get_current_num();
@@ -3408,7 +3408,7 @@ cmd_leave(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_privileges(ProfWin *window, gchar **args, const char * const command)
+cmd_privileges(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES);
@@ -3418,19 +3418,19 @@ cmd_privileges(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_beep(ProfWin *window, gchar **args, const char * const command)
+cmd_beep(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
}
gboolean
-cmd_presence(ProfWin *window, gchar **args, const char * const command)
+cmd_presence(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
}
gboolean
-cmd_wrap(ProfWin *window, gchar **args, const char * const command)
+cmd_wrap(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP);
@@ -3440,7 +3440,7 @@ cmd_wrap(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_time(ProfWin *window, gchar **args, const char * const command)
+cmd_time(ProfWin *window, const char * const command, gchar **args)
{
if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) {
@@ -3485,7 +3485,7 @@ cmd_time(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_states(ProfWin *window, gchar **args, const char * const command)
+cmd_states(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states",
PREF_STATES);
@@ -3500,7 +3500,7 @@ cmd_states(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_titlebar(ProfWin *window, gchar **args, const char * const command)
+cmd_titlebar(ProfWin *window, const char * const command, gchar **args)
{
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
cons_bad_cmd_usage(command);
@@ -3517,7 +3517,7 @@ cmd_titlebar(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_outtype(ProfWin *window, gchar **args, const char * const command)
+cmd_outtype(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command,
"Sending typing notifications", PREF_OUTTYPE);
@@ -3531,7 +3531,7 @@ cmd_outtype(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_gone(ProfWin *window, gchar **args, const char * const command)
+cmd_gone(ProfWin *window, const char * const command, gchar **args)
{
char *value = args[0];
@@ -3555,7 +3555,7 @@ cmd_gone(ProfWin *window, gchar **args, const char * const command)
gboolean
-cmd_notify(ProfWin *window, gchar **args, const char * const command)
+cmd_notify(ProfWin *window, const char * const command, gchar **args)
{
char *kind = args[0];
@@ -3698,7 +3698,7 @@ cmd_notify(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_inpblock(ProfWin *window, gchar **args, const char * const command)
+cmd_inpblock(ProfWin *window, const char * const command, gchar **args)
{
char *subcmd = args[0];
char *value = args[1];
@@ -3744,7 +3744,7 @@ cmd_inpblock(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_log(ProfWin *window, gchar **args, const char * const command)
+cmd_log(ProfWin *window, const char * const command, gchar **args)
{
char *subcmd = args[0];
char *value = args[1];
@@ -3800,7 +3800,7 @@ cmd_log(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_reconnect(ProfWin *window, gchar **args, const char * const command)
+cmd_reconnect(ProfWin *window, const char * const command, gchar **args)
{
char *value = args[0];
@@ -3824,7 +3824,7 @@ cmd_reconnect(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_autoping(ProfWin *window, gchar **args, const char * const command)
+cmd_autoping(ProfWin *window, const char * const command, gchar **args)
{
char *value = args[0];
@@ -3849,7 +3849,7 @@ cmd_autoping(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_ping(ProfWin *window, gchar **args, const char * const command)
+cmd_ping(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3869,7 +3869,7 @@ cmd_ping(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_autoaway(ProfWin *window, gchar **args, const char * const command)
+cmd_autoaway(ProfWin *window, const char * const command, gchar **args)
{
char *setting = args[0];
char *value = args[1];
@@ -3927,7 +3927,7 @@ cmd_autoaway(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_priority(ProfWin *window, gchar **args, const char * const command)
+cmd_priority(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3955,7 +3955,7 @@ cmd_priority(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_statuses(ProfWin *window, gchar **args, const char * const command)
+cmd_statuses(ProfWin *window, const char * const command, gchar **args)
{
if (strcmp(args[0], "console") != 0 &&
strcmp(args[0], "chat") != 0 &&
@@ -4008,7 +4008,7 @@ cmd_statuses(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_vercheck(ProfWin *window, gchar **args, const char * const command)
+cmd_vercheck(ProfWin *window, const char * const command, gchar **args)
{
int num_args = g_strv_length(args);
@@ -4021,7 +4021,7 @@ cmd_vercheck(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command)
+cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args)
{
if (!ui_xmlconsole_exists()) {
ui_create_xmlconsole_win();
@@ -4033,25 +4033,25 @@ cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_flash(ProfWin *window, gchar **args, const char * const command)
+cmd_flash(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
}
gboolean
-cmd_intype(ProfWin *window, gchar **args, const char * const command)
+cmd_intype(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
}
gboolean
-cmd_splash(ProfWin *window, gchar **args, const char * const command)
+cmd_splash(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
}
gboolean
-cmd_autoconnect(ProfWin *window, gchar **args, const char * const command)
+cmd_autoconnect(ProfWin *window, const char * const command, gchar **args)
{
if (strcmp(args[0], "off") == 0) {
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
@@ -4066,7 +4066,7 @@ cmd_autoconnect(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_chlog(ProfWin *window, gchar **args, const char * const command)
+cmd_chlog(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
@@ -4079,7 +4079,7 @@ cmd_chlog(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_grlog(ProfWin *window, gchar **args, const char * const command)
+cmd_grlog(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
@@ -4087,7 +4087,7 @@ cmd_grlog(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_history(ProfWin *window, gchar **args, const char * const command)
+cmd_history(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
@@ -4100,7 +4100,7 @@ cmd_history(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_carbons(ProfWin *window, gchar **args, const char * const command)
+cmd_carbons(ProfWin *window, const char * const command, gchar **args)
{
gboolean result = _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
@@ -4120,7 +4120,7 @@ cmd_carbons(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_receipts(ProfWin *window, gchar **args, const char * const command)
+cmd_receipts(ProfWin *window, const char * const command, gchar **args)
{
if (g_strcmp0(args[0], "send") == 0) {
return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
@@ -4133,42 +4133,42 @@ cmd_receipts(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_away(ProfWin *window, gchar **args, const char * const command)
+cmd_away(ProfWin *window, const char * const command, gchar **args)
{
_update_presence(RESOURCE_AWAY, "away", args);
return TRUE;
}
gboolean
-cmd_online(ProfWin *window, gchar **args, const char * const command)
+cmd_online(ProfWin *window, const char * const command, gchar **args)
{
_update_presence(RESOURCE_ONLINE, "online", args);
return TRUE;
}
gboolean
-cmd_dnd(ProfWin *window, gchar **args, const char * const command)
+cmd_dnd(ProfWin *window, const char * const command, gchar **args)
{
_update_presence(RESOURCE_DND, "dnd", args);
return TRUE;
}
gboolean
-cmd_chat(ProfWin *window, gchar **args, const char * const command)
+cmd_chat(ProfWin *window, const char * const command, gchar **args)
{
_update_presence(RESOURCE_CHAT, "chat", args);
return TRUE;
}
gboolean
-cmd_xa(ProfWin *window, gchar **args, const char * const command)
+cmd_xa(ProfWin *window, const char * const command, gchar **args)
{
_update_presence(RESOURCE_XA, "xa", args);
return TRUE;
}
gboolean
-cmd_pgp(ProfWin *window, gchar **args, const char * const command)
+cmd_pgp(ProfWin *window, const char * const command, gchar **args)
{
#ifdef HAVE_LIBGPGME
if (args[0] == NULL) {
@@ -4380,7 +4380,7 @@ cmd_pgp(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_otr(ProfWin *window, gchar **args, const char * const command)
+cmd_otr(ProfWin *window, const char * const command, gchar **args)
{
#ifdef HAVE_LIBOTR
if (args[0] == NULL) {
@@ -4688,7 +4688,7 @@ cmd_otr(ProfWin *window, gchar **args, const char * const command)
}
gboolean
-cmd_encwarn(ProfWin *window, gchar **args, const char * const command)
+cmd_encwarn(ProfWin *window, const char * const command, gchar **args)
{
return _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN);
}
diff --git a/src/command/commands.h b/src/command/commands.h
index 70d5d5e0..46061a7d 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -57,7 +57,7 @@ typedef struct cmd_help_t {
*/
typedef struct cmd_t {
gchar *cmd;
- gboolean (*func)(ProfWin *window, gchar **args, const char * const command);
+ gboolean (*func)(ProfWin *window, const char * const command, gchar **args);
gchar** (*parser)(const char * const inp, int min, int max, gboolean *result);
int min_args;
int max_args;
@@ -68,85 +68,85 @@ typedef struct cmd_t {
gboolean cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran);
gboolean cmd_execute_default(ProfWin *window, const char * inp);
-gboolean cmd_about(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_account(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_autoaway(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_autoconnect(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_autoping(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_away(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_beep(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_caps(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_chat(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_chlog(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_clear(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_close(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_connect(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_decline(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_disco(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_disconnect(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_dnd(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_flash(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_gone(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_grlog(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_group(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_help(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_history(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_carbons(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_receipts(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_info(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_intype(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_invite(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_invites(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_join(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_leave(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_log(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_msg(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_nick(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_notify(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_online(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_otr(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_pgp(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_outtype(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_prefs(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_priority(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_quit(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_reconnect(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_room(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_rooms(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_bookmark(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_roster(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_software(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_splash(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_states(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_status(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_statuses(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_sub(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_theme(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_tiny(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_titlebar(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_vercheck(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_who(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_win(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_wins(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_winstidy(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_xa(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_alias(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_ping(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_form(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_occupants(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_kick(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_ban(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_subject(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_affiliation(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_role(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_privileges(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_presence(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_wrap(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_time(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_resource(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_inpblock(ProfWin *window, gchar **args, const char * const command);
-gboolean cmd_encwarn(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_about(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_account(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_autoaway(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_autoconnect(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_autoping(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_away(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_beep(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_caps(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_chat(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_chlog(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_clear(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_close(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_connect(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_decline(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_disco(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_disconnect(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_dnd(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_flash(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_gone(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_grlog(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_group(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_help(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_history(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_carbons(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_receipts(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_info(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_intype(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_invite(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_invites(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_join(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_leave(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_log(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_msg(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_nick(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_notify(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_online(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_otr(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_pgp(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_outtype(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_prefs(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_priority(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_quit(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_reconnect(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_room(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_rooms(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_bookmark(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_roster(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_software(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_splash(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_states(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_status(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_statuses(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_sub(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_theme(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_tiny(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_titlebar(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_vercheck(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_who(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_win(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_wins(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_winstidy(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_xa(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_alias(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_ping(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_form(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_occupants(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_kick(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_ban(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_subject(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_affiliation(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_role(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_privileges(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_presence(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_wrap(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_time(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_resource(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_inpblock(ProfWin *window, const char * const command, gchar **args);
+gboolean cmd_encwarn(ProfWin *window, const char * const command, gchar **args);
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
From bd32f4dc472b181fdd78c12228313debaaf593d6 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 03:01:14 +0100
Subject: [PATCH 15/25] Show command header in help output
---
src/ui/console.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/ui/console.c b/src/ui/console.c
index 027f9e73..a688d5f2 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -110,6 +110,14 @@ cons_show_help(Command *command)
{
ProfWin *console = wins_get_console();
+ cons_show("");
+ win_vprint(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "%s", &command->cmd[1]);
+ win_print(console, '-', NULL, NO_EOL, THEME_WHITE_BOLD, "", "");
+ int i;
+ for (i = 0; i < strlen(command->cmd) - 1 ; i++) {
+ win_print(console, '-', NULL, NO_EOL | NO_DATE, THEME_WHITE_BOLD, "", "-");
+ }
+ win_print(console, '-', NULL, NO_DATE, THEME_WHITE_BOLD, "", "");
cons_show("");
win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Synopsis");
@@ -119,7 +127,6 @@ cons_show_help(Command *command)
win_print(console, '-', NULL, 0, THEME_WHITE_BOLD, "", "Description");
win_println(console, command->help.desc);
- int i;
int maxlen = 0;
for (i = 0; command->help.args[i][0] != NULL; i++) {
if (strlen(command->help.args[i][0]) > maxlen)
From 6986a02ff322af234c21c023b7d91e4d79a8a229 Mon Sep 17 00:00:00 2001
From: James Booth
Date: Sun, 26 Jul 2015 19:39:12 +0100
Subject: [PATCH 16/25] Added command definition macros
---
src/command/command.c | 558 +++++++++++++++++-------------------------
1 file changed, 229 insertions(+), 329 deletions(-)
diff --git a/src/command/command.c b/src/command/command.c
index 3c8387dc..df6e9f83 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -104,117 +104,100 @@ static char * _receipts_autocomplete(ProfWin *window, const char * const input);
GHashTable *commands = NULL;
+#define CMD_SYN(...) { { __VA_ARGS__, NULL },
+#define CMD_DESC(desc) desc,
+#define CMD_NOARGS() { { NULL, NULL } },
+#define CMD_ARGS(...) { __VA_ARGS__, { NULL, NULL } },
+#define CMD_NOEXAMPLES() { NULL } }
+#define CMD_EXAMPLES(...) { __VA_ARGS__, NULL } }
+
#define END_ARGS { NULL, NULL }
-
-
/*
* Command list
*/
static struct cmd_t command_defs[] =
{
- // NEW STYLE
{ "/help",
cmd_help, parse_args, 0, 1, NULL,
- {
- {
- "/help [ |]",
- NULL
- },
- "Help on using Profanity. Passing no arguments list help areas.",
- {
+ CMD_SYN(
+ "/help [ |]")
+ CMD_DESC(
+ "Help on using Profanity. Passing no arguments list help areas.")
+ CMD_ARGS(
{ " ", "Summary help for commands in a certain area of functionality." },
- { "", "Full help for a specific command, for example '/help connect'." },
- END_ARGS },
- {
+ { "", "Full help for a specific command, for example '/help connect'." })
+ CMD_EXAMPLES(
"/help commands",
"/help presence",
- "/help who",
- NULL } }
- },
+ "/help who")
+ },
{ "/about",
cmd_about, parse_args, 0, 0, NULL,
- {
- {
- "/about",
- NULL
- },
- "Show version and license information.",
- {
- END_ARGS },
- {
- NULL } }
- },
+ CMD_SYN(
+ "/about")
+ CMD_DESC(
+ "Show version and license information.")
+ CMD_NOARGS()
+ CMD_NOEXAMPLES()
+ },
{ "/connect",
cmd_connect, parse_args, 0, 5, NULL,
- {
- {
+ CMD_SYN(
"/connect []",
- "/connect [server ] [port ]",
- NULL
- },
+ "/connect [server ] [port ]")
+ CMD_DESC(
"Login to a chat service. "
"If no account is specified, the default is used if one is configured. "
- "A local account is created with the JID as it's name if it doesn't already exist.",
- {
+ "A local account is created with the JID as it's name if it doesn't already exist.")
+ CMD_ARGS(
{ "", "The local account you wish to connect with, or a JID if connecting for the first time." },
{ "server ", "Supply a server if it is different to the domain part of your JID." },
- { "port ", "The port to use if different to the default (5222, or 5223 for SSL)." },
- END_ARGS },
- {
+ { "port ", "The port to use if different to the default (5222, or 5223 for SSL)." })
+ CMD_EXAMPLES(
"/connect",
"/connect myuser@gmail.com",
"/connect myuser@mycompany.com server talk.google.com",
"/connect bob@someplace port 5678",
- "/connect me@chatty server chatty.com port 5443",
- NULL } }
+ "/connect me@chatty server chatty.com port 5443")
},
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
- {
- {
- "/disconnect",
- NULL
- },
- "Disconnect from the current chat service.",
- {
- END_ARGS },
- {
- NULL } }
- },
+ CMD_SYN(
+ "/disconnect")
+ CMD_DESC(
+ "Disconnect from the current chat service.")
+ CMD_NOARGS()
+ CMD_NOEXAMPLES()
+ },
{ "/msg",
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
- {
- {
+ CMD_SYN(
"/msg []",
- "/msg