mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-19 21:59:59 -08:00
Always show correct name for registered users.
This commit is contained in:
parent
296c94764c
commit
15e88575fc
3 changed files with 8 additions and 25 deletions
16
client.go
16
client.go
|
|
@ -547,19 +547,3 @@ func (client *Client) sendChannelTree(channel *Channel) {
|
||||||
client.sendChannelTree(subchannel)
|
client.sendChannelTree(subchannel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the userlist to a client.
|
|
||||||
func (client *Client) sendUserList() {
|
|
||||||
server := client.server
|
|
||||||
for _, client := range server.clients {
|
|
||||||
err := client.sendProtoMessage(MessageUserState, &mumbleproto.UserState{
|
|
||||||
Session: proto.Uint32(client.Session),
|
|
||||||
Name: proto.String(client.Username),
|
|
||||||
ChannelId: proto.Uint32(0),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Unable to send UserList")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -723,9 +723,9 @@ func (server *Server) handleUserStateMessage(client *Client, msg *Message) {
|
||||||
txtmsg := &mumbleproto.TextMessage{}
|
txtmsg := &mumbleproto.TextMessage{}
|
||||||
txtmsg.TreeId = append(txtmsg.TreeId, uint32(0))
|
txtmsg.TreeId = append(txtmsg.TreeId, uint32(0))
|
||||||
if target.Recording {
|
if target.Recording {
|
||||||
txtmsg.Message = proto.String(fmt.Sprintf("User '%s' started recording", target.Username))
|
txtmsg.Message = proto.String(fmt.Sprintf("User '%s' started recording", target.ShownName()))
|
||||||
} else {
|
} else {
|
||||||
txtmsg.Message = proto.String(fmt.Sprintf("User '%s' stopped recording", target.Username))
|
txtmsg.Message = proto.String(fmt.Sprintf("User '%s' stopped recording", target.ShownName()))
|
||||||
}
|
}
|
||||||
|
|
||||||
server.broadcastProtoMessageWithPredicate(MessageTextMessage, txtmsg, func(client *Client) bool {
|
server.broadcastProtoMessageWithPredicate(MessageTextMessage, txtmsg, func(client *Client) bool {
|
||||||
|
|
|
||||||
13
server.go
13
server.go
|
|
@ -585,20 +585,19 @@ func (server *Server) updateCodecVersions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) sendUserList(client *Client) {
|
func (server *Server) sendUserList(client *Client) {
|
||||||
for _, user := range server.clients {
|
for _, connectedClient := range server.clients {
|
||||||
if user.state != StateClientReady {
|
if connectedClient.state != StateClientReady {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if user == client {
|
if connectedClient == client {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.sendProtoMessage(MessageUserState, &mumbleproto.UserState{
|
err := client.sendProtoMessage(MessageUserState, &mumbleproto.UserState{
|
||||||
Session: proto.Uint32(user.Session),
|
Session: proto.Uint32(connectedClient.Session),
|
||||||
Name: proto.String(user.Username),
|
Name: proto.String(connectedClient.ShownName()),
|
||||||
ChannelId: proto.Uint32(uint32(user.Channel.Id)),
|
ChannelId: proto.Uint32(uint32(connectedClient.Channel.Id)),
|
||||||
})
|
})
|
||||||
log.Printf("ChanId = %v", user.Channel.Id)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Server panic?
|
// Server panic?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue