From 490c80dae92a7599438994db0fd9a52bc5980e6e Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Mon, 23 Jun 2014 22:02:22 -0400 Subject: [PATCH] don't allow calls to offline friends --- src/audio_call.c | 5 +++++ src/chat.c | 1 + 2 files changed, 6 insertions(+) diff --git a/src/audio_call.c b/src/audio_call.c index 60876db..75d342f 100644 --- a/src/audio_call.c +++ b/src/audio_call.c @@ -386,6 +386,11 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA 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); if ( error != ErrorNone ) { diff --git a/src/chat.c b/src/chat.c index 1ce5403..8cbc2b7 100644 --- a/src/chat.c +++ b/src/chat.c @@ -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)) return; + kill_infobox(self); self->call_idx = -1; line_info_add(self, NULL, NULL, NULL, "Call canceled!", SYS_MSG, 0, 0); }