parent
73123fd0dd
commit
ceceac78a2
3 changed files with 19 additions and 4 deletions
|
@ -248,6 +248,11 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', 'notific
|
|||
// Update indentation status
|
||||
old.type = localvars.type;
|
||||
old.indent = (['channel', 'private'].indexOf(localvars.type) >= 0);
|
||||
// Update serverSortKey and related variables
|
||||
old.plugin = localvars.plugin;
|
||||
old.server = localvars.server;
|
||||
old.serverSortKey = old.plugin + "." + old.server +
|
||||
(old.type === "server" ? "" : ("." + old.shortName));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
13
js/models.js
13
js/models.js
|
@ -84,13 +84,22 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
|||
var notification = 0;
|
||||
var unread = 0;
|
||||
var lastSeen = -1;
|
||||
var serverSortKey = fullName.replace(/^irc\.server\.(\w+)/, "irc.$1").toLowerCase();
|
||||
// There are two kinds of types: bufferType (free vs formatted) and
|
||||
// the kind of type that distinguishes queries from channels etc
|
||||
var bufferType = message.type;
|
||||
var type = message.local_variables.type;
|
||||
var indent = (['channel', 'private'].indexOf(type) >= 0);
|
||||
|
||||
var plugin = message.local_variables.plugin;
|
||||
var server = message.local_variables.server;
|
||||
// Server buffers have this "irc.server.freenode" naming schema, which
|
||||
// messes the sorting up. We need it to be "irc.freenode" instead.
|
||||
var serverSortKey = plugin + "." + server +
|
||||
(type === "server" ? "" : ("." + shortName));
|
||||
// Lowercase it so alt+up/down traverses buffers in the same order
|
||||
// angular's sortBy directive puts them in
|
||||
serverSortKey = serverSortKey.toLowerCase();
|
||||
|
||||
// Buffer opened message does not include notify level
|
||||
if (message.notify !== undefined) {
|
||||
notify = message.notify;
|
||||
|
@ -316,6 +325,8 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
|
|||
indent: indent,
|
||||
bufferType: bufferType,
|
||||
type: type,
|
||||
plugin: plugin,
|
||||
server: server,
|
||||
history: history,
|
||||
addToHistory: addToHistory,
|
||||
getHistoryUp: getHistoryUp,
|
||||
|
|
|
@ -83,7 +83,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
|||
var body = '';
|
||||
var numNotifications = buffer.notification;
|
||||
|
||||
if (['#', '&', '+', '!'].indexOf(buffer.shortName.charAt(0)) < 0) {
|
||||
if (buffer.type === "private") {
|
||||
if (numNotifications > 1) {
|
||||
title = numNotifications.toString() + ' private messages from ';
|
||||
} else {
|
||||
|
@ -102,8 +102,7 @@ weechat.factory('notifications', ['$rootScope', '$log', 'models', 'settings', fu
|
|||
}
|
||||
body = '<' + prefix + '> ' + message.text;
|
||||
}
|
||||
title += buffer.shortName;
|
||||
title += buffer.fullName.replace(/irc.([^\.]+)\..+/, " ($1)");
|
||||
title += buffer.shortName + " (" + buffer.server + ")";
|
||||
|
||||
var notification = new Notification(title, {
|
||||
body: body,
|
||||
|
|
Loading…
Reference in a new issue