From e9bffd1bb839404fe40c739631a588dbbaf05a9a Mon Sep 17 00:00:00 2001 From: defanor Date: Wed, 6 Jan 2021 20:41:59 +0300 Subject: Print presence "show" and "status" in the console --- src/rexmpp_console.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/rexmpp_console.c b/src/rexmpp_console.c index e5192df..05f28a0 100644 --- a/src/rexmpp_console.c +++ b/src/rexmpp_console.c @@ -133,10 +133,25 @@ void rexmpp_console_on_recv (rexmpp_t *s, xmlNodePtr node) { } else if (presence_type != NULL && ! strcmp(presence_type, "unsubscribed")) { rexmpp_console_printf(s, "%s denies a presence subscription\n", from); } else { - rexmpp_console_printf(s, "%s is %s\n", from, + rexmpp_console_printf(s, "%s is %s", from, (presence_type == NULL) ? "available" : presence_type); + xmlNodePtr show = rexmpp_xml_find_child(node, "jabber:client", "show"); + if (show != NULL) { + char *show_str = xmlNodeGetContent(show); + rexmpp_console_printf(s, " (%s)", show_str); + free(show_str); + show_str = NULL; + } + xmlNodePtr status = rexmpp_xml_find_child(node, "jabber:client", "status"); + if (status != NULL) { + char *status_str = xmlNodeGetContent(status); + rexmpp_console_printf(s, ": %s", status_str); + free(status_str); + status_str = NULL; + } + rexmpp_console_printf(s, "\n"); } if (presence_type != NULL) { free(presence_type); -- cgit v1.2.3