Add support for queries

See https://github.com/znc/znc/pull/598