Commit 37e4ed6f authored by JC Brand's avatar JC Brand

Avoid false headline message positive for node-less MUC JIDs

parent 479d6570
......@@ -272,7 +272,7 @@
Strophe.LogLevel.INFO
);
return true;
} else if (utils.isHeadlineMessage(message)) {
} else if (utils.isHeadlineMessage(_converse, message)) {
// XXX: Ideally we wouldn't have to check for headline
// messages, but Prosody sends headline messages with the
// wrong type ('chat'), so we need to filter them out here.
......
......@@ -129,7 +129,7 @@
function onHeadlineMessage (message) {
/* Handler method for all incoming messages of type "headline". */
const from_jid = message.getAttribute('from');
if (utils.isHeadlineMessage(message)) {
if (utils.isHeadlineMessage(_converse, message)) {
if (_.includes(from_jid, '@') && !_converse.allow_non_roster_messaging) {
return;
}
......
......@@ -93,7 +93,7 @@
return false;
} else if (message.getAttribute('type') === 'groupchat') {
return _converse.shouldNotifyOfGroupMessage(message);
} else if (utils.isHeadlineMessage(message)) {
} else if (utils.isHeadlineMessage(_converse, message)) {
// We want to show notifications for headline messages.
return _converse.isMessageToHiddenChat(message);
}
......
......@@ -399,11 +399,15 @@
return text && !!text.match(/^\?OTR/);
};
u.isHeadlineMessage = function (message) {
u.isHeadlineMessage = function (_converse, message) {
var from_jid = message.getAttribute('from');
if (message.getAttribute('type') === 'headline') {
return true;
}
const chatbox = _converse.chatboxes.get(Strophe.getBareJidFromJid(from_jid));
if (chatbox && chatbox.get('type') === 'chatroom') {
return false;
}
if (message.getAttribute('type') !== 'error' &&
!_.isNil(from_jid) &&
!_.includes(from_jid, '@')) {
......
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