From: Sergey Matveev Date: Sun, 13 Jul 2025 07:23:39 +0000 (+0300) Subject: Use an updated recfile library X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=4e0c4c57f3a29eaadd0d5e4130891be55d0576d8;p=mmc.git Use an updated recfile library --- diff --git a/cmd/mmc/post.go b/cmd/mmc/post.go index f16ae78..660618f 100644 --- a/cmd/mmc/post.go +++ b/cmd/mmc/post.go @@ -26,7 +26,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/mattermost/mattermost-server/v6/model" - "go.cypherpunks.su/recfile/v2" + "go.cypherpunks.su/recfile/v3" "go.stargrave.org/mmc/internal" ) diff --git a/cmd/rd/main.go b/cmd/rd/main.go index 297ac29..4b39359 100644 --- a/cmd/rd/main.go +++ b/cmd/rd/main.go @@ -28,7 +28,7 @@ import ( "github.com/fsnotify/fsnotify" "github.com/mattermost/mattermost-server/v6/model" - "go.cypherpunks.su/recfile/v2" + "go.cypherpunks.su/recfile/v3" "go.stargrave.org/mmc/internal" ) diff --git a/cmd/sb/main.go b/cmd/sb/main.go index 47f9388..ccfdf09 100644 --- a/cmd/sb/main.go +++ b/cmd/sb/main.go @@ -25,7 +25,7 @@ import ( "github.com/mattermost/mattermost-server/v6/model" "go.cypherpunks.su/netrc/v2" - "go.cypherpunks.su/recfile/v2" + "go.cypherpunks.su/recfile/v3" "go.stargrave.org/mmc/internal" ) diff --git a/go.mod b/go.mod index e86e5b2..2763684 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module go.stargrave.org/mmc -go 1.21 +go 1.24 -toolchain go1.22.5 +toolchain go1.24.5 require ( github.com/davecgh/go-spew v1.1.1 @@ -10,7 +10,7 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/mattermost/mattermost-server/v6 v6.7.2 go.cypherpunks.su/netrc/v2 v2.0.0 - go.cypherpunks.su/recfile/v2 v2.0.0 + go.cypherpunks.su/recfile/v3 v3.0.0 golang.org/x/sys v0.11.0 ) diff --git a/go.sum b/go.sum index 2cde86e..17350f1 100644 --- a/go.sum +++ b/go.sum @@ -1354,8 +1354,8 @@ github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxt gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= go.cypherpunks.su/netrc/v2 v2.0.0 h1:IWJ0fPcQoccn8VbqzAQf1/4rj8zw0Bf6X5kAkzwEd48= go.cypherpunks.su/netrc/v2 v2.0.0/go.mod h1:F5Ea8ii3R9dNUE0ixE61OYIhvJQVLLdIJjrU/3qROjw= -go.cypherpunks.su/recfile/v2 v2.0.0 h1:Q2o+OzM1H2O1WnshU88r+waBqylkqZj8plBdBWZitcU= -go.cypherpunks.su/recfile/v2 v2.0.0/go.mod h1:36EnyBwx6VpsSM5MMcYGTDiKrVEP49S09p33EFuhQYU= +go.cypherpunks.su/recfile/v3 v3.0.0 h1:cHuH9GK153v+XJogb4XxuDMaC+RGmn4G2G5MLJ3SIpc= +go.cypherpunks.su/recfile/v3 v3.0.0/go.mod h1:JAkipcy9IUNuYMR+vfNqf/f6KydLdhw1TBaOnNjdHv4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= diff --git a/internal/post.go b/internal/post.go index efef167..4eb0913 100644 --- a/internal/post.go +++ b/internal/post.go @@ -17,11 +17,10 @@ package mmc import ( - "strings" "time" "github.com/mattermost/mattermost-server/v6/model" - "go.cypherpunks.su/recfile/v2" + "go.cypherpunks.su/recfile/v3" ) type Post struct { @@ -41,28 +40,28 @@ func PostToRec(w *recfile.Writer, users map[string]*model.User, post Post) error sender = user.Username } fields := []recfile.Field{ - {Name: "Id", Value: post.P.Id}, - {Name: "Created", Value: created.Format("2006-01-02 15:04:05")}, - {Name: "Sender", Value: sender}, + {F: "Id", V: post.P.Id}, + {F: "Created", V: created.Format("2006-01-02 15:04:05")}, + {F: "Sender", V: sender}, } if post.E != model.WebsocketEventPosted { - fields = append(fields, recfile.Field{Name: "Event", Value: post.E}) + fields = append(fields, recfile.Field{F: "Event", V: post.E}) } if post.P.RootId != "" { - fields = append(fields, recfile.Field{Name: "RootId", Value: post.P.RootId}) + fields = append(fields, recfile.Field{F: "RootId", V: post.P.RootId}) } if post.P.Metadata != nil { for _, fi := range post.P.Metadata.Files { fields = append( fields, - recfile.Field{Name: "File", Value: fi.Id}, - recfile.Field{Name: "FileName", Value: fi.Name}, + recfile.Field{F: "File", V: fi.Id}, + recfile.Field{F: "FileName", V: fi.Name}, ) } } + fields = append(fields, recfile.Field{F: "Text", V: post.P.Message}) if _, err = w.WriteFields(fields...); err != nil { return err } - _, err = w.WriteFieldMultiline("Text", strings.Split(post.P.Message, "\n")) return err }