Disable receiving file transfers

 * This was recommended in #575 and #576.

 * Also refactor some common code.