Implement copy restriction and send as peer

This commit is contained in:
Ilya Laktyushin
2021-11-05 21:45:48 +04:00
parent 003d263ebd
commit 1a717fbda5
37 changed files with 1004 additions and 216 deletions

View File

@@ -224,6 +224,8 @@ public extension Message {
return true
} else if let channel = self.peers[self.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
return true
} else if self.id.peerId.namespace == Namespaces.Peer.CloudChannel, self.author?.id != accountPeerId {
return true
} else {
return false
}
@@ -240,7 +242,9 @@ public extension Message {
}
func isCopyProtected() -> Bool {
if let channel = self.peers[self.id.peerId] as? TelegramChannel, case let .broadcast(flags) = channel.info, flags.flags.contains(.copyProtectionEnabled) && channel.adminRights == nil {
if let group = self.peers[self.id.peerId] as? TelegramGroup, group.flags.contains(.copyProtectionEnabled) {
return true
} else if let channel = self.peers[self.id.peerId] as? TelegramChannel, channel.flags.contains(.copyProtectionEnabled) {
return true
} else {
return false