From 5afc5df6a272da891437f730cc545a6daca044ef Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 15 Sep 2014 14:31:29 +0100 Subject: Dump name and statusmsg on conn status When a friend comes online, dump name + conn status --- ratatox.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ratatox.c b/ratatox.c index bd7aace..6b270cd 100644 --- a/ratatox.c +++ b/ratatox.c @@ -203,6 +203,7 @@ cb_conn_status(Tox *tox, int32_t fid, uint8_t status, void *udata) FILE *fp; struct friend *f; uint8_t name[TOX_MAX_NAME_LENGTH + 1]; + uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH + 1]; uint8_t *nick; int n; @@ -219,6 +220,14 @@ cb_conn_status(Tox *tox, int32_t fid, uint8_t status, void *udata) TAILQ_FOREACH(f, &friendhead, entry) { if (f->fid == fid) { blabla(f, "online", "w", status == 0 ? "0\n" : "1\n"); + if (status == 1) { + blabla(f, "name", "w", "%s\n", name); + n = tox_get_status_message_size(tox, fid); + if (n > TOX_MAX_STATUSMESSAGE_LENGTH + 1) + n = TOX_MAX_STATUSMESSAGE_LENGTH; + statusmsg[n] = '\0'; + blabla(f, "statusmsg", "w", "%s\n", statusmsg); + } return; } } -- cgit v1.2.3