瀏覽代碼

fix #227

tags/v0.11.0-beta
Shivaram Lingamneni 6 年之前
父節點
當前提交
363b120cc5
共有 1 個檔案被更改,包括 11 行新增6 行删除
  1. 11
    6
      irc/nickserv.go

+ 11
- 6
irc/nickserv.go 查看文件

@@ -193,12 +193,6 @@ func nsDropHandler(server *Server, client *Client, command, params string, rb *R
193 193
 func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
194 194
 	nick, _ := utils.ExtractParam(params)
195 195
 
196
-	account := client.Account()
197
-	if account == "" || server.accounts.NickToAccount(nick) != account {
198
-		nsNotice(rb, client.t("You don't own that nick"))
199
-		return
200
-	}
201
-
202 196
 	ghost := server.clients.Get(nick)
203 197
 	if ghost == nil {
204 198
 		nsNotice(rb, client.t("No such nick"))
@@ -208,6 +202,17 @@ func nsGhostHandler(server *Server, client *Client, command, params string, rb *
208 202
 		return
209 203
 	}
210 204
 
205
+	authorized := false
206
+	account := client.Account()
207
+	if account != "" {
208
+		// the user must either own the nick, or the target client
209
+		authorized = (server.accounts.NickToAccount(nick) == account) || (ghost.Account() == account)
210
+	}
211
+	if !authorized {
212
+		nsNotice(rb, client.t("You don't own that nick"))
213
+		return
214
+	}
215
+
211 216
 	ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick()))
212 217
 	ghost.destroy(false)
213 218
 }

Loading…
取消
儲存