diff --git a/irc/dline.go b/irc/dline.go index 0b53b552..b1e5e56f 100644 --- a/irc/dline.go +++ b/irc/dline.go @@ -213,6 +213,7 @@ func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo) { } // DLINE [ANDKILL] [MYSELF] [duration] / [ON ] [reason [| oper reason]] +// DLINE LIST func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool { // check oper permissions if !client.class.Capabilities["oper:local_ban"] { @@ -222,6 +223,21 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool { currentArg := 0 + // if they say LIST, we just list the current dlines + if len(msg.Params) == currentArg+1 && strings.ToLower(msg.Params[currentArg]) == "list" { + bans := server.dlines.AllBans() + + if len(bans) == 0 { + client.Notice("No DLINEs have been set!") + } + + for key, info := range bans { + client.Notice(fmt.Sprintf("Ban - %s - %s", key, info.BanMessage("%s"))) + } + + return false + } + // when setting a ban, if they say "ANDKILL" we should also kill all users who match it var andKill bool if len(msg.Params) > currentArg+1 && strings.ToLower(msg.Params[currentArg]) == "andkill" { diff --git a/irc/help.go b/irc/help.go index 40ad6cb1..a83b1711 100644 --- a/irc/help.go +++ b/irc/help.go @@ -150,6 +150,7 @@ Prints debug information about the IRCd.