lib/model: Add option for overwriting names on connect (fixes #2912)

This commit is contained in:
Audrius Butkevicius
2016-04-09 07:43:47 +00:00
committed by Jakob Borg
parent 2eb8a9ef56
commit 4389bb037d
5 changed files with 18 additions and 1 deletions

View File

@@ -1007,7 +1007,7 @@ func (m *Model) AddConnection(conn Connection, hello protocol.HelloMessage) {
l.Infof(`Device %s client is "%s %s" named "%s"`, deviceID, hello.ClientName, hello.ClientVersion, hello.DeviceName)
device, ok := m.cfg.Devices()[deviceID]
if ok && device.Name == "" {
if ok && (device.Name == "" || m.cfg.Options().OverwriteNames) {
device.Name = hello.DeviceName
m.cfg.SetDevice(device)
m.cfg.Save()