I know it doesn't directly answer your problem, but running thelounge on a node server can do a pretty good job. It supports user-based logins and since it's running as a service, chat history is supported. Currently there's no way to search, but I imagine that could be implemented in the future.