summaryrefslogtreecommitdiff
path: root/testing/toxic/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r--testing/toxic/prompt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index 67f80fef..e1a7d75c 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -93,7 +93,7 @@ void cmd_accept(ToxWindow *self, Messenger *m, char **args)
93 93
94void cmd_add(ToxWindow *self, Messenger *m, char **args) 94void cmd_add(ToxWindow *self, Messenger *m, char **args)
95{ 95{
96 uint8_t id_bin[KEY_SIZE_BYTES]; 96 uint8_t id_bin[FRIEND_ADDRESS_SIZE];
97 char xx[3]; 97 char xx[3];
98 uint32_t x; 98 uint32_t x;
99 char *id = args[1]; 99 char *id = args[1];
@@ -106,12 +106,12 @@ void cmd_add(ToxWindow *self, Messenger *m, char **args)
106 if (!msg) 106 if (!msg)
107 msg = ""; 107 msg = "";
108 108
109 if (strlen(id) != 2*KEY_SIZE_BYTES) { 109 if (strlen(id) != 2*FRIEND_ADDRESS_SIZE) {
110 wprintw(self->window, "Invalid ID length.\n"); 110 wprintw(self->window, "Invalid ID length.\n");
111 return; 111 return;
112 } 112 }
113 int i; 113 int i;
114 for (i = 0; i < KEY_SIZE_BYTES; ++i) { 114 for (i = 0; i < FRIEND_ADDRESS_SIZE; ++i) {
115 xx[0] = id[2*i]; 115 xx[0] = id[2*i];
116 xx[1] = id[2*i+1]; 116 xx[1] = id[2*i+1];
117 xx[2] = '\0'; 117 xx[2] = '\0';
@@ -217,11 +217,13 @@ void cmd_msg(ToxWindow *self, Messenger *m, char **args)
217 217
218void cmd_myid(ToxWindow *self, Messenger *m, char **args) 218void cmd_myid(ToxWindow *self, Messenger *m, char **args)
219{ 219{
220 char id[KEY_SIZE_BYTES*2 + 1] = {0}; 220 char id[FRIEND_ADDRESS_SIZE*2 + 1] = {0};
221 size_t i; 221 size_t i;
222 for (i = 0; i < KEY_SIZE_BYTES; ++i) { 222 uint8_t address[FRIEND_ADDRESS_SIZE];
223 getaddress(m, address);
224 for (i = 0; i < FRIEND_ADDRESS_SIZE; ++i) {
223 char xx[3]; 225 char xx[3];
224 snprintf(xx, sizeof(xx), "%02x", self_public_key[i] & 0xff); 226 snprintf(xx, sizeof(xx), "%02X", address[i] & 0xff);
225 strcat(id, xx); 227 strcat(id, xx);
226 } 228 }
227 wprintw(self->window, "Your ID: %s\n", id); 229 wprintw(self->window, "Your ID: %s\n", id);