1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-24 17:23:25 +01:00

update help messages

This commit is contained in:
Jfreegman 2014-02-26 19:45:11 -05:00
parent 459eb64dc4
commit d83ef1d8be
3 changed files with 29 additions and 19 deletions

View File

@ -30,6 +30,7 @@
#include "toxic_windows.h" #include "toxic_windows.h"
#include "misc_tools.h" #include "misc_tools.h"
#include "friendlist.h" #include "friendlist.h"
#include "execute.h"
extern ToxWindow *prompt; extern ToxWindow *prompt;
@ -40,23 +41,25 @@ extern uint8_t max_file_senders_index;
void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
if (argc == 1) {
if (!strcmp(argv[1], "global")) {
execute(window, self, m, "/help", GLOBAL_COMMAND_MODE);
return;
}
}
wattron(window, COLOR_PAIR(CYAN) | A_BOLD); wattron(window, COLOR_PAIR(CYAN) | A_BOLD);
wprintw(window, "Chat commands:\n"); wprintw(window, "Chat commands:\n");
wattroff(window, COLOR_PAIR(CYAN) | A_BOLD); wattroff(window, COLOR_PAIR(CYAN) | A_BOLD);
wprintw(window, " /status <type> <msg> : Set your status with optional note\n");
wprintw(window, " /note <msg> : Set a personal note\n");
wprintw(window, " /nick <nick> : Set your nickname\n");
wprintw(window, " /invite <n> : Invite friend to a group chat\n"); wprintw(window, " /invite <n> : Invite friend to a group chat\n");
wprintw(window, " /me <action> : Do an action\n");
wprintw(window, " /myid : Print your ID\n");
wprintw(window, " /join : Join a pending group chat\n"); wprintw(window, " /join : Join a pending group chat\n");
wprintw(window, " /clear : Clear the screen\n"); wprintw(window, " /log <bool> : Enable/disable logging\n");
wprintw(window, " /close : Close the current chat window\n"); wprintw(window, " /close : Close the current chat window\n");
wprintw(window, " /sendfile <filepath> : Send a file\n"); wprintw(window, " /sendfile <filepath> : Send a file\n");
wprintw(window, " /savefile <n> : Receive a file\n"); wprintw(window, " /savefile <n> : Receive a file\n");
wprintw(window, " /quit or /exit : Exit Toxic\n");
wprintw(window, " /help : Print this message again\n"); wprintw(window, " /help : Print this message again\n");
wprintw(window, " /help global : Show a list of global commands\n");
wattron(window, COLOR_PAIR(CYAN) | A_BOLD); wattron(window, COLOR_PAIR(CYAN) | A_BOLD);
wprintw(window, " * Argument messages must be enclosed in quotation marks.\n\n"); wprintw(window, " * Argument messages must be enclosed in quotation marks.\n\n");

View File

@ -211,7 +211,7 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return; return;
} }
if (init_groupchat_win(prompt, m, groupnum, NULL) == -1) { if (init_groupchat_win(prompt, m, groupnum) == -1) {
wprintw(window, "Group chat window failed to initialize.\n"); wprintw(window, "Group chat window failed to initialize.\n");
tox_del_groupchat(m, groupnum); tox_del_groupchat(m, groupnum);
return; return;
@ -228,8 +228,11 @@ void cmd_log(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
if (argc == 0) { if (argc == 0) {
uint8_t *s = ctx->log.log_on ? "enabled" : "disabled"; if (ctx->log.log_on)
wprintw(window, "Logging for this chat is currently %s\n", s); wprintw(window, "Logging for this chat is currently enabled. /log 0 to disable.\n");
else
wprintw(window, "Logging for this chat is currently disabled. /log 1 to enable.\n");
return; return;
} }
@ -343,14 +346,14 @@ void cmd_prompt_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
wprintw(window, " /add <id> <msg> : Add friend with optional message\n"); wprintw(window, " /add <id> <msg> : Add friend with optional message\n");
wprintw(window, " /accept <n> : Accept friend request\n"); wprintw(window, " /accept <n> : Accept friend request\n");
wprintw(window, " /connect <ip> <port> <key> : Manually connect to a DHT server\n"); wprintw(window, " /connect <ip> <port> <key> : Manually connect to a DHT server\n");
wprintw(window, " /status <type> <msg> : Set your status with optional note\n"); wprintw(window, " /status <type> <msg> : Set status with optional note\n");
wprintw(window, " /note <msg> : Set a personal note\n"); wprintw(window, " /note <msg> : Set a personal note\n");
wprintw(window, " /nick <nick> : Set your nickname\n"); wprintw(window, " /nick <nick> : Set your nickname\n");
wprintw(window, " /groupchat : Create a group chat\n"); wprintw(window, " /groupchat : Create a group chat\n");
wprintw(window, " /myid : Print your ID\n"); wprintw(window, " /myid : Print your ID\n");
wprintw(window, " /quit or /exit : Exit Toxic\n");
wprintw(window, " /help : Print this message again\n"); wprintw(window, " /help : Print this message again\n");
wprintw(window, " /clear : Clear the window\n"); wprintw(window, " /clear : Clear the window\n");
wprintw(window, " /quit or /exit : Exit Toxic\n");
wattron(window, COLOR_PAIR(CYAN) | A_BOLD); wattron(window, COLOR_PAIR(CYAN) | A_BOLD);
wprintw(window, " * Argument messages must be enclosed in quotation marks.\n"); wprintw(window, " * Argument messages must be enclosed in quotation marks.\n");

View File

@ -136,11 +136,10 @@ static void print_groupchat_help(ChatContext *ctx)
wprintw(ctx->history, " /note <msg> : Set a personal note\n"); wprintw(ctx->history, " /note <msg> : Set a personal note\n");
wprintw(ctx->history, " /nick <nick> : Set your nickname\n"); wprintw(ctx->history, " /nick <nick> : Set your nickname\n");
wprintw(ctx->history, " /groupchat : Create a group chat\n"); wprintw(ctx->history, " /groupchat : Create a group chat\n");
wprintw(ctx->history, " /myid : Print your ID\n"); wprintw(ctx->history, " /log <bool> : Enable/disable logging\n");
wprintw(ctx->history, " /clear : Clear the screen\n");
wprintw(ctx->history, " /close : Close the current group chat\n"); wprintw(ctx->history, " /close : Close the current group chat\n");
wprintw(ctx->history, " /quit or /exit : Exit Toxic\n");
wprintw(ctx->history, " /help : Print this message again\n"); wprintw(ctx->history, " /help : Print this message again\n");
wprintw(ctx->history, " /help global : Show a list of global commands\n");
wattron(ctx->history, COLOR_PAIR(CYAN) | A_BOLD); wattron(ctx->history, COLOR_PAIR(CYAN) | A_BOLD);
wprintw(ctx->history, " * Argument messages must be enclosed in quotation marks.\n"); wprintw(ctx->history, " * Argument messages must be enclosed in quotation marks.\n");
@ -539,12 +538,17 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
if (strcmp(line, "/close") == 0) { if (strcmp(line, "/close") == 0) {
close_groupchat(self, m, self->num); close_groupchat(self, m, self->num);
return; return;
} else if (strcmp(line, "/help") == 0) } else if (strcmp(line, "/help") == 0) {
print_groupchat_help(ctx); if (strcmp(line, "help global") == 0)
else if (strncmp(line, "/me ", strlen("/me ")) == 0) execute(ctx->history, self, m, "/help", GLOBAL_COMMAND_MODE);
send_group_action(self, ctx, m, line + strlen("/me "));
else else
print_groupchat_help(ctx);
} else if (strncmp(line, "/me ", strlen("/me ")) == 0) {
send_group_action(self, ctx, m, line + strlen("/me "));
} else {
execute(ctx->history, self, m, line, GROUPCHAT_COMMAND_MODE); execute(ctx->history, self, m, line, GROUPCHAT_COMMAND_MODE);
}
} else if (!string_is_empty(line)) { } else if (!string_is_empty(line)) {
if (tox_group_message_send(m, self->num, line, strlen(line) + 1) == -1) { if (tox_group_message_send(m, self->num, line, strlen(line) + 1) == -1) {
wattron(ctx->history, COLOR_PAIR(RED)); wattron(ctx->history, COLOR_PAIR(RED));