From 9a885ed2bace643b6c44f13c14be0cc3f12dafbf Mon Sep 17 00:00:00 2001 From: jfreegman Date: Thu, 11 Nov 2021 10:05:52 -0500 Subject: [PATCH] Remove redundant command /mykey You can get your own key with the /whois command --- src/execute.c | 1 - src/groupchat_commands.c | 23 ----------------------- src/groupchat_commands.h | 1 - src/groupchats.c | 1 - src/help.c | 3 +-- 5 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/execute.c b/src/execute.c index 134209b..d4b1e6b 100644 --- a/src/execute.c +++ b/src/execute.c @@ -127,7 +127,6 @@ static struct cmd_func groupchat_commands[] = { { "/ignore", cmd_ignore }, { "/kick", cmd_kick }, { "/mod", cmd_mod }, - { "/mykey", cmd_mykey }, { "/passwd", cmd_set_passwd }, { "/peerlimit", cmd_set_peerlimit }, { "/privacy", cmd_set_privacy }, diff --git a/src/groupchat_commands.c b/src/groupchat_commands.c index 110da12..5e66d63 100644 --- a/src/groupchat_commands.c +++ b/src/groupchat_commands.c @@ -271,29 +271,6 @@ void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M } } -void cmd_mykey(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) -{ - char pk_string[TOX_GROUP_PEER_PUBLIC_KEY_SIZE * 2 + 1] = {0}; - char pk[TOX_GROUP_PEER_PUBLIC_KEY_SIZE]; - - TOX_ERR_GROUP_SELF_QUERY err; - - if (!tox_group_self_get_public_key(m, self->num, (uint8_t *) pk, &err)) { - line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to fetch your public key (error %d)", err); - return; - } - - size_t i; - - for (i = 0; i < TOX_GROUP_PEER_PUBLIC_KEY_SIZE; ++i) { - char d[3]; - snprintf(d, sizeof(d), "%02X", pk[i] & 0xff); - strcat(pk_string, d); - } - - line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "%s", pk_string); -} - void cmd_set_passwd(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) { const char *passwd = NULL; diff --git a/src/groupchat_commands.h b/src/groupchat_commands.h index c1d2e09..fd97dbd 100644 --- a/src/groupchat_commands.h +++ b/src/groupchat_commands.h @@ -31,7 +31,6 @@ void cmd_disconnect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); -void cmd_mykey(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_prune(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_set_passwd(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]); diff --git a/src/groupchats.c b/src/groupchats.c index a9773d2..ec6b3d1 100644 --- a/src/groupchats.c +++ b/src/groupchats.c @@ -91,7 +91,6 @@ static const char *group_cmd_list[] = { "/log", "/mod", "/myid", - "/mykey", #ifdef QRCODE "/myqr", #endif /* QRCODE */ diff --git a/src/help.c b/src/help.c index be6403f..d5a6529 100644 --- a/src/help.c +++ b/src/help.c @@ -302,7 +302,6 @@ static void help_draw_groupchats(ToxWindow *self) wprintw(win, " /unignore : Unignore an ignored peer\n"); wprintw(win, " /kick : Remove a peer from the group\n"); wprintw(win, " /mod : Promote a peer to moderator\n"); - wprintw(win, " /mykey : Print your groupchat ID\n"); wprintw(win, " /passwd : Set a password needed to join the group\n"); wprintw(win, " /peerlimit : Set the maximum number of peers that can join\n"); wprintw(win, " /privacy : Set the group privacy state: private | public\n"); @@ -488,7 +487,7 @@ void help_onKey(ToxWindow *self, wint_t key) break; case L'r': - help_init_window(self, 24, 80); + help_init_window(self, 23, 80); self->help->type = HELP_GROUP; break; }