Merge pull request #181 from tribut/notification-nick

Add nick to highlight notification from channels
This commit is contained in:
David Cormier 2014-02-24 10:19:42 -05:00
commit dcfc2284ea

View file

@ -815,16 +815,19 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
/* Function gets called from bufferLineAdded code if user should be notified */ /* Function gets called from bufferLineAdded code if user should be notified */
$rootScope.createHighlight = function(buffer, message) { $rootScope.createHighlight = function(buffer, message) {
var title = ''; var title = '';
var body = '';
if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) { if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) {
title = 'Private message from '; title = 'Private message from ';
body = message.text;
} else { } else {
title = 'Highlight in '; title = 'Highlight in ';
body = '<' + message.prefix[0].text + '> ' + message.text;
} }
title += buffer.shortName; title += buffer.shortName;
title += buffer.fullName.replace(/irc.([^\.]+)\..+/, " ($1)"); title += buffer.fullName.replace(/irc.([^\.]+)\..+/, " ($1)");
var notification = new Notification(title, { var notification = new Notification(title, {
body: message.text, body: body,
icon: 'img/favicon.png' icon: 'img/favicon.png'
}); });