diff options
author | sin <sin@2f30.org> | 2014-09-15 14:31:29 +0100 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-09-15 14:32:46 +0100 |
commit | 5afc5df6a272da891437f730cc545a6daca044ef (patch) | |
tree | 89eea32f94304e5fd33987c63c8a29e03816f224 | |
parent | 26bb4f4a75d9561bd68a92fce7827a3c7cbae0d4 (diff) |
Dump name and statusmsg on conn status
When a friend comes online, dump name + conn status
-rw-r--r-- | ratatox.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; } } |