diff --git a/src/chat.c b/src/chat.c index 97ab127..1d2a419 100644 --- a/src/chat.c +++ b/src/chat.c @@ -63,9 +63,9 @@ static void kill_infobox(ToxWindow *self); #endif /* AUDIO */ #ifdef AUDIO -#define AC_NUM_CHAT_COMMANDS 27 +#define AC_NUM_CHAT_COMMANDS 28 #else -#define AC_NUM_CHAT_COMMANDS 20 +#define AC_NUM_CHAT_COMMANDS 21 #endif /* AUDIO */ /* Array of chat command names used for tab completion. */ @@ -86,6 +86,7 @@ static const char chat_cmd_list[AC_NUM_CHAT_COMMANDS][MAX_CMDNAME_SIZE] = { { "/myid" }, { "/nick" }, { "/note" }, + { "/nospam" }, { "/quit" }, { "/savefile" }, { "/sendfile" }, diff --git a/src/execute.c b/src/execute.c index 9e83a83..aedd5bc 100644 --- a/src/execute.c +++ b/src/execute.c @@ -53,6 +53,7 @@ static struct cmd_func global_commands[] = { { "/myid", cmd_myid }, { "/nick", cmd_nick }, { "/note", cmd_note }, + { "/nospam", cmd_nospam }, { "/q", cmd_quit }, { "/quit", cmd_quit }, { "/requests", cmd_requests }, diff --git a/src/global_commands.c b/src/global_commands.c index 1ce3b21..8f67b34 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -484,6 +484,15 @@ void cmd_note(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA prompt_update_statusmessage(prompt, m, msg); } +void cmd_nospam(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) +{ + uint32_t nospam = rand(); /* should be random enough */ + tox_self_set_nospam(m, nospam); + line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Your Tox ID has been changed to:"); + cmd_myid(window, self, m, 0, NULL); + line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Any services that relied on your old ID will need to be updated manually."); +} + void cmd_prompt_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) { help_init_menu(self); diff --git a/src/global_commands.h b/src/global_commands.h index 277f0f1..85dccaa 100644 --- a/src/global_commands.h +++ b/src/global_commands.h @@ -37,6 +37,7 @@ void cmd_log(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_myid(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_nick(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_note(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); +void cmd_nospam(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_prompt_help(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_quit(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_requests(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); diff --git a/src/groupchat.c b/src/groupchat.c index ce568d8..7d80b57 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -70,9 +70,9 @@ extern struct user_settings *user_settings; extern struct Winthread Winthread; #ifdef AUDIO -#define AC_NUM_GROUP_COMMANDS 22 +#define AC_NUM_GROUP_COMMANDS 23 #else -#define AC_NUM_GROUP_COMMANDS 18 +#define AC_NUM_GROUP_COMMANDS 19 #endif /* AUDIO */ /* Array of groupchat command names used for tab completion. */ @@ -91,6 +91,7 @@ static const char group_cmd_list[AC_NUM_GROUP_COMMANDS][MAX_CMDNAME_SIZE] = { { "/myid" }, { "/nick" }, { "/note" }, + { "/nospam" }, { "/quit" }, { "/requests" }, { "/status" }, diff --git a/src/help.c b/src/help.c index 8989c11..87eb76d 100644 --- a/src/help.c +++ b/src/help.c @@ -151,6 +151,7 @@ static void help_draw_global(ToxWindow *self) wprintw(win, " /status : Set status with optional note\n"); wprintw(win, " /note : Set a personal note\n"); wprintw(win, " /nick : Set your nickname\n"); + wprintw(win, " /nospam : Change part of your Tox ID to stop spam\n"); wprintw(win, " /log or : Enable/disable logging\n"); wprintw(win, " /group : Create a group chat where type: text | audio\n"); wprintw(win, " /myid : Print your Tox ID\n"); @@ -292,9 +293,9 @@ void help_onKey(ToxWindow *self, wint_t key) case 'g': #ifdef AUDIO - help_init_window(self, 24, 80); + help_init_window(self, 25, 80); #else - help_init_window(self, 20, 80); + help_init_window(self, 21, 80); #endif self->help->type = HELP_GLOBAL; break; diff --git a/src/prompt.c b/src/prompt.c index 872481b..eb91169 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -51,9 +51,9 @@ extern FriendsList Friends; FriendRequests FrndRequests; #ifdef AUDIO -#define AC_NUM_GLOB_COMMANDS 18 +#define AC_NUM_GLOB_COMMANDS 19 #else -#define AC_NUM_GLOB_COMMANDS 16 +#define AC_NUM_GLOB_COMMANDS 17 #endif /* AUDIO */ /* Array of global command names used for tab completion. */ @@ -71,6 +71,7 @@ static const char glob_cmd_list[AC_NUM_GLOB_COMMANDS][MAX_CMDNAME_SIZE] = { { "/myid" }, { "/nick" }, { "/note" }, + { "/nospam" }, { "/quit" }, { "/requests" }, { "/status" },