mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:03:04 +01:00
fixed status bugs and made them case insensitive
This commit is contained in:
parent
4ffb98dcdb
commit
8a2ffcd0ff
@ -421,19 +421,28 @@ void cmd_status(WINDOW *window, ToxWindow *prompt, Tox *m, int argc, char **argv
|
|||||||
return;
|
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;
|
TOX_USERSTATUS status_kind;
|
||||||
|
|
||||||
if (!strncmp(status, "online", strlen("online")))
|
if (!strcmp(l_status, "online"))
|
||||||
status_kind = TOX_USERSTATUS_NONE;
|
status_kind = TOX_USERSTATUS_NONE;
|
||||||
|
|
||||||
else if (!strncmp(status, "away", strlen("away")))
|
else if (!strcmp(l_status, "away"))
|
||||||
status_kind = TOX_USERSTATUS_AWAY;
|
status_kind = TOX_USERSTATUS_AWAY;
|
||||||
|
|
||||||
else if (!strncmp(status, "busy", strlen("busy")))
|
else if (!strcmp(l_status, "busy"))
|
||||||
status_kind = TOX_USERSTATUS_BUSY;
|
status_kind = TOX_USERSTATUS_BUSY;
|
||||||
|
|
||||||
else
|
else {
|
||||||
wprintw(window, "Invalid status.\n");
|
wprintw(window, "Invalid status. Valid statuses are: online, busy and away.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tox_set_userstatus(m, status_kind);
|
tox_set_userstatus(m, status_kind);
|
||||||
prompt_update_status(prompt, status_kind);
|
prompt_update_status(prompt, status_kind);
|
||||||
|
Loading…
Reference in New Issue
Block a user