Spectroscopic diagnostics of radio-frequency discharges at moderate pressures