mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 10:23:26 +01:00
Fix AV bug
Pending call now properly hangs up when you use the /hangup command or close the chat window
This commit is contained in:
parent
9f0feb7223
commit
b24c5d8cf8
@ -570,8 +570,8 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
{
|
||||
const char *error_str = NULL;
|
||||
|
||||
if ( !self->is_call ) {
|
||||
error_str = "Not in a call.";
|
||||
if ( !CallControl.av ) {
|
||||
error_str = "Audio not supported!";
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
@ -580,8 +580,8 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
if ( !CallControl.av ) {
|
||||
error_str = "Audio not supported!";
|
||||
if ( !self->is_call && !CallControl.pending_call ) {
|
||||
error_str = "Not in a call.";
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
@ -589,18 +589,7 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
||||
callback_video_end(self->num);
|
||||
#endif /* VIDEO */
|
||||
|
||||
if ( CallControl.pending_call ) {
|
||||
/* Manually send a cancel call control because call hasn't started */
|
||||
toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, NULL);
|
||||
callback_call_canceled(self->num);
|
||||
}
|
||||
else {
|
||||
stop_transmission(&CallControl.calls[self->num], self->num);
|
||||
callback_call_ended(self->num);
|
||||
}
|
||||
|
||||
CallControl.pending_call = false;
|
||||
|
||||
stop_current_call(self);
|
||||
return;
|
||||
on_error:
|
||||
print_err (self, error_str);
|
||||
@ -835,6 +824,16 @@ void stop_current_call(ToxWindow* self)
|
||||
{
|
||||
Call *this_call = &CallControl.calls[self->num];
|
||||
|
||||
if (this_call && self->is_call)
|
||||
stop_transmission(this_call, self->num);
|
||||
if ( !this_call )
|
||||
return;
|
||||
|
||||
if ( CallControl.pending_call ) {
|
||||
toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, NULL);
|
||||
callback_call_canceled(self->num);
|
||||
} else {
|
||||
stop_transmission(&CallControl.calls[self->num], self->num);
|
||||
callback_call_ended(self->num);
|
||||
}
|
||||
|
||||
CallControl.pending_call = false;
|
||||
}
|
||||
|
10
src/chat.c
10
src/chat.c
@ -126,11 +126,6 @@ void kill_chat_window(ToxWindow *self, Tox *m)
|
||||
ChatContext *ctx = self->chatwin;
|
||||
StatusBar *statusbar = self->stb;
|
||||
|
||||
kill_all_file_transfers_friend(m, self->num);
|
||||
log_disable(ctx->log);
|
||||
line_info_cleanup(ctx->hst);
|
||||
cqueue_cleanup(ctx->cqueue);
|
||||
|
||||
#ifdef AUDIO
|
||||
#ifdef VIDEO
|
||||
stop_video_stream(self);
|
||||
@ -138,6 +133,11 @@ void kill_chat_window(ToxWindow *self, Tox *m)
|
||||
stop_current_call(self);
|
||||
#endif /* AUDIO */
|
||||
|
||||
kill_all_file_transfers_friend(m, self->num);
|
||||
log_disable(ctx->log);
|
||||
line_info_cleanup(ctx->hst);
|
||||
cqueue_cleanup(ctx->cqueue);
|
||||
|
||||
delwin(ctx->linewin);
|
||||
delwin(ctx->history);
|
||||
delwin(statusbar->topline);
|
||||
|
@ -329,7 +329,7 @@ void *lookup_thread_func(void *data)
|
||||
curl_easy_setopt(c_handle, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(c_handle, CURLOPT_URL, real_domain);
|
||||
curl_easy_setopt(c_handle, CURLOPT_WRITEFUNCTION, write_lookup_data);
|
||||
curl_easy_setopt(c_handle, CURLOPT_WRITEDATA, (void *) &recv_data);
|
||||
curl_easy_setopt(c_handle, CURLOPT_WRITEDATA, &recv_data);
|
||||
curl_easy_setopt(c_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
|
||||
curl_easy_setopt(c_handle, CURLOPT_POSTFIELDS, post_data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user