Send placeholder when no network/channel is returned by BouncerServ
This commit is contained in:
parent
517be78868
commit
b0b913293e
16
service.go
16
service.go
@ -432,6 +432,7 @@ func handleServiceNetworkCreate(dc *downstreamConn, params []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleServiceNetworkStatus(dc *downstreamConn, params []string) error {
|
func handleServiceNetworkStatus(dc *downstreamConn, params []string) error {
|
||||||
|
n := 0
|
||||||
dc.user.forEachNetwork(func(net *network) {
|
dc.user.forEachNetwork(func(net *network) {
|
||||||
var statuses []string
|
var statuses []string
|
||||||
var details string
|
var details string
|
||||||
@ -465,7 +466,14 @@ func handleServiceNetworkStatus(dc *downstreamConn, params []string) error {
|
|||||||
s += ": " + details
|
s += ": " + details
|
||||||
}
|
}
|
||||||
sendServicePRIVMSG(dc, s)
|
sendServicePRIVMSG(dc, s)
|
||||||
|
|
||||||
|
n++
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
sendServicePRIVMSG(dc, `No network configured, add one with "network create".`)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,6 +762,8 @@ func handleServiceChannelStatus(dc *downstreamConn, params []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n := 0
|
||||||
|
|
||||||
sendNetwork := func(net *network) {
|
sendNetwork := func(net *network) {
|
||||||
for _, entry := range net.channels.innerMap {
|
for _, entry := range net.channels.innerMap {
|
||||||
ch := entry.value.(*Channel)
|
ch := entry.value.(*Channel)
|
||||||
@ -783,6 +793,8 @@ func handleServiceChannelStatus(dc *downstreamConn, params []string) error {
|
|||||||
|
|
||||||
s := fmt.Sprintf("%v [%v]", name, status)
|
s := fmt.Sprintf("%v [%v]", name, status)
|
||||||
sendServicePRIVMSG(dc, s)
|
sendServicePRIVMSG(dc, s)
|
||||||
|
|
||||||
|
n++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,6 +808,10 @@ func handleServiceChannelStatus(dc *downstreamConn, params []string) error {
|
|||||||
sendNetwork(net)
|
sendNetwork(net)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
sendServicePRIVMSG(dc, "No channel configured.")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user