This commit is contained in:
irungentoo 2013-08-14 08:35:43 -04:00
commit 9fb82fc3bf

View File

@ -52,28 +52,15 @@ uint8_t num_requests = 0;
void get_id(Messenger *m, char *data) void get_id(Messenger *m, char *data)
{ {
char idstring0[200]; sprintf(data, "[i] ID: ");
char idstring1[FRIEND_ADDRESS_SIZE][5]; int offset = strlen(data);
char idstring2[FRIEND_ADDRESS_SIZE][5];
int i = 0; int i = 0;
uint8_t address[FRIEND_ADDRESS_SIZE]; uint8_t address[FRIEND_ADDRESS_SIZE];
getaddress(m, address); getaddress(m, address);
for(i = 0; i < FRIEND_ADDRESS_SIZE; i++) for(; i < FRIEND_ADDRESS_SIZE; i++)
{ {
if (address[i] < (FRIEND_ADDRESS_SIZE / 2)) sprintf(data + 2*i + offset, "%02X ", address[i]);
strcpy(idstring1[i],"0");
else
strcpy(idstring1[i], "");
sprintf(idstring2[i], "%hhX",address[i]);
} }
strcpy(idstring0,"[i] ID: ");
int j = 0;
for (j = 0; j < FRIEND_ADDRESS_SIZE; j++) {
strcat(idstring0,idstring1[j]);
strcat(idstring0,idstring2[j]);
}
memcpy(data, idstring0, strlen(idstring0));
} }
void new_lines(char *line) void new_lines(char *line)