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_
const from_jid = message.getAttribute('from');
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'))) {
// 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;
}
......@@ -66453,13 +66458,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'stanza': message
});
}
return true;
}
function registerHeadlineHandler() {
_converse.connection.addHandler(message => {
onHeadlineMessage(message);
return true;
}, null, 'message');
_converse.connection.addHandler(onHeadlineMessage, null, 'message');
}
_converse.on('connected', registerHeadlineHandler);
......@@ -114,8 +114,14 @@
/* Handler method for all incoming messages of type "headline". */
const from_jid = message.getAttribute('from');
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'))) {
// 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;
}
const chatbox = _converse.chatboxes.create({
......@@ -127,13 +133,11 @@
chatbox.createMessage(message, message);
_converse.emit('message', {'chatbox': chatbox, 'stanza': message});
}
return true;
}
function registerHeadlineHandler () {
_converse.connection.addHandler(message => {
onHeadlineMessage(message);
return true;
}, null, 'message');
_converse.connection.addHandler(onHeadlineMessage, null, 'message');
}
_converse.on('connected', 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