瀏覽代碼

KILL: Make reason optional, to match other ircds

tags/v0.1.0
Daniel Oaks 7 年之前
父節點
當前提交
969eed394f
共有 2 個檔案被更改,包括 5 行新增2 行删除
  1. 1
    1
      irc/commands.go
  2. 4
    1
      irc/server.go

+ 1
- 1
irc/commands.go 查看文件

@@ -85,7 +85,7 @@ var Commands = map[string]Command{
85 85
 	},
86 86
 	"KILL": {
87 87
 		handler:   killHandler,
88
-		minParams: 2,
88
+		minParams: 1,
89 89
 		oper:      true,
90 90
 	},
91 91
 	"LIST": {

+ 4
- 1
irc/server.go 查看文件

@@ -1117,7 +1117,10 @@ func timeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1117 1117
 // KILL <nickname> <comment>
1118 1118
 func killHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1119 1119
 	nickname := msg.Params[0]
1120
-	comment := msg.Params[1]
1120
+	comment := "<no reason supplied>"
1121
+	if len(msg.Params) > 1 {
1122
+		comment = msg.Params[1]
1123
+	}
1121 1124
 
1122 1125
 	target := server.clients.Get(Name(nickname))
1123 1126
 	if target == nil {

Loading…
取消
儲存