Update XMPPService.swift
This commit is contained in:
1 parent
7791535d95
commit
94bea40220
1 file changed
+9
-26
@@ -1849,57 +1849,40 @@ final class XMPPService {
|
||||
}
|
||||
|
||||
var supportsNonAnonymousRooms = false
|
||||
if let field: ListSingleField = configuration.getField(
|
||||
named: "muc#roomconfig_whois")
|
||||
{
|
||||
if let field: ListSingleField = configuration.getField(named: "muc#roomconfig_whois") {
|
||||
field.value = "anyone"
|
||||
supportsNonAnonymousRooms = true
|
||||
} else if let field: TextSingleField = configuration.getField(
|
||||
named: "muc#roomconfig_whois")
|
||||
} else if let field: TextSingleField = configuration.getField(named: "muc#roomconfig_whois")
|
||||
{
|
||||
field.value = "anyone"
|
||||
supportsNonAnonymousRooms = true
|
||||
}
|
||||
if let field: ListMultiField = configuration.getField(
|
||||
named: "muc#roomconfig_getmemberlist")
|
||||
if let field: ListMultiField = configuration.getField(named: "muc#roomconfig_getmemberlist")
|
||||
{
|
||||
field.value = Array(Set(field.value + ["moderator", "participant"])).sorted()
|
||||
}
|
||||
if makeMembersOnly,
|
||||
let field: BooleanField = configuration.getField(
|
||||
named: "muc#roomconfig_membersonly")
|
||||
let field: BooleanField = configuration.getField(named: "muc#roomconfig_membersonly")
|
||||
{
|
||||
field.value = true
|
||||
}
|
||||
if makeMembersOnly,
|
||||
let field: BooleanField = configuration.getField(
|
||||
named: "muc#roomconfig_persistentroom")
|
||||
let field: BooleanField = configuration.getField(named: "muc#roomconfig_persistentroom")
|
||||
{
|
||||
field.value = true
|
||||
}
|
||||
|
||||
try await withCheckedThrowingContinuation {
|
||||
(continuation: CheckedContinuation<Void, Error>) in
|
||||
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in
|
||||
muc.setRoomConfiguration(roomJid: roomJID, configuration: configuration) { result in
|
||||
switch result {
|
||||
case .success: continuation.resume()
|
||||
case .success(let value): continuation.resume(returning: value)
|
||||
case .failure(let error): continuation.resume(throwing: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if makeMembersOnly {
|
||||
try await withCheckedThrowingContinuation {
|
||||
(continuation: CheckedContinuation<Void, Error>) in
|
||||
muc.allowAccess(room: room, to: [JID(account!.bareJid)]) { result in
|
||||
switch result {
|
||||
case .success: continuation.resume()
|
||||
case .failure(let error): continuation.resume(throwing: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
if supportsNonAnonymousRooms {
|
||||
omemoConfiguredRoomJIDs.insert(room.jid.stringValue.lowercased())
|
||||
}
|
||||
|
||||
return supportsNonAnonymousRooms
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user