summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-15 14:31:29 +0100
committersin <sin@2f30.org>2014-09-15 14:32:46 +0100
commit5afc5df6a272da891437f730cc545a6daca044ef (patch)
tree89eea32f94304e5fd33987c63c8a29e03816f224
parent26bb4f4a75d9561bd68a92fce7827a3c7cbae0d4 (diff)
Dump name and statusmsg on conn status
When a friend comes online, dump name + conn status
-rw-r--r--ratatox.c9
1 files changed, 9 insertions, 0 deletions
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;
}
}