You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
845 B
Python
46 lines
845 B
Python
3 years ago
|
"""
|
||
|
InvitePolicy class:
|
||
|
InvitePolicy object are use to chose whether to accept or decline
|
||
|
an invite to a room.
|
||
|
"""
|
||
|
|
||
|
from abc import (
|
||
|
ABC,
|
||
|
abstractmethod
|
||
|
)
|
||
|
import nio
|
||
|
|
||
|
class InvitePolicy(ABC):
|
||
|
"""
|
||
|
Class used by Client to chose whether to accept of decline an invite.
|
||
|
"""
|
||
|
|
||
|
@abstractmethod
|
||
|
await def accept_invite(
|
||
|
self,
|
||
|
invite: nio.responses.InviteInfo
|
||
|
)->bool:
|
||
|
pass
|
||
|
|
||
|
class DeclineAll(InvitePolicy):
|
||
|
"""
|
||
|
Decline all invitations.
|
||
|
"""
|
||
|
|
||
|
await def accept_invite(
|
||
|
self,
|
||
|
invite: nio.responses.InviteInfo
|
||
|
)->bool:
|
||
|
return False
|
||
|
|
||
|
class AcceptAll(InvitePolicy):
|
||
|
"""
|
||
|
Accept all invitations.
|
||
|
"""
|
||
|
|
||
|
await def accept_invite(
|
||
|
self,
|
||
|
invite: nio.responses.InviteInfo
|
||
|
)->bool:
|
||
|
return True
|