From e920be4c01c3cb5493aab71268b763bea77e5104 Mon Sep 17 00:00:00 2001 From: Astonex Date: Tue, 30 Jul 2013 09:21:22 +0100 Subject: [PATCH] Fixed the friends listing --- core/Messenger.c | 6 ++++++ testing/nTox_win32.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/Messenger.c b/core/Messenger.c index f77b4491..4c76dd30 100644 --- a/core/Messenger.c +++ b/core/Messenger.c @@ -71,6 +71,12 @@ int getfriend_id(uint8_t *client_id) return -1; } +/* Returns number of friends */ +int getnumfriends() +{ + return numfriends; +} + /* copies the public key associated to that friend id into client_id buffer. make sure that client_id is of size CLIENT_ID_SIZE. return 0 if success diff --git a/testing/nTox_win32.c b/testing/nTox_win32.c index 6faae31d..9e9a5b1a 100644 --- a/testing/nTox_win32.c +++ b/testing/nTox_win32.c @@ -137,11 +137,11 @@ void line_eval(char* line) } else if (line[1] == 'l') { - printf("\n[i] Friend List\n\n"); + printf("\n[i] Friend List - %d\n\n", getnumfriends()); int i; - for (i=0; i <= num_requests; i++) { + for (i=0; i < getnumfriends(); i++) { char name[MAX_NAME_LENGTH]; getname(i, (uint8_t*)name); printf("[%d] %s\n\n", i, (uint8_t*)name);