blob: 0c362f09bc6f0a523936bb93e4d1ff5ab62e6b11 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const _path = _interopRequireDefault(require('path'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
module.exports = Ferdium => {
const getMessages = function getMessages() {
// eslint-disable-next-line no-undef
const unreadChannelsCount = kiwi.state.networks.reduce((count, network) => {
return (count += network.buffers.filter(buffer => {
return !buffer.name.startsWith('*') && buffer.flags.unread !== 0;
}).length);
}, 0);
// eslint-disable-next-line no-undef
const mentionedChannelsCount = kiwi.state.networks.reduce((count, network) => {
return (count += network.buffers.filter(buffer => {
return (
!buffer.name.startsWith('*') &&
buffer.flags.unread !== 0 &&
buffer.flags.highlight
);
}).length);
}, 0);
// set Ferdium badges
Ferdium.setBadge(mentionedChannelsCount, unreadChannelsCount);
};
Ferdium.loop(getMessages);
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};
|