Maintain backwards compatibility by sending symbols to the client

This commit is contained in:
Pavel Djundik 2016-03-11 18:34:50 +02:00 committed by Maxime Poulin
parent b6993f6e37
commit dff6eb33c5
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,4 @@
var _ = require("lodash");
var identd = require("../../identd");
var Msg = require("../../models/msg");
@ -58,6 +59,12 @@ module.exports = function(irc, network) {
return;
}
network.prefixLookup = {};
_.each(data.options.PREFIX, function(mode) {
network.prefixLookup[mode.mode] = mode.symbol;
});
network.serverOptions.PREFIX = data.options.PREFIX;
client.emit("network_changed", {

View File

@ -10,7 +10,14 @@ module.exports = function(irc, network) {
}
chan.users = [];
_.each(data.users, function(u) {
chan.users.push(new User(u));
var user = new User(u);
// irc-framework sets characater mode, but lounge works with symbols
if (user.mode) {
user.mode = network.prefixLookup[user.mode];
}
chan.users.push(user);
});
chan.sortUsers();
client.emit("users", {