summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-15 18:10:24 +0100
committersin <sin@2f30.org>2014-09-15 18:10:24 +0100
commit371ab65b08a50027086708f48587cd8669ecc463 (patch)
tree5ad65c5e39f10c1eefe0b7f2c83d2800857d2201
parentd46e99d50ba3f096f12298bd45169833fe0bcf6d (diff)
Avoid blank nicknames when printing
-rw-r--r--ratatox.c9
1 files changed, 6 insertions, 3 deletions
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;
}