chatmail / chatmail/core

JSON-RPC needs better draft handling

Open
#8,485 5 comments 0 reactions 1 assignee Claimed by @WofWca View on GitHub
jsonrpc
Dominant language
Rust
Stars
929
Forks
143
Avg merge
1d 20h
Merged PRs (30d)
53

Description

desktop has not yet implemented the "allow to open webxdc in draft mode" because there is no API to update existing draft, only replace it completely (there is `miscSendDraft` but that is a hack for bots, only to send a draft that once set can't be altered ex. the text message part can't be changed anymore etc)

to solve the problem it would be good if API is introduced so that JSON RPC works more similar to how things are done in Android/iOS:

- `rpc.send_draft(account_id, msg_id)` API to send an existing draft (msg_id obtained from `rpc.get_draft`)
- `rpc.update_webxdc_draft(account_id, msg_id, text, quoted_message_id)` basically very similar to `misc_set_draft` but without the `view_type`, `file` and `filename` arguments, and instead the `msg_id` of the existing draft to be updated

for other messages that are not webxdc just as on android/ios you don't need to worry about updating the draft and can set a new draft every time so better keep the api focused on webxdc, but alternatively a more generic API could be added: `rpc.update_draft(account_id, msg_id, text, file, filename, quoted_message_id)` but let's not write code for a future that might not come

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.