From 5307e8870a1a4aea9da534b009190246a8b6e9f0 Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 21 Oct 2015 03:24:08 -0300 Subject: jabber: Fix XEP85 detection (typing) between two bitlbee users Fixes trac ticket 1143: https://bugs.bitlbee.org/bitlbee/ticket/1143 The "correct" way to discover XEP85 support is to send a discovery query. We take a more conservative approach: if the irc client claims to support typing (by sending CTCP TYPING at least once), we send an tag along with next chat message, and set JBFLAG_PROBED_XEP85. The logic for that stuff is in jabber_buddy_msg(). That's all neat and clever and actually works fine. What was broken was the detection side. Whenever a , or is received, the buddy is marked as supporting XEP85. However the tag had an additional check: /* No need to send a "stopped typing" signal when there's a message. */ else if (xt_find_node(node->children, "active") && (body == NULL)) { It skipped the tag completely if it had a message too. This was changed to move the body == NULL condition inside, so that the flag is set. Took me longer to write this message than the diff itself. But even longer to actually decide to debug this behavior. I'm the one who submitted that ticket, one year and a half ago. Yep. --- protocols/jabber/message.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'protocols/jabber/message.c') diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index 1b47693b..7c40f3e0 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -141,10 +141,13 @@ xt_status jabber_pkt_message(struct xt_node *node, gpointer data) bud->flags |= JBFLAG_DOES_XEP85; imcb_buddy_typing(ic, from, OPT_TYPING); } - /* No need to send a "stopped typing" signal when there's a message. */ - else if (xt_find_node(node->children, "active") && (body == NULL)) { + else if (xt_find_node(node->children, "active")) { bud->flags |= JBFLAG_DOES_XEP85; - imcb_buddy_typing(ic, from, 0); + + /* No need to send a "stopped typing" signal when there's a message. */ + if (body == NULL) { + imcb_buddy_typing(ic, from, 0); + } } else if (xt_find_node(node->children, "paused")) { bud->flags |= JBFLAG_DOES_XEP85; imcb_buddy_typing(ic, from, OPT_THINKING); -- cgit v1.2.3