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.
This commit is contained in:
JC Brand 2018-10-11 11:02:20 +02:00
parent dffcc13dea
commit eee7ff763e
2 changed files with 10 additions and 16 deletions

14
dist/converse.js vendored
View File

@ -66434,13 +66434,8 @@ 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.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;
}
@ -66458,12 +66453,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'stanza': message
});
}
return true;
}
function registerHeadlineHandler() {
_converse.connection.addHandler(onHeadlineMessage, null, 'message');
_converse.connection.addHandler(message => {
onHeadlineMessage(message);
return true;
}, null, 'message');
}
_converse.on('connected', registerHeadlineHandler);

View File

@ -114,12 +114,8 @@
/* 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.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({
@ -131,11 +127,13 @@
chatbox.createMessage(message, message);
_converse.emit('message', {'chatbox': chatbox, 'stanza': message});
}
return true;
}
function registerHeadlineHandler () {
_converse.connection.addHandler(onHeadlineMessage, null, 'message');
_converse.connection.addHandler(message => {
onHeadlineMessage(message);
return true;
}, null, 'message');
}
_converse.on('connected', registerHeadlineHandler);
_converse.on('reconnected', registerHeadlineHandler);