Simplify usage reporting config options (fixes #370)

This commit is contained in:
Jakob Borg
2014-06-17 23:22:19 +02:00
parent d09c71b688
commit b05fcbc9d7
8 changed files with 49 additions and 46 deletions

View File

@@ -16,9 +16,9 @@ import (
"strconv"
"strings"
"github.com/calmh/syncthing/scanner"
"code.google.com/p/go.crypto/bcrypt"
"github.com/calmh/syncthing/logger"
"github.com/calmh/syncthing/scanner"
)
var l = logger.DefaultLogger
@@ -156,11 +156,10 @@ type OptionsConfiguration struct {
MaxChangeKbps int `xml:"maxChangeKbps" default:"10000"`
StartBrowser bool `xml:"startBrowser" default:"true"`
UPnPEnabled bool `xml:"upnpEnabled" default:"true"`
URAccepted int `xml:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently)
UREnabled bool `xml:"urEnabled"` // If true, send usage reporting data
URDeclined bool `xml:"urDeclined"` // If true, don't ask again
URAccepted int `xml:"urAccepted"` // Accepted usage reporting version
Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"`
Deprecated_URDeclined bool `xml:"urDeclined,omitempty" json:"-"`
Deprecated_ReadOnly bool `xml:"readOnly,omitempty" json:"-"`
Deprecated_GUIEnabled bool `xml:"guiEnabled,omitempty" json:"-"`
Deprecated_GUIAddress string `xml:"guiAddress,omitempty" json:"-"`
@@ -345,6 +344,12 @@ func Load(rd io.Reader, myID string) (Configuration, error) {
}
}
if cfg.Options.Deprecated_URDeclined {
cfg.Options.URAccepted = -1
}
cfg.Options.Deprecated_URDeclined = false
cfg.Options.Deprecated_UREnabled = false
// Upgrade to v2 configuration if appropriate
if cfg.Version == 1 {
convertV1V2(&cfg)