1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 20:53:01 +01:00

fixed status bugs and made them case insensitive

This commit is contained in:
Jfreegman 2013-09-28 01:20:43 -04:00
parent 4ffb98dcdb
commit 8a2ffcd0ff

View File

@ -421,19 +421,28 @@ void cmd_status(WINDOW *window, ToxWindow *prompt, Tox *m, int argc, char **argv
return;
}
int len = strlen(status);
char l_status[len+1];
int i;
for (i = 0; i <= len; ++i)
l_status[i] = tolower(status[i]);
TOX_USERSTATUS status_kind;
if (!strncmp(status, "online", strlen("online")))
if (!strcmp(l_status, "online"))
status_kind = TOX_USERSTATUS_NONE;
else if (!strncmp(status, "away", strlen("away")))
else if (!strcmp(l_status, "away"))
status_kind = TOX_USERSTATUS_AWAY;
else if (!strncmp(status, "busy", strlen("busy")))
else if (!strcmp(l_status, "busy"))
status_kind = TOX_USERSTATUS_BUSY;
else
wprintw(window, "Invalid status.\n");
else {
wprintw(window, "Invalid status. Valid statuses are: online, busy and away.\n");
return;
}
tox_set_userstatus(m, status_kind);
prompt_update_status(prompt, status_kind);