Send network settings in LISTNETWORKS
This commit is contained in:
parent
60c566e721
commit
29ad541ac7
@ -1993,8 +1993,34 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
attrs := irc.Tags{
|
attrs := irc.Tags{
|
||||||
"name": irc.TagValue(network.GetName()),
|
"name": irc.TagValue(network.GetName()),
|
||||||
"state": irc.TagValue(state),
|
"state": irc.TagValue(state),
|
||||||
|
"nickname": irc.TagValue(network.Nick),
|
||||||
|
}
|
||||||
|
|
||||||
|
if network.Username != "" {
|
||||||
|
attrs["username"] = irc.TagValue(network.Username)
|
||||||
|
}
|
||||||
|
if network.Realname != "" {
|
||||||
|
attrs["realname"] = irc.TagValue(network.Realname)
|
||||||
|
}
|
||||||
|
|
||||||
|
if u, err := network.URL(); err == nil {
|
||||||
|
hasHostPort := true
|
||||||
|
switch u.Scheme {
|
||||||
|
case "ircs":
|
||||||
|
attrs["tls"] = irc.TagValue("1")
|
||||||
|
case "irc+insecure":
|
||||||
|
attrs["tls"] = irc.TagValue("0")
|
||||||
|
default:
|
||||||
|
hasHostPort = false
|
||||||
|
}
|
||||||
|
if host, port, err := net.SplitHostPort(u.Host); err == nil && hasHostPort {
|
||||||
|
attrs["host"] = irc.TagValue(host)
|
||||||
|
attrs["port"] = irc.TagValue(port)
|
||||||
|
} else if hasHostPort {
|
||||||
|
attrs["host"] = irc.TagValue(u.Host)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
|
Loading…
Reference in New Issue
Block a user