diff options
author | FRIGN <dev@frign.de> | 2014-10-02 11:25:43 +0200 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-10-02 10:42:10 +0100 |
commit | d0c3a52050c8fdab224b612f4185a40d4d87bd04 (patch) | |
tree | 130128a31c4ea3b0a2eb5166d5ff0077244a63d0 | |
parent | 207fdb2bd1873c2e75b4337681e4c73e351e25e1 (diff) |
Add cancelrxcall()
-rw-r--r-- | ratox.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -199,6 +199,7 @@ static void cbreqtimeout(void *, int32_t, void *); static void cbpeertimeout(void *, int32_t, void *); static void cbcalltypechange(void *, int32_t, void *); static void cbcalldata(ToxAv *, int32_t, int16_t *, int, void *); +static void cancelrxcall(struct friend *, char *); static void cbconnstatus(Tox *, int32_t, uint8_t, void *); static void cbfriendmessage(Tox *, int32_t, const uint8_t *, uint16_t, void *); static void cbfriendrequest(Tox *, const uint8_t *, const uint8_t *, uint16_t, void *); @@ -390,14 +391,7 @@ cbcallended(void *av, int32_t cnum, void *udata) if (!f) return; - printout(": %s : Rx AV > Ended call\n", f->name); - f->avstate = av_CallNonExistant; - if (f->fd[FCALL_OUT] != -1) { - close(f->fd[FCALL_OUT]); - f->fd[FCALL_OUT] = -1; - } - ftruncate(f->fd[FCALL_PENDING], 0); - dprintf(f->fd[FCALL_PENDING], "0\n"); + cancelrxcall(f, "Ended"); } static void @@ -413,14 +407,7 @@ cbcallcancelled(void *av, int32_t cnum, void *udata) if (!f) return; - printout(": %s : Rx AV > Cancelled\n", f->name); - f->avstate = av_CallNonExistant; - if (f->fd[FCALL_OUT] != -1) { - close(f->fd[FCALL_OUT]); - f->fd[FCALL_OUT] = -1; - } - ftruncate(f->fd[FCALL_PENDING], 0); - dprintf(f->fd[FCALL_PENDING], "0\n"); + cancelrxcall(f, "Cancelled"); } static void @@ -502,6 +489,20 @@ cbcalldata(ToxAv *av, int32_t cnum, int16_t *data, int len, void *udata) } static void +cancelrxcall(struct friend *f, char *action) +{ + printout(": %s : Rx AV > %s\n", f->name, action); + f->avstate = av_CallNonExistant; + if (f->fd[FCALL_OUT] != -1) { + close(f->fd[FCALL_OUT]); + f->fd[FCALL_OUT] = -1; + } + ftruncate(f->fd[FCALL_PENDING], 0); + dprintf(f->fd[FCALL_PENDING], "0\n"); +} + + +static void cbconnstatus(Tox *m, int32_t frnum, uint8_t status, void *udata) { struct friend *f; |