diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Messenger_test.c | 10 | ||||
-rw-r--r-- | testing/nTox.c | 20 |
2 files changed, 17 insertions, 13 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index fa5d6890..2e2bedc3 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -119,16 +119,18 @@ int main(int argc, char *argv[]) | |||
119 | 119 | ||
120 | printf("OUR ID: "); | 120 | printf("OUR ID: "); |
121 | uint32_t i; | 121 | uint32_t i; |
122 | for(i = 0; i < 32; i++) { | 122 | uint8_t address[FRIEND_ADDRESS_SIZE]; |
123 | if(self_public_key[i] < 16) | 123 | getaddress(m, address); |
124 | for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) { | ||
125 | if(address[i] < 16) | ||
124 | printf("0"); | 126 | printf("0"); |
125 | printf("%hhX",self_public_key[i]); | 127 | printf("%hhX",address[i]); |
126 | } | 128 | } |
127 | 129 | ||
128 | setname(m, (uint8_t *)"Anon", 5); | 130 | setname(m, (uint8_t *)"Anon", 5); |
129 | 131 | ||
130 | char temp_id[128]; | 132 | char temp_id[128]; |
131 | printf("\nEnter the client_id of the friend you wish to add (32 bytes HEX format):\n"); | 133 | printf("\nEnter the address of the friend you wish to add (38 bytes HEX format):\n"); |
132 | if(scanf("%s", temp_id) != 1) { | 134 | if(scanf("%s", temp_id) != 1) { |
133 | return 1; | 135 | return 1; |
134 | } | 136 | } |
diff --git a/testing/nTox.c b/testing/nTox.c index 74db2ae2..cab2d158 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -50,23 +50,25 @@ typedef struct { | |||
50 | Friend_request pending_requests[256]; | 50 | Friend_request pending_requests[256]; |
51 | uint8_t num_requests = 0; | 51 | uint8_t num_requests = 0; |
52 | 52 | ||
53 | void get_id(char *data) | 53 | void get_id(Messenger *m, char *data) |
54 | { | 54 | { |
55 | char idstring0[200]; | 55 | char idstring0[200]; |
56 | char idstring1[PUB_KEY_BYTES][5]; | 56 | char idstring1[FRIEND_ADDRESS_SIZE][5]; |
57 | char idstring2[PUB_KEY_BYTES][5]; | 57 | char idstring2[FRIEND_ADDRESS_SIZE][5]; |
58 | int i = 0; | 58 | int i = 0; |
59 | for(i = 0; i < PUB_KEY_BYTES; i++) | 59 | uint8_t address[FRIEND_ADDRESS_SIZE]; |
60 | getaddress(m, address); | ||
61 | for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) | ||
60 | { | 62 | { |
61 | if (self_public_key[i] < (PUB_KEY_BYTES / 2)) | 63 | if (address[i] < (FRIEND_ADDRESS_SIZE / 2)) |
62 | strcpy(idstring1[i],"0"); | 64 | strcpy(idstring1[i],"0"); |
63 | else | 65 | else |
64 | strcpy(idstring1[i], ""); | 66 | strcpy(idstring1[i], ""); |
65 | sprintf(idstring2[i], "%hhX",self_public_key[i]); | 67 | sprintf(idstring2[i], "%hhX",address[i]); |
66 | } | 68 | } |
67 | strcpy(idstring0,"[i] ID: "); | 69 | strcpy(idstring0,"[i] ID: "); |
68 | int j = 0; | 70 | int j = 0; |
69 | for (j = 0; j < PUB_KEY_BYTES; j++) { | 71 | for (j = 0; j < FRIEND_ADDRESS_SIZE; j++) { |
70 | strcat(idstring0,idstring1[j]); | 72 | strcat(idstring0,idstring1[j]); |
71 | strcat(idstring0,idstring2[j]); | 73 | strcat(idstring0,idstring2[j]); |
72 | } | 74 | } |
@@ -259,7 +261,7 @@ void line_eval(Messenger *m, char *line) | |||
259 | } | 261 | } |
260 | else if (inpt_command == 'i') { //info | 262 | else if (inpt_command == 'i') { //info |
261 | char idstring[200]; | 263 | char idstring[200]; |
262 | get_id(idstring); | 264 | get_id(m, idstring); |
263 | new_lines(idstring); | 265 | new_lines(idstring); |
264 | } | 266 | } |
265 | 267 | ||
@@ -478,7 +480,7 @@ int main(int argc, char *argv[]) | |||
478 | getmaxyx(stdscr, y, x); | 480 | getmaxyx(stdscr, y, x); |
479 | 481 | ||
480 | new_lines("/h for list of commands"); | 482 | new_lines("/h for list of commands"); |
481 | get_id(idstring); | 483 | get_id(m, idstring); |
482 | new_lines(idstring); | 484 | new_lines(idstring); |
483 | strcpy(line, ""); | 485 | strcpy(line, ""); |
484 | 486 | ||