Add State.createServer
This commit is contained in:
parent
5fcbfa446c
commit
bf76eaa669
2 changed files with 18 additions and 12 deletions
13
state.js
13
state.js
|
@ -134,6 +134,7 @@ function insertMessage(list, msg) {
|
|||
return list;
|
||||
}
|
||||
|
||||
var lastServerID = 0;
|
||||
var lastBufferID = 0;
|
||||
|
||||
export const State = {
|
||||
|
@ -208,6 +209,18 @@ export const State = {
|
|||
throw new Error("Invalid buffer ID type: " + (typeof id));
|
||||
}
|
||||
},
|
||||
createServer(state) {
|
||||
lastServerID++;
|
||||
var id = lastServerID;
|
||||
|
||||
var servers = new Map(state.servers);
|
||||
servers.set(id, {
|
||||
id,
|
||||
status: ServerStatus.DISCONNECTED,
|
||||
isupport: new Map(),
|
||||
});
|
||||
return [id, { servers }];
|
||||
},
|
||||
createBuffer(state, name, serverID, client) {
|
||||
var buf = State.getBuffer(state, { server: serverID, name });
|
||||
if (buf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue