Skip to content

SENT_MSG log entry contains sender's name instead of recipient's name #27

@MarekWo

Description

@MarekWo

Bug Description

When sending a direct message using the msg <name> <message> command, the resulting SENT_MSG entry in the .msgs log file contains the sender's device name in the name field, rather than the recipient's name.

This makes it impossible to determine who a sent message was addressed to when reading the log file later.

Steps to Reproduce

  1. Send a direct message to a contact:
    meshcli -s /dev/ttyUSB0 msg daniel5120 "Hello there"
  2. Check the .msgs file:
    {"type": "SENT_MSG", "expected_ack": "d46e02ba", "suggested_timeout": 8116, "name": "MarWoj", "text": "Hello there", "txt_type": 0, "timestamp": 1766490370}
    

Expected Behavior

The name field should contain the recipient's name (daniel5120), not the sender's device name (MarWoj):

{"type": "SENT_MSG", "expected_ack": "d46e02ba", "suggested_timeout": 8116, "name": "daniel5120", "text": "Hello there", "txt_type": 0, "timestamp": 1766490370}

Alternatively, use a different field name like recipient for clarity:

{"type": "SENT_MSG", "expected_ack": "d46e02ba", "suggested_timeout": 8116, "recipient": "daniel5120", "text": "Hello there", "txt_type": 0, "timestamp": 1766490370}

Impact

Applications that parse the .msgs file to display DM conversation threads cannot properly group sent messages by recipient, since the recipient information is not available. For comparison, incoming private messages (PRIV type) correctly include the sender's name:

{"type": "PRIV", "SNR": 12.5, "pubkey_prefix": "4563b1621b58", "path_len": 8, "txt_type": 0, "sender_timestamp": 1766491148, "text": "Response", "name": "daniel5120", "timestamp": 1766491173}

Environment

meshcore-cli version: latest
Device: Heltec V4
Connection: USB

Suggested Fix

In the code that logs SENT_MSG entries, change the name field to contain the target contact's name that was passed to the msg command, rather than the device's own name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions