From 371ab65b08a50027086708f48587cd8669ecc463 Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 15 Sep 2014 18:10:24 +0100 Subject: Avoid blank nicknames when printing --- ratatox.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ratatox.c') diff --git a/ratatox.c b/ratatox.c index 1a264fe..84a4bde 100644 --- 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; } -- cgit v1.2.3