3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

xline: Add snomasks for setting/removing xlines

This commit is contained in:
Daniel Oaks 2017-06-11 10:17:55 -06:00
parent 5c725bb622
commit 5b3cea8b98
2 changed files with 10 additions and 0 deletions

View File

@ -319,11 +319,15 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
server.dlines.AddNetwork(*hostNet, banTime, reason, operReason)
}
var snoDescription string
if durationIsUsed {
client.Notice(fmt.Sprintf("Added temporary (%s) D-Line for %s", duration.String(), hostString))
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s$r added temporary (%s) D-Line for %s"), client.nick, duration.String(), hostString)
} else {
client.Notice(fmt.Sprintf("Added D-Line for %s", hostString))
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s$r added D-Line for %s"), client.nick, hostString)
}
server.snomasks.Send(sno.LocalXline, snoDescription)
var killClient bool
if andKill {
@ -423,6 +427,7 @@ func unDLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
}
client.Notice(fmt.Sprintf("Removed D-Line for %s", hostString))
server.snomasks.Send(sno.LocalXline, fmt.Sprintf(ircfmt.Unescape("%s$r removed D-Line for %s"), client.nick, hostString))
return false
}

View File

@ -230,11 +230,15 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
server.klines.AddMask(mask, banTime, reason, operReason)
var snoDescription string
if durationIsUsed {
client.Notice(fmt.Sprintf("Added temporary (%s) K-Line for %s", duration.String(), mask))
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s$r added temporary (%s) K-Line for %s"), client.nick, duration.String(), mask)
} else {
client.Notice(fmt.Sprintf("Added K-Line for %s", mask))
snoDescription = fmt.Sprintf(ircfmt.Unescape("%s$r added K-Line for %s"), client.nick, mask)
}
server.snomasks.Send(sno.LocalXline, snoDescription)
var killClient bool
if andKill {
@ -311,6 +315,7 @@ func unKLineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
server.klines.RemoveMask(mask)
client.Notice(fmt.Sprintf("Removed K-Line for %s", mask))
server.snomasks.Send(sno.LocalXline, fmt.Sprintf(ircfmt.Unescape("%s$r removed K-Line for %s"), client.nick, mask))
return false
}