Fix IsEmpty to return the right thing

This commit is contained in:
Erik Johnston 2017-10-11 18:14:12 +01:00
parent edc8c5ae61
commit 6c98aa7666

View file

@ -77,11 +77,11 @@ func NewResponse(pos StreamPosition) *Response {
// IsEmpty returns true if the response is empty, i.e. used to decided whether // IsEmpty returns true if the response is empty, i.e. used to decided whether
// to return the response immediately to the client or to wait for more data. // to return the response immediately to the client or to wait for more data.
func (r *Response) IsEmpty() bool { func (r *Response) IsEmpty() bool {
return len(r.Rooms.Join) > 0 || return len(r.Rooms.Join) == 0 &&
len(r.Rooms.Invite) > 0 || len(r.Rooms.Invite) == 0 &&
len(r.Rooms.Leave) > 0 || len(r.Rooms.Leave) == 0 &&
len(r.AccountData.Events) > 0 || len(r.AccountData.Events) == 0 &&
len(r.Presence.Events) > 0 len(r.Presence.Events) == 0
} }
// JoinResponse represents a /sync response for a room which is under the 'join' key. // JoinResponse represents a /sync response for a room which is under the 'join' key.