diff options
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r-- | testing/toxic/prompt.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 89c87d8f..6b110073 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -164,6 +164,54 @@ static void execute(ToxWindow *self, char *u_cmd) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | else if (!strncmp(cmd, "status ", strlen("status "))) { | 166 | else if (!strncmp(cmd, "status ", strlen("status "))) { |
167 | char *status = strchr(cmd, ' '); | ||
168 | char *msg; | ||
169 | char *status_text; | ||
170 | if (status == NULL) { | ||
171 | wprintw(self->window, "Invalid syntax.\n"); | ||
172 | return; | ||
173 | } | ||
174 | status++; | ||
175 | USERSTATUS_KIND status_kind; | ||
176 | if (!strncmp(status, "online", strlen("online"))) { | ||
177 | status_kind = USERSTATUS_KIND_ONLINE; | ||
178 | status_text = "ONLINE"; | ||
179 | } | ||
180 | |||
181 | else if (!strncmp(status, "away", strlen("away"))) { | ||
182 | status_kind = USERSTATUS_KIND_AWAY; | ||
183 | status_text = "AWAY"; | ||
184 | } | ||
185 | |||
186 | else if (!strncmp(status, "busy", strlen("busy"))) { | ||
187 | status_kind = USERSTATUS_KIND_BUSY; | ||
188 | status_text = "BUSY"; | ||
189 | } | ||
190 | |||
191 | else if (!strncmp(status, "offline", strlen("offline"))) { | ||
192 | status_kind = USERSTATUS_KIND_OFFLINE; | ||
193 | status_text = "OFFLINE"; | ||
194 | } | ||
195 | |||
196 | else | ||
197 | { | ||
198 | wprintw(self->window, "Invalid status.\n"); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | msg = strchr(status, ' '); | ||
203 | if (msg == NULL) { | ||
204 | m_set_userstatus_kind(status_kind); | ||
205 | wprintw(self->window, "Status set to: %s\n", status_text); | ||
206 | } | ||
207 | else { | ||
208 | msg++; | ||
209 | m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1); | ||
210 | wprintw(self->window, "Status set to: %s, %s\n", status_text, msg); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | else if (!strncmp(cmd, "statusmsg ", strlen("statumsg "))) { | ||
167 | char *msg = strchr(cmd, ' '); | 215 | char *msg = strchr(cmd, ' '); |
168 | if (msg == NULL) { | 216 | if (msg == NULL) { |
169 | wprintw(self->window, "Invalid syntax.\n"); | 217 | wprintw(self->window, "Invalid syntax.\n"); |
@@ -306,7 +354,8 @@ static void print_usage(ToxWindow *self) | |||
306 | 354 | ||
307 | wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n"); | 355 | wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n"); |
308 | wprintw(self->window, " add <id> <message> : Add friend\n"); | 356 | wprintw(self->window, " add <id> <message> : Add friend\n"); |
309 | wprintw(self->window, " status <message> : Set your status\n"); | 357 | wprintw(self->window, " status <type> <message> : Set your status\n"); |
358 | wprintw(self->window, " statusmsg <message> : Set your status\n"); | ||
310 | wprintw(self->window, " nick <nickname> : Set your nickname\n"); | 359 | wprintw(self->window, " nick <nickname> : Set your nickname\n"); |
311 | wprintw(self->window, " accept <number> : Accept friend request\n"); | 360 | wprintw(self->window, " accept <number> : Accept friend request\n"); |
312 | wprintw(self->window, " myid : Print your ID\n"); | 361 | wprintw(self->window, " myid : Print your ID\n"); |