mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-01 13:26:44 +02:00
Now closing the window will end the call
This commit is contained in:
31
src/chat.c
31
src/chat.c
@ -24,6 +24,7 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "toxic.h"
|
||||
#include "windows.h"
|
||||
@ -114,14 +115,20 @@ void kill_chat_window(ToxWindow *self, Tox *m)
|
||||
log_disable(ctx->log);
|
||||
line_info_cleanup(ctx->hst);
|
||||
|
||||
#ifdef _SUPPORT_AUDIO
|
||||
stop_current_call(self);
|
||||
#endif
|
||||
|
||||
int f_num = self->num;
|
||||
|
||||
delwin(ctx->linewin);
|
||||
delwin(ctx->history);
|
||||
delwin(self->window);
|
||||
delwin(statusbar->topline);
|
||||
|
||||
del_window(self);
|
||||
disable_chatwin(f_num);
|
||||
|
||||
|
||||
free(ctx->log);
|
||||
free(ctx->hst);
|
||||
free(ctx);
|
||||
@ -424,7 +431,7 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, co
|
||||
|
||||
void chat_onInvite (ToxWindow *self, ToxAv *av, int call_index)
|
||||
{
|
||||
if (self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
if (!self || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
/* call_index is set here and reset on call end */
|
||||
@ -438,7 +445,7 @@ void chat_onInvite (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onRinging (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
line_info_add(self, NULL, NULL, NULL, "Ringing...\"cancel\" ?", SYS_MSG, 0, 0);
|
||||
@ -446,7 +453,7 @@ void chat_onRinging (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onStarting (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
init_infobox(self);
|
||||
@ -456,7 +463,7 @@ void chat_onStarting (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onEnding (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
kill_infobox(self);
|
||||
@ -466,7 +473,7 @@ void chat_onEnding (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onError (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
self->call_idx = -1;
|
||||
@ -475,7 +482,7 @@ void chat_onError (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onStart (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
init_infobox(self);
|
||||
@ -485,7 +492,7 @@ void chat_onStart (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
kill_infobox(self);
|
||||
@ -495,7 +502,7 @@ void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onReject (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
self->call_idx = -1;
|
||||
@ -504,7 +511,7 @@ void chat_onReject (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onEnd (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
kill_infobox(self);
|
||||
@ -514,7 +521,7 @@ void chat_onEnd (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onRequestTimeout (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
self->call_idx = -1;
|
||||
@ -523,7 +530,7 @@ void chat_onRequestTimeout (ToxWindow *self, ToxAv *av, int call_index)
|
||||
|
||||
void chat_onPeerTimeout (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 || self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
|
||||
return;
|
||||
|
||||
kill_infobox(self);
|
||||
|
Reference in New Issue
Block a user