Skip to content

Commit 7e06b17

Browse files
6.4.13 (#1456)
IOS_ONLY - Don't mirror local camera view in videocalls - Don't autodisable account on some minor errors - Fix mam queries broken by last release
2 parents 9086220 + e234f15 commit 7e06b17

File tree

7 files changed

+28
-22
lines changed

7 files changed

+28
-22
lines changed

Monal/Classes/AVCallUI.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ struct AVCallUI: View {
6464

6565
self.localRenderer = RTCMTLVideoView(frame: UIScreen.main.bounds)
6666
self.localRenderer.videoContentMode = .scaleAspectFill
67-
self.localRenderer.transform = CGAffineTransformMakeScale(-1.0, 1.0) //local video should be displayed as "mirrored"
6867

6968
self.ringingPlayer = try! AVAudioPlayer(contentsOf:Bundle.main.url(forResource:"ringing", withExtension:"wav", subdirectory:"CallSounds")!)
7069
self.busyPlayer = try! AVAudioPlayer(contentsOf:Bundle.main.url(forResource:"busy", withExtension:"wav", subdirectory:"CallSounds")!)
@@ -74,6 +73,8 @@ struct AVCallUI: View {
7473
func maybeStartRenderer() {
7574
if MLCallType(rawValue:call.callType) == .video && MLCallState(rawValue:call.state) == .connected {
7675
DDLogInfo("Starting local and remote video renderers...")
76+
//local video should be displayed as "mirrored", if front camera is used
77+
self.localRenderer.transform = CGAffineTransformMakeScale(cameraPosition == .front ? -1.0 : 1.0, 1.0)
7778
call.obj.startCaptureLocalVideo(withRenderer: self.localRenderer, andCameraPosition:cameraPosition)
7879
call.obj.renderRemoteVideo(withRenderer: self.remoteRenderer)
7980
}

Monal/Classes/HelperTools.m

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,17 @@ +(void) __attribute__((noreturn)) throwExceptionWithName:(NSString*) name reason
466466
+(void) postError:(NSString*) description withNode:(XMPPStanza* _Nullable) node andAccount:(xmpp*) account andIsSevere:(BOOL) isSevere andDisableAccount:(BOOL) disableAccount
467467
{
468468
[self postError:description withNode:node andAccount:account andIsSevere:isSevere];
469-
470-
//disconnect and reset state (including pipelined auth etc.)
471-
//this has to be done before disabling the account to not trigger an assertion
472-
[[MLXMPPManager sharedInstance] disconnectAccount:account.accountNo withExplicitLogout:YES];
469+
if(disableAccount)
470+
{
471+
//disconnect and reset state (including pipelined auth etc.)
472+
//this has to be done before disabling the account to not trigger an assertion
473+
[[MLXMPPManager sharedInstance] disconnectAccount:account.accountNo withExplicitLogout:YES];
473474

474-
//make sure we don't try this again even when the mainapp/appex gets restarted
475-
NSMutableDictionary* accountDic = [[NSMutableDictionary alloc] initWithDictionary:[[DataLayer sharedInstance] detailsForAccount:account.accountNo] copyItems:YES];
476-
accountDic[kEnabled] = @NO;
477-
[[DataLayer sharedInstance] updateAccounWithDictionary:accountDic];
475+
//make sure we don't try this again even when the mainapp/appex gets restarted
476+
NSMutableDictionary* accountDic = [[NSMutableDictionary alloc] initWithDictionary:[[DataLayer sharedInstance] detailsForAccount:account.accountNo] copyItems:YES];
477+
accountDic[kEnabled] = @NO;
478+
[[DataLayer sharedInstance] updateAccounWithDictionary:accountDic];
479+
}
478480
}
479481

480482
+(void) postError:(NSString*) description withNode:(XMPPStanza* _Nullable) node andAccount:(xmpp*) account andIsSevere:(BOOL) isSevere

Monal/Classes/MLIQProcessor.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ +(void) processErrorIq:(XMPPIQ*) iqNode forAccount:(xmpp*) account
257257
}
258258

259259
DDLogInfo(@"Now bound to fullJid: %@", [iqNode findFirst:@"{urn:ietf:params:xml:ns:xmpp-bind}bind/jid#"]);
260-
[account.connectionProperties.identity bindJid:[iqNode findFirst:@"{urn:ietf:params:xml:ns:xmpp-bind}bind/jid#"]];
260+
[account.connectionProperties.identity bindJid:[iqNode findFirst:@"{urn:ietf:params:xml:ns:xmpp-bind}bind/jid#"] onAccount:account];
261261
DDLogDebug(@"bareJid=%@, resource=%@, fullJid=%@", account.connectionProperties.identity.jid, account.connectionProperties.identity.resource, account.connectionProperties.identity.fullJid);
262262

263263
//update resource in db (could be changed by server)

Monal/Classes/MLStream.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,10 @@ -(void) close
735735
self.shared_state.error = st_error;
736736
}
737737
[self generateEvent:NSStreamEventErrorOccurred];
738+
nw_connection_force_cancel(connection);
738739
}
740+
else
741+
nw_connection_cancel(connection);
739742
});
740743
@synchronized(self.shared_state) {
741744
self.closed = YES;

Monal/Classes/MLXMPPIdentity.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

13+
@class xmpp;
14+
1315
/**
1416
Imutable class to contain the specifics of an XMPP user
1517
*/
@@ -33,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
3335
*/
3436
-(void) updatPassword:(NSString *) newPassword;
3537

36-
-(void) bindJid:(NSString*) jid;
38+
-(void) bindJid:(NSString*) jid onAccount:(xmpp*) account;
3739

3840
@end
3941

Monal/Classes/MLXMPPIdentity.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ -(void) updatPassword:(NSString*) newPassword
3737
self.password = newPassword;
3838
}
3939

40-
-(void) bindJid:(NSString*) jid
40+
-(void) bindJid:(NSString*) jid onAccount:(xmpp*) account
4141
{
4242
NSDictionary* parts = [HelperTools splitJid:jid];
4343

4444
//we don't allow this because several parts in monal rely on stable bare jids not changing after login/bind
45-
MLAssert([self.jid isEqualToString:parts[@"user"]], @"trying to bind to different bare jid!", (@{
46-
@"bind_to_jid": jid,
47-
@"current_bare_jid": self.jid
48-
}));
45+
if(![self.jid isEqualToString:parts[@"user"]])
46+
{
47+
[HelperTools postError:[NSString stringWithFormat:NSLocalizedString(@"The server tried to bind you to jid '%@', but you configured '%@', disabling account!", @""), parts[@"user"], self.jid] withNode:nil andAccount:account andIsSevere:YES andDisableAccount:YES];
48+
}
4949

5050
//don't set new full jid if we don't have a resource
5151
if(parts[@"resource"] != nil)

Monal/Classes/xmpp.m

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,11 +2143,9 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
21432143
mamQueryNode.toUser==nil ||
21442144
[@"" isEqualToString:mamQueryNode.toUser] ||
21452145
[self.connectionProperties.identity.jid isEqualToString:mamQueryNode.toUser]
2146-
//but fromUser or toUser is not the bare jid we queried the archive from
2147-
) && (
2148-
![messageNode.fromUser isEqualToString:mamQueryNode.toUser] ||
2149-
![messageNode.toUser isEqualToString:mamQueryNode.toUser]
2150-
)
2146+
//but fromUser is not the bare jid we queried the archive from
2147+
) &&
2148+
![messageNode.fromUser isEqualToString:mamQueryNode.toUser]
21512149
) {
21522150
DDLogError(@"muc mam results must not contain 1:1 message stanzas, ignoring this spoofed mam result having queryid: %@!", [outerMessageNode findFirst:@"{urn:xmpp:mam:2}result@queryid"]);
21532151
//even these stanzas have to be counted by smacks
@@ -2738,7 +2736,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
27382736
self.connectionProperties.channelBindingTypes = channelBindings;
27392737

27402738
//update user identity using authorization-identifier, including support for fullJids (as specified by BIND2)
2741-
[self.connectionProperties.identity bindJid:[parsedStanza findFirst:@"authorization-identifier#"]];
2739+
[self.connectionProperties.identity bindJid:[parsedStanza findFirst:@"authorization-identifier#"] onAccount:self];
27422740

27432741
//record SDDP support
27442742
self.connectionProperties.supportsSSDP = self->_scramHandler.ssdpSupported;

0 commit comments

Comments
 (0)