forked from Hri7566/mpp-server-dev2
trying to debug some bugs
This commit is contained in:
parent
68957ec324
commit
cd71430087
|
@ -78,6 +78,7 @@ module.exports = (cl) => {
|
|||
cl.channel.playNote(cl, msg);
|
||||
})
|
||||
cl.on('+ls', msg => {
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
cl.server.roomlisteners.set(cl.connectionid, cl);
|
||||
let rooms = [];
|
||||
for (let room of Array.from(cl.server.rooms.values())) {
|
||||
|
@ -94,9 +95,11 @@ module.exports = (cl) => {
|
|||
}])
|
||||
})
|
||||
cl.on('-ls', msg => {
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
cl.server.roomlisteners.delete(cl.connectionid);
|
||||
})
|
||||
cl.on("userset", msg => {
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
if (!msg.hasOwnProperty("set") || !msg.set) msg.set = {};
|
||||
if (msg.set.hasOwnProperty('name') && typeof msg.set.name == "string") {
|
||||
if (msg.set.name.length > 40) return;
|
||||
|
@ -107,6 +110,7 @@ module.exports = (cl) => {
|
|||
if (!dbentry) return;
|
||||
dbentry.name = msg.set.name;
|
||||
user.updatedb();
|
||||
console.log("Updateing user ", usr.name, msg.set.name);
|
||||
cl.server.rooms.forEach((room) => {
|
||||
room.updateParticipant(cl.participantId, msg.set.name);
|
||||
})
|
||||
|
|
|
@ -50,7 +50,6 @@ class Room extends EventEmitter {
|
|||
}
|
||||
this.ppl.set(participantId, cl);
|
||||
this.connections.push(cl);
|
||||
|
||||
this.sendArray([{
|
||||
color: this.ppl.get(cl.participantId).user.color,
|
||||
id: this.ppl.get(cl.participantId).participantId,
|
||||
|
@ -64,7 +63,6 @@ class Room extends EventEmitter {
|
|||
m: "c",
|
||||
c: this.chatmsgs.slice(-1 * 32)
|
||||
}])
|
||||
console.log("trying send chat", this.chatmsgs.slice(-1 * 32))
|
||||
this.updateCh(cl);
|
||||
} else {
|
||||
cl.user.id = otheruser.participantId;
|
||||
|
|
|
@ -18,7 +18,7 @@ class User {
|
|||
"_id": _id,
|
||||
"ip": this.cl.ip
|
||||
});
|
||||
console.log("Set database", user.name, user._id)
|
||||
console.log("Set database", _id)
|
||||
this.updatedb();
|
||||
}
|
||||
let user = this.userdb.get(_id);
|
||||
|
|
Loading…
Reference in New Issue