summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-14 08:35:43 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-14 08:35:43 -0400
commit9fb82fc3bf5f360821c8649539a43bb258b95e8f (patch)
tree8ca0854a1006a5140abe4d2bfd9714edeb589aa4
parenteeafe23f2e1dc986d9b1a989fb68cf2768573751 (diff)
parent72ee99e84838e3b0c74e3d66defdcc3ab7f4f6f9 (diff)
Merge branch 'master' of https://github.com/naxuroqa/ProjectTox-Core into pr
-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)