Electromagnetic transitions of the hydrogen atom in a magnetic field by the Lagrange-mesh method