summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/nTox.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 1e7ba9f3..ccb11a71 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -10,6 +10,7 @@
10char lines[HISTORY][STRING_LENGTH]; 10char lines[HISTORY][STRING_LENGTH];
11char line[STRING_LENGTH]; 11char line[STRING_LENGTH];
12int x,y; 12int x,y;
13int nick_before;
13 14
14void new_lines(char *line) 15void new_lines(char *line)
15{ 16{
@@ -49,7 +50,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
49 } 50 }
50 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); 51 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo"));
51 char numstring[100]; 52 char numstring[100];
52 sprintf(numstring, "Friend added, number: %d", num); 53 sprintf(numstring, "[i] added friend %d", num);
53 new_lines(numstring); 54 new_lines(numstring);
54 do_refresh(); 55 do_refresh();
55 } else if (line[1] == 'd') { 56 } else if (line[1] == 'd') {
@@ -82,7 +83,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
82 name[i - 3] = 0; 83 name[i - 3] = 0;
83 setname(name, i); 84 setname(name, i);
84 char numstring[100]; 85 char numstring[100];
85 sprintf(numstring, "Changed nick to: %s", (char*)name); 86 sprintf(numstring, "[i] changed nick to %s", (char*)name);
86 new_lines(numstring); 87 new_lines(numstring);
87 } else if (line[1] == 's') { 88 } else if (line[1] == 's') {
88 uint8_t status[MAX_USERSTATUS_LENGTH]; 89 uint8_t status[MAX_USERSTATUS_LENGTH];
@@ -94,7 +95,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
94 status[i - 3] = 0; 95 status[i - 3] = 0;
95 m_set_userstatus(status, strlen((char*)status)); 96 m_set_userstatus(status, strlen((char*)status));
96 char numstring[100]; 97 char numstring[100];
97 sprintf(numstring, "Changed status to: %s", (char*)status); 98 sprintf(numstring, "[i] changed status to %s", (char*)status);
98 new_lines(numstring); 99 new_lines(numstring);
99 } else if (line[1] == 'q') { //exit 100 } else if (line[1] == 'q') { //exit
100 endwin(); 101 endwin();
@@ -172,11 +173,11 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length)
172 if(memcmp(data , "Install Gentoo", sizeof("Install Gentoo")) == 0 ) 173 if(memcmp(data , "Install Gentoo", sizeof("Install Gentoo")) == 0 )
173 //if the request contained the message of peace the person is obviously a friend so we add him. 174 //if the request contained the message of peace the person is obviously a friend so we add him.
174 { 175 {
175 new_lines("Friend request accepted."); 176 new_lines("[i] friend request accepted.");
176 do_refresh(); 177 do_refresh();
177 int num = m_addfriend_norequest(public_key); 178 int num = m_addfriend_norequest(public_key);
178 char numchar[100]; 179 char numchar[100];
179 sprintf(numchar, "Friend added, number: %d", num); 180 sprintf(numchar, "[i] added friendnumber %d", num);
180 new_lines(numchar); 181 new_lines(numchar);
181 } 182 }
182} 183}
@@ -193,7 +194,7 @@ void print_nickchange(int friendnumber, uint8_t *string, uint16_t length) {
193 char *name = malloc(MAX_NAME_LENGTH); 194 char *name = malloc(MAX_NAME_LENGTH);
194 getname(friendnumber, (uint8_t*)name); 195 getname(friendnumber, (uint8_t*)name);
195 char msg[100+length]; 196 char msg[100+length];
196 sprintf(msg, "[%d] %s is now known as %s.", friendnumber, name, string); 197 sprintf(msg, "[i] [%d] %s is now known as %s.", friendnumber, name, string);
197 free(name); 198 free(name);
198 new_lines(msg); 199 new_lines(msg);
199} 200}
@@ -201,14 +202,14 @@ void print_statuschange(int friendnumber, uint8_t *string, uint16_t length) {
201 char *name = malloc(MAX_NAME_LENGTH); 202 char *name = malloc(MAX_NAME_LENGTH);
202 getname(friendnumber, (uint8_t*)name); 203 getname(friendnumber, (uint8_t*)name);
203 char msg[100+length+strlen(name)+1]; 204 char msg[100+length+strlen(name)+1];
204 sprintf(msg, "[%d] %s's status changed to %s.", friendnumber, name, string); 205 sprintf(msg, "[i] [%d] %s's status changed to %s.", friendnumber, name, string);
205 free(name); 206 free(name);
206 new_lines(msg); 207 new_lines(msg);
207} 208}
208int main(int argc, char *argv[]) 209int main(int argc, char *argv[])
209{ 210{
210 if (argc < 4) { 211 if (argc < 4) {
211 printf("usage %s ip port public_key (of the DHT bootstrap node)\n", argv[0]); 212 printf("[!] Usage: %s [IP] [port] [public_key]\n", argv[0]);
212 exit(0); 213 exit(0);
213 } 214 }
214 int c; 215 int c;
@@ -231,7 +232,7 @@ int main(int argc, char *argv[])
231 } 232 }
232 sprintf(idstring2[i], "%hhX",self_public_key[i]); 233 sprintf(idstring2[i], "%hhX",self_public_key[i]);
233 } 234 }
234 strcpy(idstring0,"Your ID is: "); 235 strcpy(idstring0,"[i] your ID: ");
235 for(i=0; i<32; i++) { 236 for(i=0; i<32; i++) {
236 strcat(idstring0,idstring1[i]); 237 strcat(idstring0,idstring1[i]);
237 strcat(idstring0,idstring2[i]); 238 strcat(idstring0,idstring2[i]);
@@ -241,7 +242,7 @@ int main(int argc, char *argv[])
241 raw(); 242 raw();
242 getmaxyx(stdscr,y,x); 243 getmaxyx(stdscr,y,x);
243 new_lines(idstring0); 244 new_lines(idstring0);
244 new_lines("/f ID (to add friend), /m friendnumber message (to send message), /s status (to change status), /n nick (to change nickname)"); 245 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)");
245 strcpy(line, ""); 246 strcpy(line, "");
246 IP_Port bootstrap_ip_port; 247 IP_Port bootstrap_ip_port;
247 bootstrap_ip_port.port = htons(atoi(argv[2])); 248 bootstrap_ip_port.port = htons(atoi(argv[2]));
@@ -272,7 +273,7 @@ int main(int argc, char *argv[])
272 { 273 {
273 if(DHT_isconnected()) 274 if(DHT_isconnected())
274 { 275 {
275 new_lines("You are now connected to the DHT."); 276 new_lines("[i] connected to DHT\n[i] define username with /n");
276 on = 1; 277 on = 1;
277 } 278 }
278 } 279 }