Hostmask string to examine.
The current IRCServer with its IRCServer.CaseMapping.
true if the hostmask seems to be valid, false if it obviously is not.
IRCServer server; { immutable hostmask = "*!*@*"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "nick123`!*@*"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "*!~ident0-9_@*"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "*!ident0-9_@*"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "*!~~ident0-9_@*"; assert(!hostmask.isValidHostmask(server)); } { immutable hostmask = "*!*@address.tld.net"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "*!*@~address.tld.net"; assert(!hostmask.isValidHostmask(server)); } { immutable hostmask = "*!*@2001::ff:09:ff"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "kameloso!~kameloso@2001*"; assert(hostmask.isValidHostmask(server)); } { immutable hostmask = "harbl*!~dolmen@*"; assert(hostmask.isValidHostmask(server)); }
Makes a cursory verification of a hostmask, ensuring that it doesn't contain invalid characters. May very well have false positives.