Keep track of highlights when user is offline

This commit is contained in:
Pavel Djundik 2016-03-13 18:05:05 +02:00
parent f81235900b
commit 96ef274838
4 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{{#each channels}} {{#each channels}}
<div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}"> <div data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
<span class="badge" data-count="{{unread}}">{{#if unread}}{{unread}}{{/if}}</span> <span class="badge{{#if highlight}} highlight{{/if}}" data-count="{{unread}}">{{#if unread}}{{unread}}{{/if}}</span>
<span class="close"></span> <span class="close"></span>
<span class="name" title="{{name}}">{{name}}</span> <span class="name" title="{{name}}">{{name}}</span>
</div> </div>

View File

@ -320,6 +320,7 @@ Client.prototype.open = function(data) {
var target = this.find(data); var target = this.find(data);
if (target) { if (target) {
target.chan.unread = 0; target.chan.unread = 0;
target.chan.highlight = false;
this.activeChannel = target.chan.id; this.activeChannel = target.chan.id;
} }
}; };

View File

@ -18,6 +18,7 @@ function Chan(attr) {
topic: "", topic: "",
type: Chan.Type.CHANNEL, type: Chan.Type.CHANNEL,
unread: 0, unread: 0,
highlight: false,
users: [] users: []
}, attr)); }, attr));
} }

View File

@ -46,6 +46,10 @@ module.exports = function(irc, network) {
if (chan.id !== client.activeChannel) { if (chan.id !== client.activeChannel) {
chan.unread++; chan.unread++;
if (highlight) {
chan.highlight = true;
}
} }
var name = data.from; var name = data.from;