Fill all fields of the service user prefix
On some IRC clients, NOTICE messages from a user which does not have a user or host in its prefix (and therefore only have a Name, and look like prefixes of servers), are treated as server notices rather than user notices, and are treated differently. (For that matter, soju also considers NOTICE messages from users with only a Name in their prefix as special server messages). On most of these clients, NOTICE messages from a user are formatted differently and stand out from the large flow of incoming misceallenous server messages. This fills the service user with fake User and Host values so that NOTICE messages from it correctly appear as coming from a user. This is particularly useful in the context of connection and disconnect errors NOTICE messages that are broadcast from the service user to all relevant downstreams.
This commit is contained in:
parent
8c11205ee6
commit
4bcfeae5a6
10
service.go
10
service.go
@ -12,6 +12,12 @@ import (
|
|||||||
|
|
||||||
const serviceNick = "BouncerServ"
|
const serviceNick = "BouncerServ"
|
||||||
|
|
||||||
|
var servicePrefix = &irc.Prefix{
|
||||||
|
Name: serviceNick,
|
||||||
|
User: serviceNick,
|
||||||
|
Host: serviceNick,
|
||||||
|
}
|
||||||
|
|
||||||
type serviceCommandSet map[string]*serviceCommand
|
type serviceCommandSet map[string]*serviceCommand
|
||||||
|
|
||||||
type serviceCommand struct {
|
type serviceCommand struct {
|
||||||
@ -23,7 +29,7 @@ type serviceCommand struct {
|
|||||||
|
|
||||||
func sendServiceNOTICE(dc *downstreamConn, text string) {
|
func sendServiceNOTICE(dc *downstreamConn, text string) {
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: &irc.Prefix{Name: serviceNick},
|
Prefix: servicePrefix,
|
||||||
Command: "NOTICE",
|
Command: "NOTICE",
|
||||||
Params: []string{dc.nick, text},
|
Params: []string{dc.nick, text},
|
||||||
})
|
})
|
||||||
@ -31,7 +37,7 @@ func sendServiceNOTICE(dc *downstreamConn, text string) {
|
|||||||
|
|
||||||
func sendServicePRIVMSG(dc *downstreamConn, text string) {
|
func sendServicePRIVMSG(dc *downstreamConn, text string) {
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: &irc.Prefix{Name: serviceNick},
|
Prefix: servicePrefix,
|
||||||
Command: "PRIVMSG",
|
Command: "PRIVMSG",
|
||||||
Params: []string{dc.nick, text},
|
Params: []string{dc.nick, text},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user