]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/ctx.go
exec notification
[nncp.git] / src / ctx.go
index 03fe80e2cff2c73b05d9437b1c725b8d910beb77..8a1146e2b5651f44731cfe7de792ff3388c906a9 100644 (file)
@@ -24,6 +24,8 @@ import (
        "os"
        "path/filepath"
 
+       "syscall"
+
        "golang.org/x/sys/unix"
 )
 
@@ -35,10 +37,12 @@ type Ctx struct {
 
        Spool      string
        LogPath    string
+       UmaskForce *int
        Quiet      bool
        Debug      bool
-       NotifyFile *FromToYAML
-       NotifyFreq *FromToYAML
+       NotifyFile *FromToJSON
+       NotifyFreq *FromToJSON
+       NotifyExec map[string]*FromToJSON
 }
 
 func (ctx *Ctx) FindNode(id string) (*Node, error) {
@@ -113,3 +117,9 @@ func (ctx *Ctx) IsEnoughSpace(want int64) bool {
        }
        return int64(s.Bavail)*int64(s.Bsize) > want
 }
+
+func (ctx *Ctx) Umask() {
+       if ctx.UmaskForce != nil {
+               syscall.Umask(*ctx.UmaskForce)
+       }
+}