mirror of https://github.com/dirtbags/moth.git
Changing some function names
This commit is contained in:
parent
4093797899
commit
22a646e200
|
@ -33,7 +33,7 @@ func (state *LegacyMOTHState) Initialize() (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (state *LegacyMOTHState) login(teamName string, token string) (bool, error) {
|
func (state *LegacyMOTHState) login(teamName string, token string) (bool, error) {
|
||||||
for a, _ := range state.getTeams() {
|
for a, _ := range state.getTeamIds() {
|
||||||
if a == token {
|
if a == token {
|
||||||
f, err := os.OpenFile(state.StatePath("teams", token), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
|
f, err := os.OpenFile(state.StatePath("teams", token), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -181,7 +181,7 @@ func (state *LegacyMOTHState) Maintenance(maintenanceInterval time.Duration) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (state *LegacyMOTHState) getTeams() map[string]struct{} {
|
func (state *LegacyMOTHState) getTeamIds() map[string]struct{} {
|
||||||
filepath := state.StatePath("teamids.txt")
|
filepath := state.StatePath("teamids.txt")
|
||||||
teamids, err := os.Open(filepath)
|
teamids, err := os.Open(filepath)
|
||||||
teams := make(map[string]struct{})
|
teams := make(map[string]struct{})
|
||||||
|
|
|
@ -146,7 +146,7 @@ func (ctx *Instance) tidy() {
|
||||||
// readTeams reads in the list of team IDs,
|
// readTeams reads in the list of team IDs,
|
||||||
// so we can quickly validate them.
|
// so we can quickly validate them.
|
||||||
func (ctx *Instance) readTeams() {
|
func (ctx *Instance) readTeams() {
|
||||||
teamList := ctx.State.getTeams()
|
teamList := ctx.State.getTeamIds()
|
||||||
|
|
||||||
// For any new team IDs, set their next attempt time to right now
|
// For any new team IDs, set their next attempt time to right now
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
|
@ -11,7 +11,7 @@ type MOTHState interface {
|
||||||
TeamName(teamId string) (string, error)
|
TeamName(teamId string) (string, error)
|
||||||
isEnabled() bool
|
isEnabled() bool
|
||||||
getConfig(configName string) (string, error)
|
getConfig(configName string) (string, error)
|
||||||
getTeams() map[string]struct{}
|
getTeamIds() map[string]struct{}
|
||||||
login(teamId string, token string) (bool, error)
|
login(teamId string, token string) (bool, error)
|
||||||
Initialize() (bool, error)
|
Initialize() (bool, error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue