ratox

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

commit 0cd844914b1fa5bca3c881c35df7db3d6d4a058c
parent 11fccffc5de8321a66b7ab813ff0f99e92daa657
Author: sin <sin@2f30.org>
Date:   Mon, 15 Sep 2014 14:40:16 +0100

Create files even if the friend is not yet in our list

Diffstat:
Mratatox.c | 26++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/ratatox.c b/ratatox.c @@ -217,23 +217,21 @@ cb_conn_status(Tox *tox, int32_t fid, uint8_t status, void *udata) printf("%s %s\n", n == 0 ? (uint8_t *)"Anonymous" : name, status == 0 ? "went offline" : "came online"); - TAILQ_FOREACH(f, &friendhead, entry) { - if (f->fid == fid) { - blabla(f, "online", "w", status == 0 ? "0\n" : "1\n"); - if (status == 1) { - blabla(f, "name", "w", "%s\n", name); - n = tox_get_status_message_size(tox, fid); - if (n > TOX_MAX_STATUSMESSAGE_LENGTH + 1) - n = TOX_MAX_STATUSMESSAGE_LENGTH; - statusmsg[n] = '\0'; - blabla(f, "statusmsg", "w", "%s\n", statusmsg); - } - return; - } - } + TAILQ_FOREACH(f, &friendhead, entry) + if (f->fid == fid) + goto out; f = friendcreate(fid); +out: blabla(f, "online", "w", status == 0 ? "0\n" : "1\n"); + if (status == 1) { + blabla(f, "name", "w", "%s\n", name); + n = tox_get_status_message_size(tox, fid); + if (n > TOX_MAX_STATUSMESSAGE_LENGTH + 1) + n = TOX_MAX_STATUSMESSAGE_LENGTH; + statusmsg[n] = '\0'; + blabla(f, "statusmsg", "w", "%s\n", statusmsg); + } } static void