summaryrefslogtreecommitdiff
path: root/testing/nTox.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/nTox.c')
-rw-r--r--testing/nTox.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 312484d6..15e209a9 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -18,7 +18,7 @@
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
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#include "nTox.h" 23#include "nTox.h"
24#include "misc_tools.h" 24#include "misc_tools.h"
@@ -55,7 +55,7 @@ void get_id(char *data)
55 { 55 {
56 if (self_public_key[i] < (PUB_KEY_BYTES / 2)) 56 if (self_public_key[i] < (PUB_KEY_BYTES / 2))
57 strcpy(idstring1[i],"0"); 57 strcpy(idstring1[i],"0");
58 else 58 else
59 strcpy(idstring1[i], ""); 59 strcpy(idstring1[i], "");
60 sprintf(idstring2[i], "%hhX",self_public_key[i]); 60 sprintf(idstring2[i], "%hhX",self_public_key[i]);
61 } 61 }
@@ -72,9 +72,9 @@ void get_id(char *data)
72void new_lines(char *line) 72void new_lines(char *line)
73{ 73{
74 int i = 0; 74 int i = 0;
75 for (i = HISTORY-1; i > 0; i--) 75 for (i = HISTORY-1; i > 0; i--)
76 strncpy(lines[i], lines[i-1], STRING_LENGTH - 1); 76 strncpy(lines[i], lines[i-1], STRING_LENGTH - 1);
77 77
78 strncpy(lines[0], line, STRING_LENGTH - 1); 78 strncpy(lines[0], line, STRING_LENGTH - 1);
79 do_refresh(); 79 do_refresh();
80} 80}
@@ -139,7 +139,7 @@ void line_eval(char *line)
139 if (inpt_command == 'f') { // add friend command: /f ID 139 if (inpt_command == 'f') { // add friend command: /f ID
140 int i; 140 int i;
141 char temp_id[128]; 141 char temp_id[128];
142 for (i = 0; i < 128; i++) 142 for (i = 0; i < 128; i++)
143 temp_id[i] = line[i+prompt_offset]; 143 temp_id[i] = line[i+prompt_offset];
144 144
145 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); 145 int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo"));
@@ -172,8 +172,8 @@ void line_eval(char *line)
172 } 172 }
173 else if (inpt_command == 'm') { //message command: /m friendnumber messsage 173 else if (inpt_command == 'm') { //message command: /m friendnumber messsage
174 size_t len = strlen(line); 174 size_t len = strlen(line);
175 if(len < 3) 175 if(len < 3)
176 return; 176 return;
177 177
178 char numstring[len-3]; 178 char numstring[len-3];
179 char message[len-3]; 179 char message[len-3];
@@ -253,7 +253,7 @@ void line_eval(char *line)
253 else if (inpt_command == 'q') { //exit 253 else if (inpt_command == 'q') { //exit
254 endwin(); 254 endwin();
255 exit(EXIT_SUCCESS); 255 exit(EXIT_SUCCESS);
256 } else { 256 } else {
257 new_lines("[i] invalid command"); 257 new_lines("[i] invalid command");
258 } 258 }
259 } else { 259 } else {
@@ -340,7 +340,7 @@ void print_message(int friendnumber, uint8_t * string, uint16_t length)
340 new_lines(format_message((char*)string, friendnumber)); 340 new_lines(format_message((char*)string, friendnumber));
341} 341}
342 342
343void print_nickchange(int friendnumber, uint8_t *string, uint16_t length) 343void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
344{ 344{
345 char name[MAX_NAME_LENGTH]; 345 char name[MAX_NAME_LENGTH];
346 getname(friendnumber, (uint8_t*)name); 346 getname(friendnumber, (uint8_t*)name);
@@ -349,7 +349,7 @@ void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
349 new_lines(msg); 349 new_lines(msg);
350} 350}
351 351
352void print_statuschange(int friendnumber, uint8_t *string, uint16_t length) 352void print_statuschange(int friendnumber, uint8_t *string, uint16_t length)
353{ 353{
354 char name[MAX_NAME_LENGTH]; 354 char name[MAX_NAME_LENGTH];
355 getname(friendnumber, (uint8_t*)name); 355 getname(friendnumber, (uint8_t*)name);
@@ -453,7 +453,7 @@ int main(int argc, char *argv[])
453 int resolved_address = resolve_addr(argv[1]); 453 int resolved_address = resolve_addr(argv[1]);
454 if (resolved_address != 0) 454 if (resolved_address != 0)
455 bootstrap_ip_port.ip.i = resolved_address; 455 bootstrap_ip_port.ip.i = resolved_address;
456 else 456 else
457 exit(1); 457 exit(1);
458 458
459 DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3])); 459 DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3]));
@@ -476,7 +476,7 @@ int main(int argc, char *argv[])
476 if (c == '\n') { 476 if (c == '\n') {
477 line_eval(line); 477 line_eval(line);
478 strcpy(line, ""); 478 strcpy(line, "");
479 } else if (c == 127) { 479 } else if (c == 8 || c == 127) {
480 line[strlen(line)-1] = '\0'; 480 line[strlen(line)-1] = '\0';
481 } else if (isalnum(c) || ispunct(c) || c == ' ') { 481 } else if (isalnum(c) || ispunct(c) || c == ' ') {
482 strcpy(line, appender(line, (char) c)); 482 strcpy(line, appender(line, (char) c));