irkerd: Extract username and password from submitted URLs
And use them (when present) as the USER username [1] and server PASS
[2] respectively. The previous implementation gave no way to set
PASS, which will vary on a per-target-server level. There's unlikely
to be much need to set per-server usernames, except collision
avoidance (e.g. network X already has an 'irker' user).
I changed the existing IRCServerConnection.connect argument from
'ircname' to 'realname' to match the USER specs and our
IRCServerConnection.user implementation. The 'realname' and
'username' arguments are currently unset, but you could add command
line options to set irker-wide defaults, and use the kwargs chain to
pass them down to the connect method. The fallback logic is:
* Prefer the setting listed in the URL (although you'd need to add a
parser to extract 'realname'). If that's empty or missing, fall
back to
* The irker-wide default passed down the kwargs chain. If that's
empty or missing, fall back to
* Local defaults ('irker' and 'irker relaying client').
I also tweaked the servername and port extraction in
Target.__init__(), because they are already parsed out of the netloc
(along with the username and password) by urlparse().
[1]: https://tools.ietf.org/html/rfc2812#section-3.1.3
[2]: https://tools.ietf.org/html/rfc2812#section-3.1.1