Refactor: we had three similar functions, refactored into just one.

Also, these functions returned false, or a string containing the type,
but the string was only used to indirectly mean a true value; now
we explicitely return true in this case.

Signed-off-by: Marc Delisle <marc@infomarc.info>