X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/aebc4d3647b9823ae8cbb57b21b1af83bfd011fb..5853654f0a618dc89f893992a7f0d211456483f8:/hotline/news.go diff --git a/hotline/news.go b/hotline/news.go index 77c6696..11e2a27 100644 --- a/hotline/news.go +++ b/hotline/news.go @@ -52,6 +52,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 +86,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))}...) @@ -202,6 +204,7 @@ func (newscat *NewsCategoryListData15) nameLen() []byte { return []byte{uint8(len(newscat.Name))} } +// TODO: re-implement as bufio.Scanner interface func ReadNewsPath(newsPath []byte) []string { if len(newsPath) == 0 { return []string{}