mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Updated some files.
This commit is contained in:
parent
97f449a2f1
commit
f93e23e411
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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, "");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user