diff options
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r-- | testing/toxic/prompt.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 21c1f52a..b0f83811 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -16,6 +16,7 @@ uint8_t pending_requests[256][CLIENT_ID_SIZE]; // XXX | |||
16 | uint8_t num_requests=0; // XXX | 16 | uint8_t num_requests=0; // XXX |
17 | 17 | ||
18 | extern void on_friendadded(int friendnumber); | 18 | extern void on_friendadded(int friendnumber); |
19 | static void print_usage(ToxWindow* self); | ||
19 | 20 | ||
20 | // XXX: | 21 | // XXX: |
21 | int add_req(uint8_t* public_key) { | 22 | int add_req(uint8_t* public_key) { |
@@ -82,8 +83,8 @@ static void execute(ToxWindow* self, char* cmd) { | |||
82 | 83 | ||
83 | dht.port = htons(atoi(port)); | 84 | dht.port = htons(atoi(port)); |
84 | 85 | ||
85 | int resolved_address = resolve_addr(ip); | 86 | uint32_t resolved_address = resolve_addr(ip); |
86 | if (resolved_address == -1) { | 87 | if (resolved_address == 0) { |
87 | return; | 88 | return; |
88 | } | 89 | } |
89 | 90 | ||
@@ -156,24 +157,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
156 | } | 157 | } |
157 | 158 | ||
158 | else if(!strcmp(cmd, "help")) { | 159 | else if(!strcmp(cmd, "help")) { |
159 | wattron(self->window, COLOR_PAIR(2) | A_BOLD); | 160 | print_usage(self); |
160 | wprintw(self->window, "Commands:\n"); | ||
161 | wattroff(self->window, A_BOLD); | ||
162 | |||
163 | wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n"); | ||
164 | wprintw(self->window, " add <id> <message> : Add friend\n"); | ||
165 | wprintw(self->window, " status <message> : Set your status\n"); | ||
166 | wprintw(self->window, " nick <nickname> : Set your nickname\n"); | ||
167 | wprintw(self->window, " accept <number> : Accept friend request\n"); | ||
168 | wprintw(self->window, " myid : Print your ID\n"); | ||
169 | wprintw(self->window, " quit/exit : Exit program\n"); | ||
170 | |||
171 | |||
172 | wattron(self->window, A_BOLD); | ||
173 | wprintw(self->window, "TIP: Use the TAB key to navigate through the tabs.\n\n"); | ||
174 | wattroff(self->window, A_BOLD); | ||
175 | |||
176 | wattroff(self->window, COLOR_PAIR(2)); | ||
177 | } | 161 | } |
178 | else if(!strncmp(cmd, "status ", strlen("status "))) { | 162 | else if(!strncmp(cmd, "status ", strlen("status "))) { |
179 | char* msg; | 163 | char* msg; |