summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/nTox.c16
-rw-r--r--testing/nTox.h3
2 files changed, 12 insertions, 7 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 4989f88a..a498e9a1 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -36,11 +36,12 @@
36char lines[HISTORY][STRING_LENGTH]; 36char lines[HISTORY][STRING_LENGTH];
37char line[STRING_LENGTH]; 37char line[STRING_LENGTH];
38 38
39char *help = "[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)\n" 39char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message "
40 "[i] /l list (list friends), /h for help, /i for info, /n nick (to change nickname), /q (to quit)"; 40 "(to send message)\n/s status (to change status)\n[i] /l list (l"
41 "ist friends)\n/h for help\n/i for info\n/n nick (to change nick"
42 "name)\n/q (to quit)";
41int x, y; 43int x, y;
42 44
43
44uint8_t pending_requests[256][CLIENT_ID_SIZE]; 45uint8_t pending_requests[256][CLIENT_ID_SIZE];
45uint8_t num_requests = 0; 46uint8_t num_requests = 0;
46 47
@@ -126,7 +127,7 @@ char *format_message(char *message, int friendnum)
126 return msg; 127 return msg;
127} 128}
128 129
129void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) 130void line_eval(char *line)
130{ 131{
131 if (line[0] == '/') { 132 if (line[0] == '/') {
132 char inpt_command = line[1]; 133 char inpt_command = line[1];
@@ -410,13 +411,16 @@ int main(int argc, char *argv[])
410 411
411 char idstring[200]; 412 char idstring[200];
412 get_id(idstring); 413 get_id(idstring);
414
413 initscr(); 415 initscr();
414 noecho(); 416 noecho();
415 raw(); 417 raw();
416 getmaxyx(stdscr, y, x); 418 getmaxyx(stdscr, y, x);
419
420 new_lines("/h for list of commands");
417 new_lines(idstring); 421 new_lines(idstring);
418 new_lines(help);
419 strcpy(line, ""); 422 strcpy(line, "");
423
420 IP_Port bootstrap_ip_port; 424 IP_Port bootstrap_ip_port;
421 bootstrap_ip_port.port = htons(atoi(argv[2])); 425 bootstrap_ip_port.port = htons(atoi(argv[2]));
422 int resolved_address = resolve_addr(argv[1]); 426 int resolved_address = resolve_addr(argv[1]);
@@ -443,7 +447,7 @@ int main(int argc, char *argv[])
443 447
444 getmaxyx(stdscr, y, x); 448 getmaxyx(stdscr, y, x);
445 if (c == '\n') { 449 if (c == '\n') {
446 line_eval(lines, line); 450 line_eval(line);
447 strcpy(line, ""); 451 strcpy(line, "");
448 } else if (c == 127) { 452 } else if (c == 127) {
449 line[strlen(line)-1] = '\0'; 453 line[strlen(line)-1] = '\0';
diff --git a/testing/nTox.h b/testing/nTox.h
index 9d82556c..47c73513 100644
--- a/testing/nTox.h
+++ b/testing/nTox.h
@@ -37,12 +37,13 @@
37#include <netdb.h> 37#include <netdb.h>
38#include "../core/Messenger.h" 38#include "../core/Messenger.h"
39#include "../core/network.h" 39#include "../core/network.h"
40
40#define STRING_LENGTH 256 41#define STRING_LENGTH 256
41#define HISTORY 50 42#define HISTORY 50
42#define PUB_KEY_BYTES 32 43#define PUB_KEY_BYTES 32
43 44
44void new_lines(char *line); 45void new_lines(char *line);
45void line_eval(char lines[HISTORY][STRING_LENGTH], char *line); 46void line_eval(char *line);
46void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ; 47void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ;
47int count_lines(char *string) ; 48int count_lines(char *string) ;
48char *appender(char *str, const char c); 49char *appender(char *str, const char c);