Fixed the friends listing

This commit is contained in:
Astonex 2013-07-30 09:21:22 +01:00
parent 84a0871cf6
commit e920be4c01
2 changed files with 8 additions and 2 deletions

View File

@ -71,6 +71,12 @@ int getfriend_id(uint8_t *client_id)
return -1; return -1;
} }
/* Returns number of friends */
int getnumfriends()
{
return numfriends;
}
/* copies the public key associated to that friend id into client_id buffer. /* copies the public key associated to that friend id into client_id buffer.
make sure that client_id is of size CLIENT_ID_SIZE. make sure that client_id is of size CLIENT_ID_SIZE.
return 0 if success return 0 if success

View File

@ -137,11 +137,11 @@ void line_eval(char* line)
} }
else if (line[1] == 'l') { else if (line[1] == 'l') {
printf("\n[i] Friend List\n\n"); printf("\n[i] Friend List - %d\n\n", getnumfriends());
int i; int i;
for (i=0; i <= num_requests; i++) { for (i=0; i < getnumfriends(); i++) {
char name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
getname(i, (uint8_t*)name); getname(i, (uint8_t*)name);
printf("[%d] %s\n\n", i, (uint8_t*)name); printf("[%d] %s\n\n", i, (uint8_t*)name);