ratox

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

commit 371ab65b08a50027086708f48587cd8669ecc463
parent d46e99d50ba3f096f12298bd45169833fe0bcf6d
Author: sin <sin@2f30.org>
Date:   Mon Sep 15 18:10:24 +0100

Avoid blank nicknames when printing

Diffstat:
ratatox.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ratatox.c b/ratatox.c @@ -226,7 +226,8 @@ cb_friend_message(Tox *m, int32_t fid, const uint8_t *data, uint16_t len, void * t = time(NULL); strftime(buft, sizeof(buft), "%F %R", localtime(&t)); writeparam(f, "text_out", "a", "%s %s\n", buft, msg); - printout("%s %s\n", f->namestr, msg); + printout("%s %s\n", + f->namestr[0] == '\0' ? "Anonymous" : f->namestr, msg); break; } } @@ -296,7 +297,8 @@ cb_status_message(Tox *m, int32_t fid, const uint8_t *data, uint16_t len, void * TAILQ_FOREACH(f, &friendhead, entry) { if (f->fid == fid) { writeparam(f, "statusmsg", "w", "%s\n", statusmsg); - printout("%s changed status: %s\n", f->namestr, statusmsg); + printout("%s changed status: %s\n", + f->namestr[0] == '\0' ? "Anonymous" : f->namestr, statusmsg); break; } } @@ -316,7 +318,8 @@ cb_user_status(Tox *m, int32_t fid, uint8_t status, void *udata) TAILQ_FOREACH(f, &friendhead, entry) { if (f->fid == fid) { - printout("%s changed user status: %s\n", f->namestr, + printout("%s changed user status: %s\n", + f->namestr[0] == '\0' ? "Anonymous" : f->namestr, statusstr[status]); break; }