client: Skip unknown rooms while decrypting.

This fixes a crash but the real reason why the room is unknown for
pantalaimons client is if the other sync stream is ahead of
pantalaimons. This will end up in undecryptable messages unless the
client waits for pantalaimon to finish its own sync.

This closes #11.
This commit is contained in:
Damir Jelić 2019-04-05 18:35:54 +02:00
parent e2da496f93
commit d36d2107a9

View File

@ -119,10 +119,14 @@ class PantaClient(AsyncClient):
Returns the json response with decrypted events.
"""
for room_id, room_dict in body["rooms"]["join"].items():
if not self.rooms[room_id].encrypted:
logger.info("Room {} is not encrypted skipping...".format(
self.rooms[room_id].display_name
))
try:
if not self.rooms[room_id].encrypted:
logger.info("Room {} is not encrypted skipping...".format(
self.rooms[room_id].display_name
))
continue
except KeyError:
logger.info("Unknown room {} skipping...".format(room_id))
continue
for event in room_dict["timeline"]["events"]: