diff --git a/app/device_manager.py b/app/device_manager.py index a7acb07..adb78d1 100644 --- a/app/device_manager.py +++ b/app/device_manager.py @@ -827,14 +827,15 @@ class DeviceManager: return {'success': False, 'error': 'Device not connected'} try: - # Find contact dict from mc.contacts (used for retry/path info) - # send_msg() also accepts a hex pubkey string directly + # Find contact in device's contact table contact = self.mc.contacts.get(recipient_pubkey) if not contact: contact = self.mc.get_contact_by_key_prefix(recipient_pubkey) if not contact: - # Use pubkey string directly — meshcore lib handles it - contact = recipient_pubkey + # Contact must exist on device to send DM + return {'success': False, + 'error': f'Contact not on device. ' + f'Re-add {recipient_pubkey[:12]}... via Contacts page.'} # Generate timestamp once — same for all retries (enables receiver dedup) timestamp = int(time.time())