diff --git a/didcomm_messaging/quickstart.py b/didcomm_messaging/quickstart.py index dcd20f9..3b3f28e 100644 --- a/didcomm_messaging/quickstart.py +++ b/didcomm_messaging/quickstart.py @@ -341,11 +341,17 @@ async def setup_relay( return new_did +async def _message_callback(msg: Message) -> None: + if msg.type == "https://didcomm.org/basicmessage/2.0/message": + logmsg = msg.body["content"].replace("\n", " ").replace("\r", "") + LOG.info("Got message: %s", logmsg) + + async def fetch_relayed_messages( dmp: DIDCommMessaging, my_did: DID, relay_did: DID, - callback: Callable[[Message], Awaitable[None]] = None, + callback: Callable[[Message], Awaitable[None]] = _message_callback, ) -> List[Message]: """Fetch stored messages from the relay.""" @@ -389,10 +395,6 @@ async def fetch_relayed_messages( if callback: await callback(msg) - if msg.type == "https://didcomm.org/basicmessage/2.0/message": - logmsg = msg.body["content"].replace("\n", " ").replace("\r", "") - LOG.info(f"Got message: %s", logmsg) - message = Message( type="https://didcomm.org/messagepickup/3.0/messages-received", id=str(uuid.uuid4()),