mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-09 04:23:01 -05:00
Rooms can now expire
Rooms send |expire| when they expire; this means that the room no longer exists server-side but the client might want to leave the room open.
This commit is contained in:
parent
89aeb2ecaa
commit
d03bea97af
|
|
@ -23,7 +23,10 @@
|
|||
updateUser: function() {
|
||||
var name = app.user.get('name');
|
||||
var userid = app.user.get('userid');
|
||||
if (!name) {
|
||||
if (this.expired) {
|
||||
this.$chatAdd.html('This room is expired');
|
||||
this.$chatbox = null;
|
||||
} else if (!name) {
|
||||
this.$chatAdd.html('Connecting...');
|
||||
this.$chatbox = null;
|
||||
} else if (!app.user.get('named')) {
|
||||
|
|
|
|||
13
js/client.js
13
js/client.js
|
|
@ -782,8 +782,21 @@
|
|||
} else {
|
||||
this.joinRoom(roomid, roomType, true);
|
||||
}
|
||||
} else if ((data+'|').substr(0,8) === '|expire|') {
|
||||
var room = this.rooms[roomid];
|
||||
if (room) {
|
||||
room.expired = true;
|
||||
if (room.updateUser) room.updateUser();
|
||||
}
|
||||
return;
|
||||
} else if ((data+'|').substr(0,8) === '|deinit|' || (data+'|').substr(0,8) === '|noinit|') {
|
||||
if (!roomid) roomid = 'lobby';
|
||||
|
||||
if (this.rooms[roomid] && this.rooms[roomid].expired) {
|
||||
// expired rooms aren't closed when left
|
||||
return;
|
||||
}
|
||||
|
||||
var isdeinit = (data.charAt(1) === 'd');
|
||||
data = data.substr(8);
|
||||
var pipeIndex = data.indexOf('|');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user