Skip to content

Commit

Permalink
Also fix decoding interop JIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 1, 2024
1 parent 463c5b3 commit f8b7eb6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions binary/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ func (r *binaryDecoder) readInteropJID() (interface{}, error) {
if err != nil {
return nil, err
}
server, err := r.read(true)
if err != nil {
return nil, err
} else if server != types.InteropServer {
return nil, fmt.Errorf("%w: expected %q, got %q", ErrInvalidJIDType, types.InteropServer, server)
}
return types.JID{
User: user.(string),
Device: uint16(device),
Expand All @@ -271,8 +277,8 @@ func (r *binaryDecoder) readFBJID() (interface{}, error) {
server, err := r.read(true)
if err != nil {
return nil, err
} else if server == nil {
return nil, ErrInvalidJIDType
} else if server != types.MessengerServer {
return nil, fmt.Errorf("%w: expected %q, got %q", ErrInvalidJIDType, types.MessengerServer, server)
}
return types.JID{
User: user.(string),
Expand Down

0 comments on commit f8b7eb6

Please sign in to comment.