summaryrefslogtreecommitdiff
path: root/ratatox.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-15 16:12:04 +0100
committersin <sin@2f30.org>2014-09-15 16:12:04 +0100
commit12fca982dd5a33192f4b09fb11a8b17286cd5a2b (patch)
treed9d37ca06f2eba4269b86f9f4d4b52ef05e70e65 /ratatox.c
parent1ee33dec234f2c5752583484831a6ae70782b5b3 (diff)
Add timestamps for incoming messages
We should tweak the time format.
Diffstat (limited to 'ratatox.c')
-rw-r--r--ratatox.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ratatox.c b/ratatox.c
index eec57c5..332b876 100644
--- a/ratatox.c
+++ b/ratatox.c
@@ -211,13 +211,17 @@ cb_friend_message(Tox *tox, int32_t fid, const uint8_t *data, uint16_t len, void
{
struct friend *f;
uint8_t msg[len + 1];
+ char buft[64];
+ time_t t;
memcpy(msg, data, len);
msg[len] = '\0';
TAILQ_FOREACH(f, &friendhead, entry) {
if (f->fid == fid) {
- writeparam(f, "text_out", "a", "%s\n", msg);
+ t = time(NULL);
+ strftime(buft, sizeof(buft), "%F %R", localtime(&t));
+ writeparam(f, "text_out", "a", "%s %s\n", buft, msg);
break;
}
}