1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 15:43:02 +01:00

Add command to change the Tox ID nospam value

This commit is contained in:
Jfreegman 2015-10-22 19:44:05 -04:00
parent cea5f1fe04
commit 6b97df2615
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
7 changed files with 23 additions and 8 deletions

View File

@ -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" },

View File

@ -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 },

View File

@ -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);

View File

@ -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]);

View File

@ -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" },

View File

@ -151,6 +151,7 @@ static void help_draw_global(ToxWindow *self)
wprintw(win, " /status <type> <msg> : Set status with optional note\n");
wprintw(win, " /note <msg> : Set a personal note\n");
wprintw(win, " /nick <nick> : Set your nickname\n");
wprintw(win, " /nospam : Change part of your Tox ID to stop spam\n");
wprintw(win, " /log <on> or <off> : Enable/disable logging\n");
wprintw(win, " /group <type> : 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;

View File

@ -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" },