summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-10-03 12:41:50 +0100
committersin <sin@2f30.org>2014-10-03 12:41:50 +0100
commit4c4d2d25f8c24d1e2ec962962dcbd48bc9d541bb (patch)
tree7cf01168be42dfd3aae07828c2b4b5190c11971d
parent33ee6bfc66254e98e7500f8f2613ae0a4d19d87b (diff)
Implement cbcallending() to properly reset state when we cancel the call
-rw-r--r--ratox.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ratox.c b/ratox.c
index 2842f8c..6fe4b0e 100644
--- a/ratox.c
+++ b/ratox.c
@@ -431,7 +431,17 @@ cbcallstarting(void *av, int32_t cnum, void *udata)
static void
cbcallending(void *av, int32_t cnum, void *udata)
{
- printf("Entered %s\n", __func__);
+ struct friend *f;
+ int32_t fnum;
+
+ fnum = toxav_get_peer_id(toxav, cnum, 0);
+ TAILQ_FOREACH(f, &friendhead, entry)
+ if (f->num == fnum)
+ break;
+ if (!f)
+ return;
+
+ cancelrxcall(f, "Ending");
}
static void
@@ -475,7 +485,6 @@ cbcalldata(ToxAv *av, int32_t cnum, int16_t *data, int len, void *udata)
if (n < 0) {
if (errno == EPIPE) {
toxav_hangup(toxav, 0);
- cancelrxcall(f, "Hangup");
break;
} else if (errno == EWOULDBLOCK) {
continue;