I asked perplexity its thoughts on adding mentions. Is it all even close?
Okay, I need to figure out how to contribute to the Delta Chat Desktop project by adding support for @mentions
. Let me start by understanding the existing codebase and any related components.
First, looking at the search results provided, I see that there are mentions of a message parser in deltachat/message-parser. The message-parser repository’s spec.md file outlines different parsing modes, including user mentions. They have a mode that includes parsing mentions with @username
, which is exactly what I need. The spec also mentions that mentions are transformed into an internal representation using email addresses or contact IDs, which ensures compatibility even if the contact’s name changes.
Next, I should check if there’s an existing issue or feature request for this. The search results include a link to a forum post (Feature Proposal: Direct mention on groups) where users are discussing the need for @mentions. This indicates that the feature is desired by the community, which is a good sign that the contribution would be welcomed.
Looking at the contributing guidelines (CONTRIBUTING.md), Delta Chat encourages contributors to open a Pull Request and follow specific steps, like creating a branch named /. They also emphasize adding meaningful descriptions to PRs and updating the CHANGELOG.md. Since this is a new feature, I’ll need to make sure to document it appropriately.
The message-parser is written in Rust and includes a WASM module used by the desktop client. To implement @mentions
, I’ll need to modify the parser to detect @ followed by a username and convert it into the appropriate AST node. The existing code handles similar elements like hashtags and email addresses, so I can follow those patterns.
I also notice that the desktop client uses a JSON-RPC API to communicate with the core Rust library. Any changes to the message handling would need to ensure that the mentions are correctly passed through this API. The core library’s CFFI and JSON-RPC bindings are mentioned in the search results, so I should review how messages are processed there.
Testing is crucial. The message-parser has many test cases, so I’ll need to add tests for @mentions
, ensuring they’re correctly parsed and converted. The spec.md file includes examples of how other elements are tested, which I can emulate.
Another consideration is the user interface. The desktop client needs to display mentions differently, perhaps by highlighting them or making them clickable. The message-parser’s WASM demo shows how parsed elements are rendered, so I’ll need to update the React components to handle the new mention nodes.
I should also check if there are any existing PRs or recent commits related to mentions. The RELEASE.md file details the release process, including test releases and updating translations. If my changes affect user-facing strings, I’ll need to update the translation files and ensure they’re pulled correctly.
Finally, I’ll need to follow the project’s coding standards, run benchmarks to ensure performance isn’t impacted, and possibly update documentation like the help files or spec.md to reflect the new feature. Collaborating with the community via the forum or GitHub issues might provide additional insights or feedback during development.
Enhancing Delta Chat Desktop with User Mentions
Introduction to User Mention Implementation in Delta Chat Desktop
Delta Chat is a decentralized messaging application that leverages email protocols for communication. While it offers robust features, user mentions using @username
have been a community-requested enhancement. This report explores the technical and design considerations for implementing user mentions in Delta Chat Desktop, informed by the project’s architecture and existing tools like the message parser.
Architectural Foundations for Mention Handling
Message Parser Integration
The deltachat/message-parser
crate (spec.md [6][22][25][42][62]) provides structured parsing of message content into an Abstract Syntax Tree (AST). It currently supports elements like links, emails, and markdown formatting.
Proposed Mention Syntax
- Detection:
@username
patterns in message text
- Internal Representation: Convert mentions to
mention:email
or mention:contact_id
to persist through name changes[9][29][58][62]
- AST Node: New
Mention
element with resolved contact info
// Example AST node from message-parser
enum ASTNode {
Text(String),
Link(String),
Mention { display: String, identifier: String },
// ...
}
Core Modifications Required
1. Parser Enhancements
- Pattern Recognition: Add regex to detect
@[a-zA-Z0-9_]+
in parser.rs
- Contact Resolution: Query core Rust library via JSON-RPC to resolve username→email mapping[2][18][44]
- Edge Cases:
- Multiple mentions (
@alice @bob
)
- Mid-word mentions (
hi@example.com
vs hi @alice
)
- Non-existent contacts
2. Desktop UI Components
- Rendering: Highlight mentions with CSS class
.message-mention
- Interactivity:
- Click triggers contact profile view
- Context menu options (“Mute notifications from @alice”)
- Composer Integration:
- Auto-complete dropdown during
@
typing
- Visual indicator for resolved mentions
// React component for message text
function MessageText({ ast }) {
return ast.map(node => {
if (node.type === 'mention') {
return <span className="mention" data-contact={node.identifier}>{node.display}</span>;
}
// ...
});
}
Cross-Platform Synchronization
Device Consistency
Delta Chat’s multi-device architecture requires:
- Metadata Storage: Store original
@username
+ resolved contact ID in message metadata[10][52]
- Sync Protocol: Include mention mappings in Delta Chat’s CRDT-based sync mechanism[19][53][64]
- Fallback Handling: If contact not found on receiving device, display
@[unknown]
with original text
Security and Privacy Considerations
Information Leak Mitigation
- Local Resolution: Never transmit plain
@username
over network – resolve to contact ID before sending[10][24]
- Access Control:
- Validate mention visibility against group membership
- Prevent @all in large public groups without moderation
- GDPR Compliance: Mention data subject to existing deletion policies[3][10]
Community Ecosystem Impact
Third-Party Client Support
Development Roadmap
Phase 1: Core Functionality (6 Weeks)
- Implement parser changes in message-parser v0.13.0
- Add JSON-RPC endpoints for contact resolution
- Desktop UI prototype with basic highlighting
Phase 2: Ecosystem Integration (4 Weeks)
- Android/iOS API alignment
- Group mention settings UI
- Automated test coverage (80%+)
Phase 3: Optimization (2 Weeks)
- Performance benchmarking against 10k messages
- Accessibility audits for screen readers
- Final security review
Challenges and Mitigation Strategies
Challenge 1: Name collisions in contact resolution
- Solution: Prioritize exact matches, then implement disambiguation UI
Challenge 2: History synchronization
- Solution: Include mention metadata in message sync packets
Challenge 3: Spam prevention
- Solution: Rate limit @mentions in public groups (5/minute/user)
Conclusion and Next Steps
Implementing @mentions
enhances Delta Chat’s usability while maintaining its privacy-first ethos. The proposed architecture leverages existing components like the message parser and JSON-RPC API, ensuring maintainability. Contributors should:
- Fork
deltachat/message-parser
to implement AST changes
- Collaborate with core team via GitHub Discussions
- Submit initial PR with parser tests and basic UI
This feature positions Delta Chat closer to mainstream messaging UX while preserving its decentralized email-based foundation[12][24][52]. Future extensions could include @channel mentions and notification settings per-mention type.