New event messageNotification
This commit is contained in:
parent
a2441545db
commit
aa730b5976
2
dist/converse.js
vendored
2
dist/converse.js
vendored
@ -55920,6 +55920,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_converse.api.emit('messageNotification', message);
|
||||||
|
|
||||||
_converse.playSoundNotification();
|
_converse.playSoundNotification();
|
||||||
|
|
||||||
_converse.showMessageNotification(message);
|
_converse.showMessageNotification(message);
|
||||||
|
@ -259,6 +259,22 @@ as a `message` attribute which refers to the Message model.
|
|||||||
// The original chatbox is at `data.chatbox`.
|
// The original chatbox is at `data.chatbox`.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
messageNotification
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Emitted just before an HTML5 message notification will be sent out.
|
||||||
|
|
||||||
|
.. code-block:: javascript
|
||||||
|
|
||||||
|
_converse.api.listen.on('messageNotification', stanza => {
|
||||||
|
|
||||||
|
const body = sizzle(`encrypted[xmlns="${Strophe.NS.OMEMO}"]`, message).length ?
|
||||||
|
__('OMEMO Message received') :
|
||||||
|
_.get(message.querySelector('body'), 'textContent');
|
||||||
|
alert(body);
|
||||||
|
});
|
||||||
|
|
||||||
messageSend
|
messageSend
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -261,6 +261,7 @@ converse.plugins.add('converse-notification', {
|
|||||||
if (!_converse.shouldNotifyOfMessage(message)) {
|
if (!_converse.shouldNotifyOfMessage(message)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
_converse.api.emit('messageNotification', message);
|
||||||
_converse.playSoundNotification();
|
_converse.playSoundNotification();
|
||||||
_converse.showMessageNotification(message);
|
_converse.showMessageNotification(message);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user