forked from Hri7566/mpp-server-dev2
fix "name" admin message
This commit is contained in:
parent
0d6cf645cf
commit
2076851604
|
@ -383,21 +383,18 @@ module.exports = (cl) => {
|
||||||
|
|
||||||
cl.on('name', (msg, admin) => {
|
cl.on('name', (msg, admin) => {
|
||||||
if (!admin) return;
|
if (!admin) return;
|
||||||
|
|
||||||
if (!msg.hasOwnProperty('_id')) return;
|
if (!msg.hasOwnProperty('_id')) return;
|
||||||
if (!msg.hasOwnProperty('name')) return;
|
if (!msg.hasOwnProperty('name')) return;
|
||||||
|
|
||||||
let c;
|
for (const [mapID, conn] of cl.server.connections) {
|
||||||
|
if (!conn.user) return;
|
||||||
for (const conn of cl.server.connections) {
|
|
||||||
if (conn.user._id == msg._id) {
|
if (conn.user._id == msg._id) {
|
||||||
c = conn;
|
let c = conn;
|
||||||
break;
|
c.userset(msg.name, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c) return;
|
|
||||||
|
|
||||||
c.userset(msg.name, true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,8 @@ class Server extends EventEmitter {
|
||||||
"unsubscribe from admin stream",
|
"unsubscribe from admin stream",
|
||||||
"data",
|
"data",
|
||||||
"channel message",
|
"channel message",
|
||||||
"channel_flag"
|
"channel_flag",
|
||||||
|
"name"
|
||||||
];
|
];
|
||||||
|
|
||||||
this.welcome_motd = config.motd || "You agree to read this message.";
|
this.welcome_motd = config.motd || "You agree to read this message.";
|
||||||
|
|
Loading…
Reference in New Issue