From f93e23e4113aada569c49e3554fbd35556ff5ac1 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 13 Aug 2013 11:50:33 -0400 Subject: [PATCH] Updated some files. --- testing/Messenger_test.c | 10 ++++++---- 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[]) printf("OUR ID: "); uint32_t i; - for(i = 0; i < 32; i++) { - if(self_public_key[i] < 16) + uint8_t address[FRIEND_ADDRESS_SIZE]; + getaddress(m, address); + for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) { + if(address[i] < 16) printf("0"); - printf("%hhX",self_public_key[i]); + printf("%hhX",address[i]); } setname(m, (uint8_t *)"Anon", 5); char temp_id[128]; - printf("\nEnter the client_id of the friend you wish to add (32 bytes HEX format):\n"); + printf("\nEnter the address of the friend you wish to add (38 bytes HEX format):\n"); if(scanf("%s", temp_id) != 1) { return 1; } 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 { Friend_request pending_requests[256]; uint8_t num_requests = 0; -void get_id(char *data) +void get_id(Messenger *m, char *data) { char idstring0[200]; - char idstring1[PUB_KEY_BYTES][5]; - char idstring2[PUB_KEY_BYTES][5]; + char idstring1[FRIEND_ADDRESS_SIZE][5]; + char idstring2[FRIEND_ADDRESS_SIZE][5]; int i = 0; - for(i = 0; i < PUB_KEY_BYTES; i++) + uint8_t address[FRIEND_ADDRESS_SIZE]; + getaddress(m, address); + for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) { - if (self_public_key[i] < (PUB_KEY_BYTES / 2)) + if (address[i] < (FRIEND_ADDRESS_SIZE / 2)) strcpy(idstring1[i],"0"); else strcpy(idstring1[i], ""); - sprintf(idstring2[i], "%hhX",self_public_key[i]); + sprintf(idstring2[i], "%hhX",address[i]); } strcpy(idstring0,"[i] ID: "); int j = 0; - for (j = 0; j < PUB_KEY_BYTES; j++) { + for (j = 0; j < FRIEND_ADDRESS_SIZE; j++) { strcat(idstring0,idstring1[j]); strcat(idstring0,idstring2[j]); } @@ -259,7 +261,7 @@ void line_eval(Messenger *m, char *line) } else if (inpt_command == 'i') { //info char idstring[200]; - get_id(idstring); + get_id(m, idstring); new_lines(idstring); } @@ -478,7 +480,7 @@ int main(int argc, char *argv[]) getmaxyx(stdscr, y, x); new_lines("/h for list of commands"); - get_id(idstring); + get_id(m, idstring); new_lines(idstring); strcpy(line, "");