Skip to content
Snippets Groups Projects
Commit 54c10fd2 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

refactor: Make sure we create valid contacts

parent 37c5aefc
No related branches found
No related tags found
No related merge requests found
......@@ -282,6 +282,11 @@ def supports_video(self) -> bool:
return False
def add_resource(self, resource: str) -> ResourceContact:
assert resource is not None
# Check if resource is not None because not the whole
# codebase is type checked and it creates hard to track
# problems if we create a ResourceContact without resource
jid = self._jid.new_with(resource=resource)
assert isinstance(self._log, LogAdapter)
contact = ResourceContact(self._log, jid, self._account)
......@@ -562,6 +567,11 @@ def is_groupchat(self) -> bool:
return True
def add_resource(self, resource: str) -> GroupchatParticipant:
assert resource is not None
# Check if resource is not None because not the whole
# codebase is type checked and it creates hard to track
# problems if we create a GroupchatParticipant without resource
jid = self._jid.new_with(resource=resource)
assert isinstance(self._log, LogAdapter)
contact = GroupchatParticipant(self._log, jid, self._account)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment