diff --git a/pantalaimon/client.py b/pantalaimon/client.py index ae670d1..facf8f5 100644 --- a/pantalaimon/client.py +++ b/pantalaimon/client.py @@ -24,8 +24,9 @@ from jsonschema import Draft4Validator, FormatChecker, validators from nio import (AsyncClient, ClientConfig, EncryptionError, KeysQueryResponse, KeyVerificationEvent, KeyVerificationKey, KeyVerificationMac, KeyVerificationStart, LocalProtocolError, MegolmEvent, - RoomEncryptedEvent, RoomMessage, SyncResponse, - RoomContextError) + RoomEncryptedEvent, SyncResponse, + RoomContextError, RoomMessageText, RoomMessageMedia, + RoomEncryptedMedia, RoomTopicEvent, RoomNameEvent) from nio.crypto import Sas from nio.store import SqliteStore @@ -144,7 +145,8 @@ class PanClient(AsyncClient): ) self.add_event_callback( self.store_message_cb, - RoomMessage + (RoomMessageText, RoomMessageMedia, RoomEncryptedMedia, + RoomTopicEvent, RoomNameEvent) ) self.key_verificatins_tasks = [] self.key_request_tasks = [] diff --git a/pantalaimon/index.py b/pantalaimon/index.py index fb3db80..4047028 100644 --- a/pantalaimon/index.py +++ b/pantalaimon/index.py @@ -15,7 +15,8 @@ import datetime import tantivy -from nio import RoomMessageText, RoomNameEvent, RoomTopicEvent +from nio import (RoomMessageText, RoomNameEvent, RoomTopicEvent, + RoomMessageMedia, RoomEncryptedMedia) def sanitize_room_id(room_id): @@ -118,6 +119,8 @@ class Index: if isinstance(event, RoomMessageText): doc.add_text(self.body_field, event.body) + elif isinstance(event, (RoomMessageMedia, RoomEncryptedMedia)): + doc.add_text(self.body_field, event.body) elif isinstance(event, RoomNameEvent): doc.add_text(self.name_field, event.name) elif isinstance(event, RoomTopicEvent):