Allow to send federation information in ext. signaling join

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2024-07-24 22:56:34 +02:00
Родитель 7c1245c1e9
Коммит e7b5cb48a1
2 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -45,7 +45,7 @@ typedef void (^JoinRoomExternalSignalingCompletionBlock)(NSError *error);
- (instancetype)initWithAccount:(TalkAccount *)account server:(NSString *)serverUrl andTicket:(NSString *)ticket;
- (BOOL)hasMCU;
- (NSString *)sessionId;
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId withCompletionBlock:(JoinRoomExternalSignalingCompletionBlock)block;
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId withFederation:(NSDictionary * _Nullable)federationDict withCompletionBlock:(JoinRoomExternalSignalingCompletionBlock)block;
- (void)leaveRoom:(NSString *)roomId;
- (void)sendCallMessage:(NCSignalingMessage *)message;
- (void)sendSendOfferMessageWithSessionId:(NSString *)sessionId andRoomType:(NSString *)roomType;

Просмотреть файл

@ -381,7 +381,7 @@ NSString * const NCExternalSignalingControllerDidReceiveStoppedTypingNotificatio
[self executeCompletionBlockForMessageId:messageId withStatus:SendMessageApplicationError];
}
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId withCompletionBlock:(JoinRoomExternalSignalingCompletionBlock)block
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId withFederation:(NSDictionary *)federationDict withCompletionBlock:(JoinRoomExternalSignalingCompletionBlock)block
{
if (_disconnected) {
@ -400,6 +400,17 @@ NSString * const NCExternalSignalingControllerDidReceiveStoppedTypingNotificatio
}
};
if (federationDict) {
messageDict = @{
@"type": @"room",
@"room": @{
@"roomid": roomId,
@"sessionid": sessionId,
@"federation": federationDict
}
};
}
[self sendMessage:messageDict withCompletionBlock:^(NSURLSessionWebSocketTask *task, NCExternalSignalingSendMessageStatus status) {
if (status == SendMessageSocketError && task == self->_webSocket) {
// Reconnect if this is still the same socket we tried to send the message on
@ -425,7 +436,7 @@ NSString * const NCExternalSignalingControllerDidReceiveStoppedTypingNotificatio
{
if ([_currentRoom isEqualToString:roomId]) {
_currentRoom = nil;
[self joinRoom:@"" withSessionId:@"" withCompletionBlock:nil];
[self joinRoom:@"" withSessionId:@"" withFederation:nil withCompletionBlock:nil];
} else {
NSLog(@"External signaling: Not leaving because it's not room we joined");
}