Example #1
0
func (pm RegisteredUsers) writeMessage(client *Client) error {
	packet := MumbleProto.UserList{}

	for _, user := range pm {
		if user.deregister || user.changed {
			userListUser := &MumbleProto.UserList_User{
				UserId: &user.UserID,
			}
			if !user.deregister {
				userListUser.Name = &user.Name
			}
			packet.Users = append(packet.Users, userListUser)
		}
	}

	if len(packet.Users) <= 0 {
		return nil
	}
	return client.Conn.WriteProto(&packet)
}
Example #2
0
func (pm RegisteredUsers) writeTo(client *Client, w io.Writer) (int64, error) {
	packet := MumbleProto.UserList{}

	for _, user := range pm {
		if user.deregister || user.changed {
			userListUser := &MumbleProto.UserList_User{
				UserId: &user.userID,
			}
			if !user.deregister {
				userListUser.Name = &user.name
			}
			packet.Users = append(packet.Users, userListUser)
		}
	}

	if len(packet.Users) <= 0 {
		return 0, nil
	}
	proto := protoMessage{&packet}
	return proto.writeTo(client, w)
}