Show errors in current window

This commit is contained in:
Mattias Erming 2014-06-13 13:22:03 +02:00
parent 9f5d3807ec
commit 047f8b0302
3 changed files with 11 additions and 13 deletions

View File

@ -265,6 +265,7 @@ button {
color: #bbb; color: #bbb;
} }
#chat .action .type, #chat .action .type,
#chat .error .type,
#chat .highlight .type, #chat .highlight .type,
#chat .motd .type, #chat .motd .type,
#chat .normal .type, #chat .normal .type,
@ -278,6 +279,8 @@ button {
#chat .action .user:before { #chat .action .user:before {
content: '* '; content: '* ';
} }
#chat .error,
#chat .error .from a,
#chat .highlight, #chat .highlight,
#chat .highlight .from a { #chat .highlight .from a {
color: #f00; color: #f00;

View File

@ -77,7 +77,8 @@ $(function() {
case "messages": case "messages":
case "msg": case "msg":
var target = $("#window-" + data.id).find(".messages"); var target = (data.id ? $("#window-" + data.id) : $("#chat .active"))
.find(".messages");
var html = render( var html = render(
"messages", "messages",
{messages: toArray(data.msg)} {messages: toArray(data.msg)}
@ -122,10 +123,7 @@ $(function() {
case "users": case "users":
var target = $("#window-" + data.id); var target = $("#window-" + data.id);
var json = { var json = {name: target.find("h1").html(), users: data.users};
name: target.find("h1").html(),
users: data.users
};
target.find(".meta") target.find(".meta")
.replaceWith(render("meta", json)) .replaceWith(render("meta", json))
.end(); .end();

View File

@ -652,15 +652,12 @@ function event(e, data) {
case "whois": case "whois":
if (!data) { if (!data) {
var chan = channels[0];
var msg = new Msg({
type: "error",
text: "No such nick/channel.",
});
chan.messages.push(msg);
sockets.emit("msg", { sockets.emit("msg", {
id: chan.id, msg: new Msg({
msg: msg, type: "error",
from: "-!-",
text: "No such nick/channel.",
}),
}); });
} else { } else {
var chan = _.findWhere(channels, {name: data.nickname}); var chan = _.findWhere(channels, {name: data.nickname});