diff options
Diffstat (limited to 'testing/nTox.c')
-rw-r--r-- | testing/nTox.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index 201f4a54..f00fe200 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -20,10 +20,10 @@ | |||
20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | 20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | |||
24 | #include "nTox.h" | 23 | #include "nTox.h" |
25 | #include "misc_tools.h" | 24 | #include "misc_tools.h" |
26 | 25 | ||
26 | |||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
28 | #include <time.h> | 28 | #include <time.h> |
29 | #ifdef WIN32 | 29 | #ifdef WIN32 |
@@ -50,6 +50,25 @@ void new_lines(char *line) | |||
50 | do_refresh(); | 50 | do_refresh(); |
51 | } | 51 | } |
52 | 52 | ||
53 | void print_friendlist() | ||
54 | { | ||
55 | char name[MAX_NAME_LENGTH]; | ||
56 | uint32_t i; | ||
57 | |||
58 | new_lines("[i] Friend List:"); | ||
59 | for (i=0; i <= num_requests; i++) { | ||
60 | char fstring[128]; | ||
61 | |||
62 | getname(i, (uint8_t*)name); | ||
63 | if (strlen(name) <= 0) { | ||
64 | sprintf(fstring, "[i] Friend: NULL\n\tid: %i", i); | ||
65 | } else { | ||
66 | sprintf(fstring, "[i] Friend: %s\n\tid: %i", (uint8_t*)name, i); | ||
67 | } | ||
68 | new_lines(fstring); | ||
69 | } | ||
70 | } | ||
71 | |||
53 | void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | 72 | void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) |
54 | { | 73 | { |
55 | if (line[0] == '/') { | 74 | if (line[0] == '/') { |
@@ -104,6 +123,9 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
104 | sprintf(numstring, "[i] changed nick to %s", (char*)name); | 123 | sprintf(numstring, "[i] changed nick to %s", (char*)name); |
105 | new_lines(numstring); | 124 | new_lines(numstring); |
106 | } | 125 | } |
126 | else if (line[1] == 'l') { | ||
127 | print_friendlist(); | ||
128 | } | ||
107 | else if (line[1] == 's') { | 129 | else if (line[1] == 's') { |
108 | uint8_t status[MAX_USERSTATUS_LENGTH]; | 130 | uint8_t status[MAX_USERSTATUS_LENGTH]; |
109 | int i = 0; | 131 | int i = 0; |
@@ -316,7 +338,8 @@ int main(int argc, char *argv[]) | |||
316 | raw(); | 338 | raw(); |
317 | getmaxyx(stdscr,y,x); | 339 | getmaxyx(stdscr,y,x); |
318 | new_lines(idstring0); | 340 | new_lines(idstring0); |
319 | new_lines("[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status), /n nick (to change nickname), /q (to quit)"); | 341 | new_lines("[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)"); |
342 | new_lines("[i] /l list (list friends), /n nick (to change nickname), /q (to quit)"); | ||
320 | strcpy(line, ""); | 343 | strcpy(line, ""); |
321 | IP_Port bootstrap_ip_port; | 344 | IP_Port bootstrap_ip_port; |
322 | bootstrap_ip_port.port = htons(atoi(argv[2])); | 345 | bootstrap_ip_port.port = htons(atoi(argv[2])); |