add sanity checks to status functions

This commit is contained in:
Florian Stinglmayr 2019-07-23 20:06:09 +02:00
parent bd88d735eb
commit c136dd76e4

View File

@ -24,6 +24,8 @@ bool ncdc_cmd_idle(ncdc_mainwindow_t n, size_t ac, wchar_t **av,
{
bool ret = false;
return_if_true(!is_logged_in(), false);
ret = dc_api_set_user_status(dc_session_api(current_session),
dc_session_me(current_session),
DC_API_USER_STATUS_IDLE
@ -36,6 +38,8 @@ bool ncdc_cmd_online(ncdc_mainwindow_t n, size_t ac, wchar_t **av,
{
bool ret = false;
return_if_true(!is_logged_in(), false);
ret = dc_api_set_user_status(dc_session_api(current_session),
dc_session_me(current_session),
DC_API_USER_STATUS_ONLINE
@ -48,6 +52,8 @@ bool ncdc_cmd_invisible(ncdc_mainwindow_t n, size_t ac, wchar_t **av,
{
bool ret = false;
return_if_true(!is_logged_in(), false);
ret = dc_api_set_user_status(dc_session_api(current_session),
dc_session_me(current_session),
DC_API_USER_STATUS_INVISIBLE
@ -60,6 +66,8 @@ bool ncdc_cmd_dnd(ncdc_mainwindow_t n, size_t ac, wchar_t **av,
{
bool ret = false;
return_if_true(!is_logged_in(), false);
ret = dc_api_set_user_status(dc_session_api(current_session),
dc_session_me(current_session),
DC_API_USER_STATUS_DND