mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-25 06:49:23 +00:00
Can get the list of members of a call
This commit is contained in:
parent
431463967b
commit
b72dfa1646
@ -69,6 +69,21 @@ export class CallsController {
|
|||||||
h.success();
|
h.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of members for a call
|
||||||
|
*
|
||||||
|
* The user must have joined the call to get this information
|
||||||
|
*
|
||||||
|
* @param h Request handler
|
||||||
|
*/
|
||||||
|
public static async GetMembersList(h: UserWebSocketRequestsHandler) {
|
||||||
|
const convID = h.postCallId("callID");
|
||||||
|
|
||||||
|
h.send(UserWebSocketController.active_clients.filter(
|
||||||
|
(f) => f.activeCalls.has(convID)
|
||||||
|
).map(f => f.userID))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the client leave the call
|
* Make the client leave the call
|
||||||
*
|
*
|
||||||
|
@ -36,4 +36,6 @@ export const UserWebSocketRoutes: UserWebSocketRoute[] = [
|
|||||||
{title: "calls/join", handler: (h) => CallsController.JoinCall(h)},
|
{title: "calls/join", handler: (h) => CallsController.JoinCall(h)},
|
||||||
|
|
||||||
{title: "calls/leave", handler: (h) => CallsController.LeaveCall(h)},
|
{title: "calls/leave", handler: (h) => CallsController.LeaveCall(h)},
|
||||||
|
|
||||||
|
{title: "calls/members", handler: (h) => CallsController.GetMembersList(h)},
|
||||||
]
|
]
|
@ -64,4 +64,20 @@ export class UserWebSocketRequestsHandler extends BaseRequestsHandler {
|
|||||||
|
|
||||||
this.sentResponse = true;
|
this.sentResponse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ID of a call included in WebSocket request
|
||||||
|
*
|
||||||
|
* @param name The name of the parameter
|
||||||
|
*/
|
||||||
|
public postCallId(name: string) : number {
|
||||||
|
const convID = this.postInt(name);
|
||||||
|
|
||||||
|
// Check if the user is a member of this call
|
||||||
|
if(!this.wsClient.activeCalls.has(convID))
|
||||||
|
this.error(401, "You do not belong to this call!")
|
||||||
|
|
||||||
|
return convID;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user