X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/8eb43f95a6f11b6c256ff339399e9479898b4380..e9c043c0361e0e56e9b9adfea894c7834a99bade:/hotline/news.go?ds=sidebyside diff --git a/hotline/news.go b/hotline/news.go index e25a2c8..38db97a 100644 --- a/hotline/news.go +++ b/hotline/news.go @@ -7,6 +7,14 @@ import ( "sort" ) +const defaultNewsDateFormat = "Jan02 15:04" // Jun23 20:49 + +const defaultNewsTemplate = `From %s (%s): + +%s + +__________________________________________________________` + type ThreadedNews struct { Categories map[string]NewsCategoryListData15 `yaml:"Categories"` } @@ -52,6 +60,7 @@ func (newscat *NewsCategoryListData15) GetNewsArtListData() NewsArtListData { nald := NewsArtListData{ ID: []byte{0, 0, 0, 0}, + Count: len(newsArts), Name: []byte{}, Description: []byte{}, NewsArtList: newsArtsPayload, @@ -85,11 +94,12 @@ type NewsArtListData struct { Name []byte `yaml:"Name"` Description []byte `yaml:"Description"` // not used? NewsArtList []byte // List of articles Optional (if article count > 0) + Count int } func (nald *NewsArtListData) Payload() []byte { count := make([]byte, 4) - binary.BigEndian.PutUint32(count, uint32(len(nald.NewsArtList))) + binary.BigEndian.PutUint32(count, uint32(nald.Count)) out := append(nald.ID, count...) out = append(out, []byte{uint8(len(nald.Name))}...)