ratox

FIFO based tox client
git clone git://git.2f30.org/ratox
Log | Files | Refs | README | LICENSE

commit 37fa2e3d14cb5c86c0f2b789be1517dafdb25dda
parent 6149ff380daf791a0fbb033ba9b298d9aa5acea6
Author: pranomostro <pranomestro@gmail.com>
Date:   Fri, 13 Jan 2017 11:54:29 +0100

Remove conference slots as well. Fix some naming.

Diffstat:
Mratox.c | 36+++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/ratox.c b/ratox.c @@ -484,8 +484,6 @@ cbcalldata(ToxAV *av, uint32_t fnum, const int16_t *data, size_t len, static void cbconfinvite(Tox *m, uint32_t frnum, TOX_CONFERENCE_TYPE type, const uint8_t *cookie, size_t clen, void * udata) { - printf("called function %s\n", __func__); - size_t i, j, namelen; struct file invfifo; struct invite *inv; @@ -2029,7 +2027,8 @@ toxshutdown(void) struct friend *f, *ftmp; struct request *r, *rtmp; struct conference *c, *ctmp; - size_t i, m; + struct invite *i, *itmp; + size_t s, m; logmsg("Shutdown\n"); @@ -2061,18 +2060,33 @@ toxshutdown(void) free(r); } + /* Invites */ + for (i = TAILQ_FIRST(&invhead); i; i = itmp) { + itmp = TAILQ_NEXT(i, entry); + + if(gslots[CONF].fd[OUT] != -1) { + unlinkat(gslots[CONF].fd[OUT], i->fifoname, 0); + if (i->fd != -1) + close(i->fd); + } + TAILQ_REMOVE(&invhead, i, entry); + free(i->fifoname); + free(i->cookie); + free(i); + } + /* Global files and slots */ - for (i = 0; i < LEN(gslots); i++) { + for (s = 0; s < LEN(gslots); s++) { for (m = 0; m < LEN(gfiles); m++) { - if (gslots[i].dirfd != -1) { - unlinkat(gslots[i].dirfd, gfiles[m].name, - (gslots[i].outisfolder && m == OUT) + if (gslots[s].dirfd != -1) { + unlinkat(gslots[s].dirfd, gfiles[m].name, + (gslots[s].outisfolder && m == OUT) ? AT_REMOVEDIR : 0); - if (gslots[i].fd[m] != -1) - close(gslots[i].fd[m]); + if (gslots[s].fd[m] != -1) + close(gslots[s].fd[m]); } - } - rmdir(gslots[i].name); + } + rmdir(gslots[s].name); } unlink("id"); if (idfd != -1)