Address many review comments (see body of commit message)

Clean-up and slightly optimise the index fsm to not recalculate
the same list length more than once. Shortcut sending the `stop_fold`
message where possible (i.e. when we notice the have enough results).

Add JSON error to 2i HTTP strem
Update all copyright notices
Normalise boolean paramters to strict true | false
Rename key fold to general fold, since it does objects too now