diff options
Diffstat (limited to 'pkg/messages/types/svcVoiceData.go')
| -rw-r--r-- | pkg/messages/types/svcVoiceData.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pkg/messages/types/svcVoiceData.go b/pkg/messages/types/svcVoiceData.go index 9609d80..efcae85 100644 --- a/pkg/messages/types/svcVoiceData.go +++ b/pkg/messages/types/svcVoiceData.go | |||
| @@ -3,17 +3,19 @@ package messages | |||
| 3 | import "github.com/pektezol/bitreader" | 3 | import "github.com/pektezol/bitreader" |
| 4 | 4 | ||
| 5 | type SvcVoiceData struct { | 5 | type SvcVoiceData struct { |
| 6 | Client int8 | 6 | FromClient uint8 |
| 7 | Proximity int8 | 7 | Proximity bool |
| 8 | Length int16 | 8 | Length int16 |
| 9 | Data []byte | 9 | Data []byte |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | func ParseSvcVoiceData(reader *bitreader.Reader) SvcVoiceData { | 12 | func ParseSvcVoiceData(reader *bitreader.Reader) SvcVoiceData { |
| 13 | svcVoiceData := SvcVoiceData{ | 13 | svcVoiceData := SvcVoiceData{ |
| 14 | Client: int8(reader.TryReadBits(8)), | 14 | FromClient: reader.TryReadUInt8(), |
| 15 | Proximity: int8(reader.TryReadBits(8)), | 15 | } |
| 16 | Length: int16(reader.TryReadBits(16)), | 16 | proximity := reader.TryReadUInt8() |
| 17 | if proximity != 0 { | ||
| 18 | svcVoiceData.Proximity = true | ||
| 17 | } | 19 | } |
| 18 | svcVoiceData.Data = reader.TryReadBitsToSlice(uint64(svcVoiceData.Length)) | 20 | svcVoiceData.Data = reader.TryReadBitsToSlice(uint64(svcVoiceData.Length)) |
| 19 | return svcVoiceData | 21 | return svcVoiceData |