Applied Nico Erfurth's refactoring patch to spool_mbox.c.