1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 16:03:27 +01:00

don't allow calls to offline friends

This commit is contained in:
Jfreegman 2014-06-23 22:02:22 -04:00
parent f324d2d34b
commit 490c80dae9
2 changed files with 6 additions and 0 deletions

View File

@ -386,6 +386,11 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
goto on_error; goto on_error;
} }
if (!self->stb->is_online) {
error_str = "Friend is offline.";
goto on_error;
}
ToxAvError error = toxav_call(ASettins.av, &self->call_idx, self->num, TypeAudio, 30); ToxAvError error = toxav_call(ASettins.av, &self->call_idx, self->num, TypeAudio, 30);
if ( error != ErrorNone ) { if ( error != ErrorNone ) {

View File

@ -497,6 +497,7 @@ void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0)) if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
return; return;
kill_infobox(self);
self->call_idx = -1; self->call_idx = -1;
line_info_add(self, NULL, NULL, NULL, "Call canceled!", SYS_MSG, 0, 0); line_info_add(self, NULL, NULL, NULL, "Call canceled!", SYS_MSG, 0, 0);
} }