mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cleaned up print_friendlist(), it now prints a message if you have _no_ friends
This commit is contained in:
parent
e029b65ece
commit
3678b302db
@ -82,18 +82,22 @@ void new_lines(char *line)
|
|||||||
void print_friendlist()
|
void print_friendlist()
|
||||||
{
|
{
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
|
int i = 0;
|
||||||
new_lines("[i] Friend List:");
|
new_lines("[i] Friend List:");
|
||||||
uint32_t i;
|
while(getname(i++, (uint8_t *)name) != -1) {
|
||||||
for (i = 0; i <= num_requests; i++) {
|
/* account for the longest name and the longest "base" string */
|
||||||
char fstring[128];
|
char fstring[MAX_NAME_LENGTH + strlen("[i] Friend: NULL\n\tid: ")];
|
||||||
getname(i, (uint8_t*)name);
|
|
||||||
if (strlen(name) <= 0) {
|
if (strlen(name) <= 0) {
|
||||||
sprintf(fstring, "[i] Friend: NULL\n\tid: %i", i);
|
sprintf(fstring, "[i] Friend: No Friend!\n\tid: %i", i);
|
||||||
} else {
|
} else {
|
||||||
sprintf(fstring, "[i] Friend: %s\n\tid: %i", (uint8_t*)name, i);
|
sprintf(fstring, "[i] Friend: %s\n\tid: %i", (uint8_t*)name, i);
|
||||||
}
|
}
|
||||||
new_lines(fstring);
|
new_lines(fstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(i == 1)
|
||||||
|
new_lines("\tno friends! D:");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *format_message(char *message, int friendnum)
|
char *format_message(char *message, int friendnum)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user