Commit eee7ff76 authored by JC Brand's avatar JC Brand

Remove check for `@` and for `allow_non_roster_messaging`

The second especially doesn't make sense and I'm currently not aware of
a case headline stanzas with a JIDs containing `@` and with a body
exist.
parent dffcc13d
...@@ -66434,13 +66434,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -66434,13 +66434,8 @@ 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.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 // Avoid creating a chat box if we have nothing to show inside it.
// inside it.
return; return;
} }
...@@ -66458,12 +66453,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ ...@@ -66458,12 +66453,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'stanza': message 'stanza': message
}); });
} }
return true;
} }
function registerHeadlineHandler() { function registerHeadlineHandler() {
_converse.connection.addHandler(onHeadlineMessage, null, 'message'); _converse.connection.addHandler(message => {
onHeadlineMessage(message);
return true;
}, null, 'message');
} }
_converse.on('connected', registerHeadlineHandler); _converse.on('connected', registerHeadlineHandler);
...@@ -114,12 +114,8 @@ ...@@ -114,12 +114,8 @@
/* 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.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 // Avoid creating a chat box if we have nothing to show inside it.
// inside it.
return; return;
} }
const chatbox = _converse.chatboxes.create({ const chatbox = _converse.chatboxes.create({
...@@ -131,11 +127,13 @@ ...@@ -131,11 +127,13 @@
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(onHeadlineMessage, null, 'message'); _converse.connection.addHandler(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