Browse Source

Add more information about the folders to ClusterConfig

Audrius Butkevicius 10 years ago
parent
commit
9f4cd7716e
3 changed files with 20 additions and 1 deletions
  1. 12 0
      lib/model/model.go
  2. 7 0
      lib/protocol/protocol.go
  3. 1 1
      lib/relay/protocol/packets.go

+ 12 - 0
lib/model/model.go

@@ -1479,9 +1479,21 @@ func (m *Model) clusterConfig(device protocol.DeviceID) protocol.ClusterConfigMe
 
 	m.fmut.RLock()
 	for _, folder := range m.deviceFolders[device] {
+		folderCfg := m.cfg.Folders()[folder]
 		cr := protocol.Folder{
 			ID: folder,
 		}
+		var flags uint32
+		if folderCfg.ReadOnly {
+			flags |= protocol.FlagFolderReadOnly
+		}
+		if folderCfg.IgnorePerms {
+			flags |= protocol.FlagFolderIgnorePerms
+		}
+		if folderCfg.IgnoreDelete {
+			flags |= protocol.FlagFolderIgnoreDelete
+		}
+		cr.Flags = flags
 		for _, device := range m.folderDevices[folder] {
 			// DeviceID is a value type, but with an underlying array. Copy it
 			// so we don't grab aliases to the same array later on in device[:]

+ 7 - 0
lib/protocol/protocol.go

@@ -61,6 +61,13 @@ const (
 	FlagRequestTemporary uint32 = 1 << iota
 )
 
+// ClusterConfigMessage.Folders flags
+const (
+	FlagFolderReadOnly     uint32 = 1 << 0
+	FlagFolderIgnorePerms         = 1 << 1
+	FlagFolderIgnoreDelete        = 1 << 2
+)
+
 // ClusterConfigMessage.Folders.Devices flags
 const (
 	FlagShareTrusted  uint32 = 1 << 0

+ 1 - 1
lib/relay/protocol/packets.go

@@ -1,6 +1,6 @@
 // Copyright (C) 2015 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file).
 
-//go:generate -command genxdr go run ../../syncthing/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go
+//go:generate -command genxdr go run ../../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go
 //go:generate genxdr -o packets_xdr.go packets.go
 
 package protocol