Track channel join times, use them to optionally enforce history access
restrictions
This commit is contained in:
Shivaram Lingamneni 2021-01-20 21:13:18 -05:00
parent 0d0fb87857
commit 4a48e52518
12 changed files with 274 additions and 92 deletions

View file

@ -985,8 +985,8 @@ func extjwtHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
claims["channel"] = channel.Name()
claims["joined"] = 0
claims["cmodes"] = []string{}
if present, cModes := channel.ClientStatus(client); present {
claims["joined"] = 1
if present, joinTimeSecs, cModes := channel.ClientStatus(client); present {
claims["joined"] = joinTimeSecs
var modeStrings []string
for _, cMode := range cModes {
modeStrings = append(modeStrings, string(cMode))
@ -2649,7 +2649,7 @@ func renameHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
}
config := server.Config()
status, _ := channel.historyStatus(config)
status, _, _ := channel.historyStatus(config)
if status == HistoryPersistent {
rb.Add(nil, server.name, "FAIL", "RENAME", "CANNOT_RENAME", oldName, utils.SafeErrorParam(newName), client.t("Channels with persistent history cannot be renamed"))
return false