From f12d53de63112af8f5132f3f90736f0f450d178e Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 28 Mar 2016 19:29:48 -0400 Subject: [PATCH] Removed haspassword Former-commit-id: 4670fa4a1dc343c501f8f76421fa51b54d450cd3 [formerly e3b56e6823a77a388881b388f8f7fff348c04cba] [formerly e8bd41425d5b0a377d0ff687fcead01cab38c98c [formerly 4ffcc1abd5338b0253db15b222afb9ac10a64991]] Former-commit-id: 0850667d5b0245328ca38933359006101d14e9d6 [formerly e7643ddbfe5ec74936760a4b6ffbaeeb71a93275] Former-commit-id: be2765befe8951bc772c0c04a0583911446c8bb7 --- db.go | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/db.go b/db.go index 0f243da..4d31bb8 100644 --- a/db.go +++ b/db.go @@ -43,43 +43,6 @@ type WikiData struct { Locked string } -func hasPassword(title string) (bool, error) { - title = strings.ToLower(title) - if !open { - Open(RuntimeArgs.DatabaseLocation) - defer Close() - } - hasPassword := false - err := db.View(func(tx *bolt.Tx) error { - var err error - b := tx.Bucket([]byte("datas")) - if b == nil { - return fmt.Errorf("db must be opened before loading") - } - k := []byte(title) - val := b.Get(k) - if val == nil { - return nil - } - var p WikiData - err = p.decode(val) - if err != nil { - return err - } - for _, line := range strings.Split(p.CurrentText, "\n") { - if strings.Contains(line, "<") == true && strings.Contains(line, ">") == true && strings.Contains(line, "user") == true && strings.Contains(line, "password") == true && strings.Contains(line, "public") == true { - hasPassword = true - } - } - return nil - }) - if err != nil { - fmt.Printf("Could not get WikiData: %s", err) - return false, err - } - return hasPassword, nil -} - func getCurrentText(title string, version int) (string, []versionsInfo, bool, time.Duration, bool, string) { Open(RuntimeArgs.DatabaseLocation) defer Close()