mirror of
https://github.com/jech/galene.git
synced 2024-11-14 04:35:57 +01:00
Restructure user notifications.
This commit is contained in:
parent
b6adc0b9a8
commit
bc7bd36ba2
2 changed files with 17 additions and 7 deletions
|
@ -678,7 +678,7 @@ function serverConnect() {
|
||||||
gotPermissions(m.permissions);
|
gotPermissions(m.permissions);
|
||||||
break;
|
break;
|
||||||
case 'user':
|
case 'user':
|
||||||
gotUser(m.id, m.username, m.del);
|
gotUser(m.id, m.kind, m.username);
|
||||||
break;
|
break;
|
||||||
case 'chat':
|
case 'chat':
|
||||||
addToChatbox(m.id, m.username, m.kind, m.value);
|
addToChatbox(m.id, m.username, m.kind, m.value);
|
||||||
|
@ -900,11 +900,18 @@ function resetUsers() {
|
||||||
delUser(id, users[id]);
|
delUser(id, users[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotUser(id, name, del) {
|
function gotUser(id, kind, name) {
|
||||||
if(del)
|
switch(kind) {
|
||||||
delUser(id, name);
|
case 'add':
|
||||||
else
|
|
||||||
addUser(id, name);
|
addUser(id, name);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
delUser(id, name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.warn('Unknown user kind', kind);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayUsername() {
|
function displayUsername() {
|
||||||
|
|
|
@ -112,11 +112,15 @@ func (c *webClient) Credentials() clientCredentials {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *webClient) pushClient(id, username string, add bool) error {
|
func (c *webClient) pushClient(id, username string, add bool) error {
|
||||||
|
kind := "add"
|
||||||
|
if !add {
|
||||||
|
kind = "delete"
|
||||||
|
}
|
||||||
return c.write(clientMessage{
|
return c.write(clientMessage{
|
||||||
Type: "user",
|
Type: "user",
|
||||||
|
Kind: kind,
|
||||||
Id: id,
|
Id: id,
|
||||||
Username: username,
|
Username: username,
|
||||||
Del: !add,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +185,6 @@ type clientMessage struct {
|
||||||
Candidate *webrtc.ICECandidateInit `json:"candidate,omitempty"`
|
Candidate *webrtc.ICECandidateInit `json:"candidate,omitempty"`
|
||||||
Renegotiate bool `json:"renegotiate,omitempty"`
|
Renegotiate bool `json:"renegotiate,omitempty"`
|
||||||
Labels map[string]string `json:"labels,omitempty"`
|
Labels map[string]string `json:"labels,omitempty"`
|
||||||
Del bool `json:"del,omitempty"`
|
|
||||||
Request rateMap `json:"request,omitempty"`
|
Request rateMap `json:"request,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue