diff --git a/internal/hosted/hosted.go b/internal/hosted/hosted.go index 5200e8a..045b908 100644 --- a/internal/hosted/hosted.go +++ b/internal/hosted/hosted.go @@ -780,8 +780,11 @@ func (r *Rooms) joinChat(ctx context.Context, n int64, inviteID string) *http.Re } // Refused as the client's own refusals are (it shows the explanation; booted ones as booted). reason := int64(0) - if a.Reason == "banned" { + switch a.Reason { + case "banned": reason = errorPublicRoomBooted + case "full": + reason = errorPublicRoomFull } return xmlrpcAnswer(xmlrpc.Struct{{Name: "response", Value: "declined"}, {Name: "reason", Value: reason}, {Name: "explanation", Value: msg}}) } diff --git a/internal/hosted/hosted_test.go b/internal/hosted/hosted_test.go index b0138cc..c946fb8 100644 --- a/internal/hosted/hosted_test.go +++ b/internal/hosted/hosted_test.go @@ -151,7 +151,7 @@ func TestHostedRoom(t *testing.T) { t.Fatalf("events %v", *events) } // A full room: the client is told why. - if resp, _ := xmlrpcCall(t, r, "chat.imvu.com", "chat.getOrMakeChat", xmlrpc.Struct{{Name: "activity", Value: "publicroom-88-2100000009"}}); get(resp.Params[0], "response") != "declined" || get(resp.Params[0], "explanation") != "This room is full." { + if resp, _ := xmlrpcCall(t, r, "chat.imvu.com", "chat.getOrMakeChat", xmlrpc.Struct{{Name: "activity", Value: "publicroom-88-2100000009"}}); get(resp.Params[0], "response") != "declined" || get(resp.Params[0], "explanation") != "This room is full." || get(resp.Params[0], "reason") != int64(5) { t.Fatalf("full room: %+v", resp) } diff --git a/internal/hosted/phase2.go b/internal/hosted/phase2.go index 813cf08..f59492b 100644 --- a/internal/hosted/phase2.go +++ b/internal/hosted/phase2.go @@ -20,8 +20,11 @@ import ( "git.t5de.dev/t5de/t5de-proxy/internal/xmlrpc" ) -// errorPublicRoomBooted is the client's reason code for being refused a room it was booted from. -const errorPublicRoomBooted = 4 +// The client's reason codes for refused joins: booted (it shows "booted"), and full (IMVU's own wording). +const ( + errorPublicRoomFull = 5 + errorPublicRoomBooted = 4 +) // invite is an invitation the client sent (outgoing, by the local ID the client knows) or got (incoming). type invite struct {