Skip to content

Commit

Permalink
6.4.8-rc3 (#1339)
Browse files Browse the repository at this point in the history
- Workaround for broken stun/turn on ejabberd < 24.12
- Christmas/winter special
  • Loading branch information
tmolitor-stud-tu authored Dec 22, 2024
2 parents 22bdd16 + 72293f3 commit 6b279ea
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
36 changes: 19 additions & 17 deletions Monal/Classes/PasswordMigration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ struct PasswordMigration: View {
DDLogInfo("Migration needed: \(String(describing:self.needingMigration))")
}

func updatePassword(_ password: String, for id: Int) {
self.needingMigration[id]?["password"] = password as NSString
if(password.count > 0) {
//first change? --> activate account and use "needs_password_migration" to record
//the fact that we just activated this account automatically
//(making the password field empty will reset this)
if((self.needingMigration[id]?["needs_password_migration"] as! NSNumber).boolValue) {
self.needingMigration[id]?["enabled"] = NSNumber(value:true)
self.needingMigration[id]?["needs_password_migration"] = NSNumber(value:false)
}
//reset our "account automatically activated" flag and deactivate our account
} else {
self.needingMigration[id]?["enabled"] = NSNumber(value:false)
self.needingMigration[id]?["needs_password_migration"] = NSNumber(value:true)
}
}

var body: some View {
//ScrollView {
VStack {
Expand Down Expand Up @@ -61,26 +78,11 @@ struct PasswordMigration: View {

SecureField(NSLocalizedString("Password", comment: "placeholder when migrating account"), text:Binding(
get: { self.needingMigration[id]?["password"] as? String ?? "" },
set: {
self.needingMigration[id]?["password"] = $0 as NSString
if($0.count > 0) {
//first change? --> activate account and use "needs_password_migration" to record
//the fact that we just activated this account automatically
//(making the password field empty will reset this)
if((self.needingMigration[id]?["needs_password_migration"] as! NSNumber).boolValue) {
self.needingMigration[id]?["enabled"] = NSNumber(value:true)
self.needingMigration[id]?["needs_password_migration"] = NSNumber(value:false)
}
//reset our "account automatically activated" flag and deactivate our account
} else {
self.needingMigration[id]?["enabled"] = NSNumber(value:false)
self.needingMigration[id]?["needs_password_migration"] = NSNumber(value:true)
}
}
set: { updatePassword($0, for:id) }
))
.addClearButton(isEditing: true, text:Binding(
get: { self.needingMigration[id]?["password"] as? String ?? "" },
set: { self.needingMigration[id]?["password"] = $0 as NSString }
set: { updatePassword($0, for:id) }
))
}
}
Expand Down
12 changes: 7 additions & 5 deletions Monal/Classes/xmpp.m
Original file line number Diff line number Diff line change
Expand Up @@ -1380,18 +1380,19 @@ -(void) prepareXMPPParser
DDLogWarn(@"Throwing away incoming stanza queued in parse queue, accountState < kStateConnected");
return;
}
NSString* loggedStanza = [NSString stringWithFormat:@"%@: %@", parsedStanza.element, nilDefault([parsedStanza findFirst:@"/@id"], parsedStanza)];
[MLNotificationQueue queueNotificationsInBlock:^{
//add whole processing of incoming stanzas to one big transaction
//this will make it impossible to leave inconsistent database entries on app crashes or iphone crashes/reboots
DDLogVerbose(@"Starting transaction for: %@", parsedStanza);
DDLogVerbose(@"Starting transaction for: %@", loggedStanza);
[[DataLayer sharedInstance] createTransaction:^{
DDLogVerbose(@"Started transaction for: %@", parsedStanza);
DDLogVerbose(@"Started transaction for: %@", loggedStanza);
//don't write data to our tcp stream while inside this db transaction (all effects to the outside world should be transactional, too)
[self freezeSendQueue];
[self processInput:parsedStanza withDelayedReplay:NO];
DDLogVerbose(@"Ending transaction for: %@", parsedStanza);
DDLogVerbose(@"Ending transaction for: %@", loggedStanza);
}];
DDLogVerbose(@"Ended transaction for: %@", parsedStanza);
DDLogVerbose(@"Ended transaction for: %@", loggedStanza);
[self unfreezeSendQueue]; //this will flush all stanzas added inside the db transaction and now waiting in the send queue
} onQueue:@"receiveQueue"];
[self persistState]; //make sure to persist all state changes triggered by the events in the notification queue
Expand Down Expand Up @@ -4011,7 +4012,8 @@ -(void) queryExternalServiceCredentialsFor:(NSDictionary*) service completion:(m
} andChildren:@[] andData:nil]
] andData:nil]];
[self sendIq:credentialsQuery withResponseHandler:^(XMPPIQ* response) {
completion([response findFirst:@"{urn:xmpp:extdisco:2}credentials/service@@"]);
//ejabberd <= 24.10 incorrectly uses {urn:xmpp:extdisco:2}services/service, support this as fallback
completion(nilDefault([response findFirst:@"{urn:xmpp:extdisco:2}credentials/service@@"], [response findFirst:@"{urn:xmpp:extdisco:2}services/service@@"]));
} andErrorHandler:^(XMPPIQ* error) {
DDLogWarn(@"Got error while quering for credentials of external service %@: %@", service, error);
completion(@{});
Expand Down
Binary file modified Monal/Images.xcassets/AppIcon.appiconset/Monal-ios_1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Monal/Images.xcassets/AppIcon.appiconset/Monal-macos-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Monal/Images.xcassets/AppIcon.appiconset/Monal-macos-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Monal/Images.xcassets/AppLogo.imageset/Monal-ios_1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6b279ea

Please sign in to comment.