  Mass-loss rates currently in use for hot, massive stars have recently been
seriously questioned, mainly because of the effects of wind clumping. We
investigate the impact of clumping on diagnostic ultraviolet resonance and
optical recombination lines. Optically thick clumps, a non-void interclump
medium, and a non-monotonic velocity field are all accounted for in a single
model. We used 2D and 3D stochastic and radiation-hydrodynamic (RH) wind
models, constructed by assembling 1D snapshots in radially independent slices.
To compute synthetic spectra, we developed and used detailed radiative transfer
codes for both recombination lines (solving the "formal integral") and
resonance lines (using a Monte-Carlo approach). In addition, we propose an
analytic method to model these lines in clumpy winds, which does not rely on
optically thin clumping. Results: Synthetic spectra calculated directly from
current RH wind models of the line-driven instability are unable to in parallel
reproduce strategic optical and ultraviolet lines for the Galactic O-supergiant
LCep. Using our stochastic wind models, we obtain consistent fits essentially
by increasing the clumping in the inner wind. A mass-loss rate is derived that
is approximately two times lower than predicted by the line-driven wind theory,
but much higher than the corresponding rate derived from spectra when assuming
optically thin clumps. Our analytic formulation for line formation is used to
demonstrate the potential impact of optically thick clumping in weak-winded
stars and to confirm recent results that resonance doublets may be used as
tracers of wind structure and optically thick clumping. (Abridged)
