diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2023-01-18 13:52:52 -0800 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2023-01-18 13:52:52 -0800 |
| commit | 3326539367dfa85cb2b0455d5b1c67eaaf59cf8e (patch) | |
| tree | a1ebb95925e3834371e1aeb82002ce033441284f /hotline/news.go | |
| parent | fd5eb3ab478559a722976c8093a4c2c281019c45 (diff) | |
Fix threaded news bugs
1. Fix handling of article IDs sent as 4 bytes instead of 2
2. Fix incorrect article count listing that strangely only affects third party clients
Diffstat (limited to 'hotline/news.go')
| -rw-r--r-- | hotline/news.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hotline/news.go b/hotline/news.go index e25a2c8..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))}...) |