summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/nTox.c30
-rw-r--r--testing/nTox.h3
2 files changed, 24 insertions, 9 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 8d2ec1dd..de37b6f7 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -149,6 +149,10 @@ void print_message(int friendnumber, uint8_t * string, uint16_t length)
149} 149}
150int main(int argc, char *argv[]) 150int main(int argc, char *argv[])
151{ 151{
152 if (argc < 4) {
153 printf("usage %s ip port public_key (of the DHT bootstrap node)\n", argv[0]);
154 exit(0);
155 }
152 int c; 156 int c;
153 initMessenger(); 157 initMessenger();
154 m_callback_friendrequest(print_request); 158 m_callback_friendrequest(print_request);
@@ -178,16 +182,24 @@ int main(int argc, char *argv[])
178 new_lines(idstring0); 182 new_lines(idstring0);
179 do_refresh(); 183 do_refresh();
180 strcpy(line, ""); 184 strcpy(line, "");
181 while((c=getch())!=27) { 185 IP_Port bootstrap_ip_port;
182 getmaxyx(stdscr,y,x); 186 bootstrap_ip_port.port = htons(atoi(argv[2]));
183 if (c == '\n') { 187 bootstrap_ip_port.ip.i = inet_addr(argv[1]);
184 line_eval(lines, line); 188 DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3]));
185 strcpy(line, ""); 189 while(true) {
186 } else if (c == 127) { 190 c=getch();
187 line[strlen(line)-1] = '\0'; 191 if (c != 27) {
188 } else if (isalnum(c) || ispunct(c) || c == ' ') { 192 getmaxyx(stdscr,y,x);
189 strcpy(line,appender(line, (char) c)); 193 if (c == '\n') {
194 line_eval(lines, line);
195 strcpy(line, "");
196 } else if (c == 127) {
197 line[strlen(line)-1] = '\0';
198 } else if (isalnum(c) || ispunct(c) || c == ' ') {
199 strcpy(line,appender(line, (char) c));
200 }
190 } 201 }
202 doMessenger();
191 do_refresh(); 203 do_refresh();
192 } 204 }
193 endwin(); 205 endwin();
diff --git a/testing/nTox.h b/testing/nTox.h
index fea735db..432e0274 100644
--- a/testing/nTox.h
+++ b/testing/nTox.h
@@ -7,6 +7,9 @@
7#include <ncurses.h> 7#include <ncurses.h>
8#include <curses.h> 8#include <curses.h>
9#include <ctype.h> 9#include <ctype.h>
10#include <sys/socket.h>
11#include <netinet/in.h>
12#include <arpa/inet.h>
10#include "../core/Messenger.h" 13#include "../core/Messenger.h"
11#define STRING_LENGTH 256 14#define STRING_LENGTH 256
12#define HISTORY 50 15#define HISTORY 50