converse.js icon indicating copy to clipboard operation
converse.js copied to clipboard

Can't chat with bare host JID (related to prosody mod_watchregistrations)

Open Zash opened this issue 6 years ago • 4 comments

Background: mod_pubsub_text_interface is a plugin that lets you interact with a pubsub service using plain text messages.

While mindlessly testing random unrelated things, I noticed that Converse would not show messages from such a pubsub service.

Debug logs show

INFO: onMessage: Ignoring incoming headline message from JID: pubsub.example.org

The messages in question are of type chat and look like

<message type='chat' from='pubsub.example.org' xmlns='jabber:client' to='[email protected]/converse.js-118140825' id='APq0d3ji8wXSTz1T'>
<body>PubSub Service on pubsub.example.org [...]</body>
</message>

I've traced this to this definition of a headline message:

https://github.com/conversejs/converse.js/blob/0ebfc3fce8fc570f341763822339b389feed0132/src/headless/utils/core.js#L110-L120

Originally introduced in https://github.com/conversejs/converse.js/commit/d3c97486dd56e4d8a00086eff1a8bb123c5e0f8b

As someone involved in Prosody development, I would be interested in knowing what originally prompted this workaround so it can be fixed in Prosody.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Zash avatar Mar 22 '19 22:03 Zash

That code is from long ago (~3 years or so), and the issue was related to mod_watchregistrations.

The issue is that registration notifications are sent as type chat, even though they should be headline IMO. I see that this is (now) configurable, but chat is still the default, I'm not sure whether this was the case back when I wrote that code.

I've been meaning to make a bug report for this, I don't think I ever did, so yeah... sorry about that :)

From Converse's perspective, a message of type chat implies two-way communication, so a chatbox with textarea is shown. A message of type headline implies one-way communication, so a textarea is not shown. AFAIK this is inline with the original intent behind headline.

See https://hg.prosody.im/trunk/file/tip/plugins/mod_watchregistrations.lua#l16

jcbrand avatar Mar 23 '19 09:03 jcbrand

I was not aware of the special handling of headline. Interesting, but looks like a bug if you're not prepared for the lack of input textarea.

In this case, I had added the pubsub component to my roster to be able to send messages to it, and then there is a textarea, but the "headline" replies are discarded.

I can't find the reason the message type in mod_watchregistrations was originally set to chat. One reason I can think of is that a chat message sent while you're offline is saved, while a headline is discarded. That makes it problematic for important system messages.

Zash avatar Mar 23 '19 12:03 Zash

@Zash @jcbrand is this still a relevant issue?

Echolon avatar Sep 10 '21 21:09 Echolon

Yes, although I'm not sure what the solution is.

jcbrand avatar Sep 11 '21 07:09 jcbrand