commit 254e8e62498d0099bdf939624d7b9d4bc67ef49f
parent 0db821b7bd566f6cfdc0cc5a7bbcc3e5e92adb4c
Author: pranomostro <pranomostro@posteo.net>
Date: Sat, 8 Jul 2017 23:53:48 +0200
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).
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git 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