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
|
var supportsNonAnonymousRooms = false
|
||||||
if let field: ListSingleField = configuration.getField(
|
if let field: ListSingleField = configuration.getField(named: "muc#roomconfig_whois") {
|
||||||
named: "muc#roomconfig_whois")
|
|
||||||
{
|
|
||||||
field.value = "anyone"
|
field.value = "anyone"
|
||||||
supportsNonAnonymousRooms = true
|
supportsNonAnonymousRooms = true
|
||||||
} else if let field: TextSingleField = configuration.getField(
|
} else if let field: TextSingleField = configuration.getField(named: "muc#roomconfig_whois")
|
||||||
named: "muc#roomconfig_whois")
|
|
||||||
{
|
{
|
||||||
field.value = "anyone"
|
field.value = "anyone"
|
||||||
supportsNonAnonymousRooms = true
|
supportsNonAnonymousRooms = true
|
||||||
}
|
}
|
||||||
if let field: ListMultiField = configuration.getField(
|
if let field: ListMultiField = configuration.getField(named: "muc#roomconfig_getmemberlist")
|
||||||
named: "muc#roomconfig_getmemberlist")
|
|
||||||
{
|
{
|
||||||
field.value = Array(Set(field.value + ["moderator", "participant"])).sorted()
|
field.value = Array(Set(field.value + ["moderator", "participant"])).sorted()
|
||||||
}
|
}
|
||||||
if makeMembersOnly,
|
if makeMembersOnly,
|
||||||
let field: BooleanField = configuration.getField(
|
let field: BooleanField = configuration.getField(named: "muc#roomconfig_membersonly")
|
||||||
named: "muc#roomconfig_membersonly")
|
|
||||||
{
|
{
|
||||||
field.value = true
|
field.value = true
|
||||||
}
|
}
|
||||||
if makeMembersOnly,
|
if makeMembersOnly,
|
||||||
let field: BooleanField = configuration.getField(
|
let field: BooleanField = configuration.getField(named: "muc#roomconfig_persistentroom")
|
||||||
named: "muc#roomconfig_persistentroom")
|
|
||||||
{
|
{
|
||||||
field.value = true
|
field.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
try await withCheckedThrowingContinuation {
|
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in
|
||||||
(continuation: CheckedContinuation<Void, Error>) in
|
|
||||||
muc.setRoomConfiguration(roomJid: roomJID, configuration: configuration) { result in
|
muc.setRoomConfiguration(roomJid: roomJID, configuration: configuration) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success: continuation.resume()
|
case .success(let value): continuation.resume(returning: value)
|
||||||
case .failure(let error): continuation.resume(throwing: error)
|
case .failure(let error): continuation.resume(throwing: error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if supportsNonAnonymousRooms {
|
||||||
if makeMembersOnly {
|
omemoConfiguredRoomJIDs.insert(room.jid.stringValue.lowercased())
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return supportsNonAnonymousRooms
|
return supportsNonAnonymousRooms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user