summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/nTox.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index cab2d158..ead4fd21 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -52,28 +52,15 @@ uint8_t num_requests = 0;
52 52
53void get_id(Messenger *m, char *data) 53void get_id(Messenger *m, char *data)
54{ 54{
55 char idstring0[200]; 55 sprintf(data, "[i] ID: ");
56 char idstring1[FRIEND_ADDRESS_SIZE][5]; 56 int offset = strlen(data);
57 char idstring2[FRIEND_ADDRESS_SIZE][5];
58 int i = 0; 57 int i = 0;
59 uint8_t address[FRIEND_ADDRESS_SIZE]; 58 uint8_t address[FRIEND_ADDRESS_SIZE];
60 getaddress(m, address); 59 getaddress(m, address);
61 for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) 60 for(; i < FRIEND_ADDRESS_SIZE; i++)
62 { 61 {
63 if (address[i] < (FRIEND_ADDRESS_SIZE / 2)) 62 sprintf(data + 2*i + offset, "%02X ", address[i]);
64 strcpy(idstring1[i],"0");
65 else
66 strcpy(idstring1[i], "");
67 sprintf(idstring2[i], "%hhX",address[i]);
68 } 63 }
69 strcpy(idstring0,"[i] ID: ");
70 int j = 0;
71 for (j = 0; j < FRIEND_ADDRESS_SIZE; j++) {
72 strcat(idstring0,idstring1[j]);
73 strcat(idstring0,idstring2[j]);
74 }
75
76 memcpy(data, idstring0, strlen(idstring0));
77} 64}
78 65
79void new_lines(char *line) 66void new_lines(char *line)