summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/Messenger_test.c12
-rw-r--r--testing/nTox.c14
2 files changed, 13 insertions, 13 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index 7b94364a..619d94b1 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -56,6 +56,12 @@
56 56
57#endif 57#endif
58 58
59void print_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
60{
61 printf("Message with length %u received from %u: %s \n", length, friendnumber, string);
62 m_sendmessage(m, friendnumber, (uint8_t *)"Test1", 6);
63}
64
59/* FIXME needed as print_request has to match the interface expected by 65/* FIXME needed as print_request has to match the interface expected by
60 * networking_requesthandler and so cannot take a Messenger * */ 66 * networking_requesthandler and so cannot take a Messenger * */
61static Messenger *m; 67static Messenger *m;
@@ -87,12 +93,6 @@ void print_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *us
87 } 93 }
88} 94}
89 95
90void print_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void *userdata)
91{
92 printf("Message with length %u received from %u: %s \n", length, friendnumber, string);
93 m_sendmessage(m, friendnumber, (uint8_t *)"Test1", 6);
94}
95
96int main(int argc, char *argv[]) 96int main(int argc, char *argv[])
97{ 97{
98 /* let user override default by cmdline */ 98 /* let user override default by cmdline */
diff --git a/testing/nTox.c b/testing/nTox.c
index a9af5239..6ac663a6 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -51,7 +51,7 @@
51#endif 51#endif
52 52
53char lines[HISTORY][STRING_LENGTH]; 53char lines[HISTORY][STRING_LENGTH];
54char line[STRING_LENGTH]; 54char input_line[STRING_LENGTH];
55 55
56char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message " 56char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message "
57 "(to send message)\n/s status (to change status)\n[i] /l list (l" 57 "(to send message)\n/s status (to change status)\n[i] /l list (l"
@@ -442,7 +442,7 @@ void do_refresh()
442 move(y - 1, 0); 442 move(y - 1, 0);
443 clrtoeol(); 443 clrtoeol();
444 printw(">> "); 444 printw(">> ");
445 printw(line); 445 printw(input_line);
446 clrtoeol(); 446 clrtoeol();
447 refresh(); 447 refresh();
448} 448}
@@ -642,7 +642,7 @@ int main(int argc, char *argv[])
642 new_lines("/h for list of commands"); 642 new_lines("/h for list of commands");
643 get_id(m, idstring); 643 get_id(m, idstring);
644 new_lines(idstring); 644 new_lines(idstring);
645 strcpy(line, ""); 645 strcpy(input_line, "");
646 646
647 uint16_t port = htons(atoi(argv[argvoffset + 2])); 647 uint16_t port = htons(atoi(argv[argvoffset + 2]));
648 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); 648 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
@@ -694,12 +694,12 @@ int main(int argc, char *argv[])
694 getmaxyx(stdscr, y, x); 694 getmaxyx(stdscr, y, x);
695 695
696 if ((c == 0x0d) || (c == 0x0a)) { 696 if ((c == 0x0d) || (c == 0x0a)) {
697 line_eval(m, line); 697 line_eval(m, input_line);
698 strcpy(line, ""); 698 strcpy(input_line, "");
699 } else if (c == 8 || c == 127) { 699 } else if (c == 8 || c == 127) {
700 line[strlen(line) - 1] = '\0'; 700 input_line[strlen(input_line) - 1] = '\0';
701 } else if (isalnum(c) || ispunct(c) || c == ' ') { 701 } else if (isalnum(c) || ispunct(c) || c == ' ') {
702 strcpy(line, appender(line, (char) c)); 702 strcpy(input_line, appender(input_line, (char) c));
703 } 703 }
704 } 704 }
705 705