Commit a3390531 authored by JC Brand's avatar JC Brand

Revert "Remove check for `@` and for `allow_non_roster_messaging`"

Seems to make some sense after all, but we need to add a check that the
user isn't a roster contact as well.
parent eee7ff76
...@@ -66434,8 +66434,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -66434,8 +66434,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
const from_jid = message.getAttribute('from'); const from_jid = message.getAttribute('from');
if (utils.isHeadlineMessage(_converse, message)) { if (utils.isHeadlineMessage(_converse, message)) {
if (_.includes(from_jid, '@') && !_converse.api.contacts.get(from_jid) && !_converse.allow_non_roster_messaging) {
return;
}
if (_.isNull(message.querySelector('body'))) { if (_.isNull(message.querySelector('body'))) {
// Avoid creating a chat box if we have nothing to show inside it. // Avoid creating a chat box if we have nothing to show
// inside it.
return; return;
} }
...@@ -66453,13 +66458,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -66453,13 +66458,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'stanza': message 'stanza': message
}); });
} }
return true;
} }
function registerHeadlineHandler() { function registerHeadlineHandler() {
_converse.connection.addHandler(message => { _converse.connection.addHandler(onHeadlineMessage, null, 'message');
onHeadlineMessage(message);
return true;
}, null, 'message');
} }
_converse.on('connected', registerHeadlineHandler); _converse.on('connected', registerHeadlineHandler);
...@@ -114,8 +114,14 @@ ...@@ -114,8 +114,14 @@
/* Handler method for all incoming messages of type "headline". */ /* Handler method for all incoming messages of type "headline". */
const from_jid = message.getAttribute('from'); const from_jid = message.getAttribute('from');
if (utils.isHeadlineMessage(_converse, message)) { if (utils.isHeadlineMessage(_converse, message)) {
if (_.includes(from_jid, '@') &&
!_converse.api.contacts.get(from_jid) &&
!_converse.allow_non_roster_messaging) {
return;
}
if (_.isNull(message.querySelector('body'))) { if (_.isNull(message.querySelector('body'))) {
// Avoid creating a chat box if we have nothing to show inside it. // Avoid creating a chat box if we have nothing to show
// inside it.
return; return;
} }
const chatbox = _converse.chatboxes.create({ const chatbox = _converse.chatboxes.create({
...@@ -127,13 +133,11 @@ ...@@ -127,13 +133,11 @@
chatbox.createMessage(message, message); chatbox.createMessage(message, message);
_converse.emit('message', {'chatbox': chatbox, 'stanza': message}); _converse.emit('message', {'chatbox': chatbox, 'stanza': message});
} }
return true;
} }
function registerHeadlineHandler () { function registerHeadlineHandler () {
_converse.connection.addHandler(message => { _converse.connection.addHandler(onHeadlineMessage, null, 'message');
onHeadlineMessage(message);
return true;
}, null, 'message');
} }
_converse.on('connected', registerHeadlineHandler); _converse.on('connected', registerHeadlineHandler);
_converse.on('reconnected', registerHeadlineHandler); _converse.on('reconnected', registerHeadlineHandler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment