Invitations into hosted rooms: the dialog's details, and joining as a public room
CI / build (push) Successful in 34s
CI / build (push) Successful in 34s
The invitation carries the room as the dialog shows it (name, owner, image, occupancy, description) and the inviter's picture, age and gender from IMVU's public profile. Accepting names the room (room_instance_id), so the client joins it as a public room with the invite rather than opening a private chat, and getParticipants before joining asks the hub, so the client sees its inviter there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
210bc064e9
commit
2df46da3ad
3 files changed
+116
-9
No files matched your search
@@ -72,6 +72,8 @@ type Rooms struct {
|
||||
// OnJoin and OnLeave report being in a room's chat (the room channel, for others' community products).
|
||||
OnJoin func(chat, room string)
|
||||
OnLeave func(chat string)
|
||||
// HTTPClient fetches IMVU's public profiles (nil: http.DefaultClient).
|
||||
HTTPClient *http.Client
|
||||
// UserDeliver gives the client a message on its own user queue (invitations).
|
||||
UserDeliver func(mount string, message []byte) error
|
||||
// LocalProduct and GlobalProduct translate scenes' community products between the hub's IDs and the client's
|
||||
@@ -85,6 +87,7 @@ type Rooms struct {
|
||||
owners map[int64]int64 // room -> its owner's IMVU account, as last looked up
|
||||
last int64 // the room the client joined last
|
||||
|
||||
accepted map[int64]string // room -> the invite the client accepted, for its next join
|
||||
invites map[int64]*invite // by the local ID the client knows
|
||||
nextInvite int64 //
|
||||
watched map[int64]map[*proxy.IMQConn]string // room -> connections watching its occupancy (their queue)
|
||||
@@ -583,7 +586,11 @@ func (r *Rooms) interceptXMLRPC(x *proxy.Exchange) error {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
x.Response = r.joinChat(ctx, n, "")
|
||||
r.mu.Lock()
|
||||
inv := r.accepted[n]
|
||||
delete(r.accepted, n)
|
||||
r.mu.Unlock()
|
||||
x.Response = r.joinChat(ctx, n, inv)
|
||||
case "chat.getParticipants", "chat.terminateChat":
|
||||
chat, err := strconv.ParseInt(member(args, "chatId"), 10, 64)
|
||||
if err != nil {
|
||||
@@ -598,6 +605,21 @@ func (r *Rooms) interceptXMLRPC(x *proxy.Exchange) error {
|
||||
x.Response = xmlrpcAnswer(true)
|
||||
return nil
|
||||
}
|
||||
r.mu.Lock()
|
||||
_, in := r.rooms[n]
|
||||
r.mu.Unlock()
|
||||
if !in {
|
||||
// Not in it (yet): who is, from the hub (the client checks its inviter is there before joining).
|
||||
var people []xmlrpc.Value
|
||||
for _, p := range r.people(ctx, n) {
|
||||
people = append(people, xmlrpc.Struct{{Name: "userId", Value: p.ImvuID}, {Name: "seat", Value: int64(p.Seat)}})
|
||||
}
|
||||
if people == nil {
|
||||
people = []xmlrpc.Value{}
|
||||
}
|
||||
x.Response = xmlrpcAnswer(people)
|
||||
return nil
|
||||
}
|
||||
x.Response = xmlrpcAnswer(r.others(n))
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user