fix(dm): Remove DM button from messages and filter only CLI contacts

Two improvements to DM functionality:

1. Removed DM button from message blocks in channel view
   - Users should use the DM page directly instead
   - Cleaner UI without redundant buttons

2. Filter only CLI (client) contacts in DM dropdown
   - Added filter_types parameter to parse_contacts()
   - get_contacts_list() now returns only CLI contacts
   - Repeaters (REP), rooms (ROOM), and sensors (SENS) are excluded
   - You can't send DMs to repeaters anyway!

Updated README.md to reflect these changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2025-12-28 15:23:43 +01:00
parent 2e009b2d3e
commit 9cd763c8c5
3 changed files with 12 additions and 13 deletions
+10 -4
View File
@@ -121,7 +121,7 @@ def get_contacts() -> Tuple[bool, str]:
return success, stdout or stderr
def parse_contacts(output: str) -> List[str]:
def parse_contacts(output: str, filter_types: Optional[List[str]] = None) -> List[str]:
"""
Parse meshcli contacts output to extract contact names.
@@ -133,6 +133,8 @@ def parse_contacts(output: str) -> List[str]:
Args:
output: Raw output from meshcli contacts command
filter_types: Optional list of contact types to include (e.g., ['CLI'])
If None, all types are included.
Returns:
List of contact names (unique)
@@ -160,8 +162,10 @@ def parse_contacts(output: str) -> List[str]:
# Validate that second column looks like a type
if contact_type in ['CLI', 'REP', 'ROOM', 'SENS'] and contact_name:
if contact_name not in contacts:
contacts.append(contact_name)
# Apply type filter if specified
if filter_types is None or contact_type in filter_types:
if contact_name not in contacts:
contacts.append(contact_name)
return contacts
@@ -169,6 +173,7 @@ def parse_contacts(output: str) -> List[str]:
def get_contacts_list() -> Tuple[bool, List[str], str]:
"""
Get parsed list of contact names from the device.
Only returns CLI (client) contacts, excluding REP, ROOM, and SENS.
Returns:
Tuple of (success, contact_names_list, error_message)
@@ -178,7 +183,8 @@ def get_contacts_list() -> Tuple[bool, List[str], str]:
if not success:
return False, [], output
contacts = parse_contacts(output)
# Filter only CLI (client) contacts - no repeaters, rooms, or sensors
contacts = parse_contacts(output, filter_types=['CLI'])
return True, contacts, ""