summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-07 09:11:51 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-07 09:11:51 -0400
commit5a8da17e61f59f189a8534f75d56c0e98f9caf39 (patch)
treeca27bb89c39cee1171fae48cf977daf7d4ddd866 /testing
parent0c4788030fb2f44d1120616d5b0ffd914700d3ff (diff)
parentba48234bfc864702b6464d3b148eafaf9ae32486 (diff)
Merge branch 'provide-status-type' of https://github.com/jin-eld/ProjectTox-Core into pull-requests
Diffstat (limited to 'testing')
-rw-r--r--testing/toxic/prompt.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index b0e21c64..d79d061f 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -175,6 +175,54 @@ static void execute(ToxWindow *self, char *u_cmd)
175 } 175 }
176 176
177 else if (!strncmp(cmd, "status ", strlen("status "))) { 177 else if (!strncmp(cmd, "status ", strlen("status "))) {
178 char *status = strchr(cmd, ' ');
179 char *msg;
180 char *status_text;
181 if (status == NULL) {
182 wprintw(self->window, "Invalid syntax.\n");
183 return;
184 }
185 status++;
186 USERSTATUS_KIND status_kind;
187 if (!strncmp(status, "online", strlen("online"))) {
188 status_kind = USERSTATUS_KIND_ONLINE;
189 status_text = "ONLINE";
190 }
191
192 else if (!strncmp(status, "away", strlen("away"))) {
193 status_kind = USERSTATUS_KIND_AWAY;
194 status_text = "AWAY";
195 }
196
197 else if (!strncmp(status, "busy", strlen("busy"))) {
198 status_kind = USERSTATUS_KIND_BUSY;
199 status_text = "BUSY";
200 }
201
202 else if (!strncmp(status, "offline", strlen("offline"))) {
203 status_kind = USERSTATUS_KIND_OFFLINE;
204 status_text = "OFFLINE";
205 }
206
207 else
208 {
209 wprintw(self->window, "Invalid status.\n");
210 return;
211 }
212
213 msg = strchr(status, ' ');
214 if (msg == NULL) {
215 m_set_userstatus_kind(status_kind);
216 wprintw(self->window, "Status set to: %s\n", status_text);
217 }
218 else {
219 msg++;
220 m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1);
221 wprintw(self->window, "Status set to: %s, %s\n", status_text, msg);
222 }
223 }
224
225 else if (!strncmp(cmd, "statusmsg ", strlen("statumsg "))) {
178 char *msg = strchr(cmd, ' '); 226 char *msg = strchr(cmd, ' ');
179 if (msg == NULL) { 227 if (msg == NULL) {
180 wprintw(self->window, "Invalid syntax.\n"); 228 wprintw(self->window, "Invalid syntax.\n");
@@ -317,7 +365,8 @@ static void print_usage(ToxWindow *self)
317 365
318 wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n"); 366 wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server\n");
319 wprintw(self->window, " add <id> <message> : Add friend\n"); 367 wprintw(self->window, " add <id> <message> : Add friend\n");
320 wprintw(self->window, " status <message> : Set your status\n"); 368 wprintw(self->window, " status <type> <message> : Set your status\n");
369 wprintw(self->window, " statusmsg <message> : Set your status\n");
321 wprintw(self->window, " nick <nickname> : Set your nickname\n"); 370 wprintw(self->window, " nick <nickname> : Set your nickname\n");
322 wprintw(self->window, " accept <number> : Accept friend request\n"); 371 wprintw(self->window, " accept <number> : Accept friend request\n");
323 wprintw(self->window, " myid : Print your ID\n"); 372 wprintw(self->window, " myid : Print your ID\n");