diff --git a/irc/chanserv.go b/irc/chanserv.go index 35099472..81595f57 100644 --- a/irc/chanserv.go +++ b/irc/chanserv.go @@ -541,13 +541,11 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm chname = regInfo.Name account := client.Account() isFounder := account != "" && account == regInfo.Founder - var oper *Oper - if !isFounder { - oper = client.Oper() - if !oper.HasRoleCapab("chanreg") { - service.Notice(rb, client.t("Insufficient privileges")) - return - } + oper := client.Oper() + hasPrivs := oper.HasRoleCapab("chanreg") + if !isFounder && !hasPrivs { + service.Notice(rb, client.t("Insufficient privileges")) + return } target := params[1] targetAccount, err := server.accounts.LoadAccount(params[1]) @@ -569,7 +567,7 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm server.snomasks.Send(sno.LocalOpers, message) server.logger.Info("opers", message) } - status, err := channel.Transfer(client, target, oper != nil) + status, err := channel.Transfer(client, target, hasPrivs) if err == nil { switch status { case channelTransferComplete: diff --git a/irc/database.go b/irc/database.go index bfca9d07..b066a12a 100644 --- a/irc/database.go +++ b/irc/database.go @@ -1080,6 +1080,9 @@ func schemaChangeV21To22(config *Config, tx *buntdb.Tx) error { if !strings.HasPrefix(key, settingsPrefix) { return false } + if value == "" { + return true + } account := strings.TrimPrefix(key, settingsPrefix) if _, err := tx.Get("account.verified " + account); err != nil { return true