Server address.
Explicitly specified server port, or 0 when unspecified.
Server port.
Evaluates to ConnectionInfo.explicitPort when an explicit port was specified, and ConnectionInfo.defaultPort otherwise.
Security protocol. Is true for TLS/SSL,
and false for no security.
Channels to join immediately after a successful connect. Can be empty.
Key/passphrase to use when joining channels.
Is null when unspecified.
Default port for the specified security protocol.
6697 for TLS/SSL, and 6667 otherwise.
Parse IRC URLs (also known as "chat links").
Channels without a valid prefix are automatically prefixed with '#'.
ConnectionInfo info; info = parse("ircs://irc.example.com:6697/foo,bar"); assert(info.address == "irc.example.com"); assert(info.explicitPort == 6697); assert(info.port == 6697); assert(info.secure); assert(info.channels == ["#foo", "#bar"]); info = parse("irc://irc.example.org/foo?pass"); assert(info.address == "irc.example.org"); assert(info.explicitPort == 0); assert(info.port == 6667); // No explicit port, so it falls back to the default IRC port assert(!info.secure); assert(info.channels == ["#foo"]); assert(info.channelKey == "pass");
Error message.
Location in input (zero-based column) the error occured.
Ranges from 0 .. $ - 1, where the $ symbol is the length of the input.
Boolean whether or not an error occured. If an error did not occur,
message and location will not have meaningful values.
auto error = ParseError("error occured!", 0); assert(error); // conversion to $(D bool)
Same as parse, but returning an error message instead of throwing. Useful for high-volume parsing.
import std.stdio : stderr; auto urls = ["irc://example.com", "ircs://example.org/foo?pass"]; foreach(url; urls) { ConnectionInfo info; if(auto error = url.tryParse(info)) { stderr.writefln("Error parsing URL:\n%s\n%*s\n%s", url, error.location + 1, "^", error.message); continue; } // Use `info` }