conversejs / converse.js

Web-based XMPP/Jabber chat client written in JavaScript
http://conversejs.org
Mozilla Public License 2.0
3.04k stars 763 forks source link

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

Open Zash opened 5 years ago

Zash commented 5 years ago

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='zash@test.local/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!](https://app.bountysource.com/issues/71785432-can-t-chat-with-bare-host-jid-related-to-prosody-mod_watchregistrations?utm_campaign=plugin&utm_content=tracker%2F194169&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F194169&utm_medium=issues&utm_source=github).
jcbrand commented 5 years ago

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

Zash commented 5 years ago

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.

Echolon commented 2 years ago

@Zash @jcbrand is this still a relevant issue?

jcbrand commented 2 years ago

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