Show errors in current window

This commit is contained in:
Mattias Erming 2014-03-15 17:14:05 +01:00
parent be945fe4de
commit 5eefa31400
2 changed files with 23 additions and 16 deletions

View file

@ -59,8 +59,12 @@ $(function() {
break;
case "MESSAGES":
var message = data.data;
if (message.type == "error") {
target = target.parent().find(".active");
}
target = target.find(".messages");
target.append(Mustache.render(messages, {messages: data.data}));
target.append(Mustache.render(messages, {messages: message}));
break;
}
}

View file

@ -231,10 +231,11 @@ function handleInput(input) {
default:
channel.get("messages").add(
new models.Message({
text: "Unknown command: `/" + cmd + "`",
text: cmd + " Unknown command",
type: "error"
})
);
break;
}
}
@ -353,7 +354,10 @@ function handleEvent(argv) {
var messages = channel.get("messages");
var user = users.findWhere({name: argv.nick});
if (typeof user !== "undefined") {
if (typeof user === "undefined") {
return;
}
user.set("name", argv.args[0]);
users.sort();
@ -366,7 +370,6 @@ function handleEvent(argv) {
text: "changed name to " + argv.args[0],
type: "nick"
}));
}
});
if (argv.nick == network.get("nick")) {
@ -555,7 +558,7 @@ function handleEvent(argv) {
var args = argv.args;
channels.first().get("messages").add(
new models.Message({
text: args[args.length - 1],
text: args[args.length - 2].toUpperCase() + " " + args[args.length - 1],
type: "error"
})
);