add sanity checks to status functions
This commit is contained in:
parent
bd88d735eb
commit
c136dd76e4
@ -24,6 +24,8 @@ bool ncdc_cmd_idle(ncdc_mainwindow_t n, size_t ac, wchar_t **av,
|
|||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
|
return_if_true(!is_logged_in(), false);
|
||||||
|
|
||||||
ret = dc_api_set_user_status(dc_session_api(current_session),
|
ret = dc_api_set_user_status(dc_session_api(current_session),
|
||||||
dc_session_me(current_session),
|
dc_session_me(current_session),
|
||||||
DC_API_USER_STATUS_IDLE
|
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;
|
bool ret = false;
|
||||||
|
|
||||||
|
return_if_true(!is_logged_in(), false);
|
||||||
|
|
||||||
ret = dc_api_set_user_status(dc_session_api(current_session),
|
ret = dc_api_set_user_status(dc_session_api(current_session),
|
||||||
dc_session_me(current_session),
|
dc_session_me(current_session),
|
||||||
DC_API_USER_STATUS_ONLINE
|
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;
|
bool ret = false;
|
||||||
|
|
||||||
|
return_if_true(!is_logged_in(), false);
|
||||||
|
|
||||||
ret = dc_api_set_user_status(dc_session_api(current_session),
|
ret = dc_api_set_user_status(dc_session_api(current_session),
|
||||||
dc_session_me(current_session),
|
dc_session_me(current_session),
|
||||||
DC_API_USER_STATUS_INVISIBLE
|
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;
|
bool ret = false;
|
||||||
|
|
||||||
|
return_if_true(!is_logged_in(), false);
|
||||||
|
|
||||||
ret = dc_api_set_user_status(dc_session_api(current_session),
|
ret = dc_api_set_user_status(dc_session_api(current_session),
|
||||||
dc_session_me(current_session),
|
dc_session_me(current_session),
|
||||||
DC_API_USER_STATUS_DND
|
DC_API_USER_STATUS_DND
|
||||||
|
Loading…
Reference in New Issue
Block a user