From 254e8e62498d0099bdf939624d7b9d4bc67ef49f Mon Sep 17 00:00:00 2001 From: pranomostro Date: Sat, 8 Jul 2017 23:53:48 +0200 Subject: Print own messages to FTEXT_OUT. Print own messages to FTEXT_OUT as well, for compatability with lchat (own messages just vanish if they are not reprinted in one of these files). --- ratox.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ratox.c') diff --git a/ratox.c b/ratox.c index 3f40aa3..ef92300 100644 --- a/ratox.c +++ b/ratox.c @@ -1075,6 +1075,8 @@ static void sendfriendtext(struct friend *f) { ssize_t n; + time_t t; + char buft[64]; uint8_t buf[TOX_MAX_MESSAGE_LENGTH]; TOX_ERR_FRIEND_SEND_MESSAGE err; @@ -1086,6 +1088,11 @@ sendfriendtext(struct friend *f) tox_friend_send_message(tox, f->num, TOX_MESSAGE_TYPE_NORMAL, buf, n, &err); if (err != TOX_ERR_FRIEND_SEND_MESSAGE_OK) weprintf("Failed to send message\n"); + + buf[n]='\0'; + t = time(NULL); + strftime(buft, sizeof(buft), "%F %R", localtime(&t)); + dprintf(f->fd[FTEXT_OUT], "me %s %s\n", buft, buf); } static void -- cgit v1.2.3