pub struct Context {
pub(crate) inner: Arc<InnerContext>,
}
Expand description
The context for a single DeltaChat account.
This contains all the state for a single DeltaChat account, including background tasks
running in Tokio to operate the account. The Context
can be cheaply cloned.
Each context, and thus each account, must be associated with an directory where all the state is kept. This state is also preserved between restarts.
To use multiple accounts it is best to look at the accounts manager which handles storing multiple accounts in a single directory structure and handles loading them all concurrently.
Fields§
§inner: Arc<InnerContext>
Implementations§
source§impl Context
impl Context
sourcepub fn set_last_error(&self, error: &str)
pub fn set_last_error(&self, error: &str)
Set last error string. Implemented as blocking as used from macros in different, not always async blocks.
sourcepub fn get_last_error(&self) -> String
pub fn get_last_error(&self) -> String
Get last error string.
source§impl Context
impl Context
sourcepub(crate) async fn sync_alter_chat(
&self,
id: &SyncId,
action: &SyncAction
) -> Result<()>
pub(crate) async fn sync_alter_chat( &self, id: &SyncId, action: &SyncAction ) -> Result<()>
Executes SyncData::AlterChat
item sent by other device.
source§impl Context
impl Context
sourcepub async fn config_exists(&self, key: Config) -> Result<bool>
pub async fn config_exists(&self, key: Config) -> Result<bool>
Returns true if configuration value is set for the given key.
sourcepub async fn get_config(&self, key: Config) -> Result<Option<String>>
pub async fn get_config(&self, key: Config) -> Result<Option<String>>
Get a configuration key. Returns None
if no value is set, and no default value found.
sourcepub async fn get_config_parsed<T: FromStr>(
&self,
key: Config
) -> Result<Option<T>>
pub async fn get_config_parsed<T: FromStr>( &self, key: Config ) -> Result<Option<T>>
Returns Some(T) if a value for the given key exists and was successfully parsed. Returns None if could not parse.
sourcepub async fn get_config_int(&self, key: Config) -> Result<i32>
pub async fn get_config_int(&self, key: Config) -> Result<i32>
Returns 32-bit signed integer configuration value for the given key.
sourcepub async fn get_config_u32(&self, key: Config) -> Result<u32>
pub async fn get_config_u32(&self, key: Config) -> Result<u32>
Returns 32-bit unsigned integer configuration value for the given key.
sourcepub async fn get_config_i64(&self, key: Config) -> Result<i64>
pub async fn get_config_i64(&self, key: Config) -> Result<i64>
Returns 64-bit signed integer configuration value for the given key.
sourcepub async fn get_config_u64(&self, key: Config) -> Result<u64>
pub async fn get_config_u64(&self, key: Config) -> Result<u64>
Returns 64-bit unsigned integer configuration value for the given key.
sourcepub async fn get_config_bool_opt(&self, key: Config) -> Result<Option<bool>>
pub async fn get_config_bool_opt(&self, key: Config) -> Result<Option<bool>>
Returns boolean configuration value (if any) for the given key.
sourcepub async fn get_config_bool(&self, key: Config) -> Result<bool>
pub async fn get_config_bool(&self, key: Config) -> Result<bool>
Returns boolean configuration value for the given key.
sourcepub(crate) async fn should_watch_mvbox(&self) -> Result<bool>
pub(crate) async fn should_watch_mvbox(&self) -> Result<bool>
Returns true if movebox (“DeltaChat” folder) should be watched.
sourcepub async fn get_config_delete_server_after(&self) -> Result<Option<i64>>
pub async fn get_config_delete_server_after(&self) -> Result<Option<i64>>
Gets configured “delete_server_after” value.
None
means never delete the message, Some(0)
means delete
at once, Some(x)
means delete after x
seconds.
sourcepub async fn get_configured_provider(&self) -> Result<Option<&'static Provider>>
pub async fn get_configured_provider(&self) -> Result<Option<&'static Provider>>
Gets the configured provider, as saved in the configured_provider
value.
The provider is determined by get_provider_info()
during configuration and then saved
to the db in param.save_to_database()
, together with all the other configured_*
values.
sourcepub async fn get_config_delete_device_after(&self) -> Result<Option<i64>>
pub async fn get_config_delete_device_after(&self) -> Result<Option<i64>>
Gets configured “delete_device_after” value.
None
means never delete the message, Some(x)
means delete
after x
seconds.
sourcepub async fn set_config(&self, key: Config, value: Option<&str>) -> Result<()>
pub async fn set_config(&self, key: Config, value: Option<&str>) -> Result<()>
Set the given config key.
If None
is passed as a value the value is cleared and set to the default if there is one.
pub(crate) async fn set_config_ex( &self, sync: Sync, key: Config, value: Option<&str> ) -> Result<()>
sourcepub async fn set_config_u32(&self, key: Config, value: u32) -> Result<()>
pub async fn set_config_u32(&self, key: Config, value: u32) -> Result<()>
Set the given config to an unsigned 32-bit integer value.
sourcepub async fn set_config_bool(&self, key: Config, value: bool) -> Result<()>
pub async fn set_config_bool(&self, key: Config, value: bool) -> Result<()>
Set the given config to a boolean value.
source§impl Context
impl Context
sourcepub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool>
pub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool>
Determine whether the specified addr maps to the/a self addr.
Returns false
if no addresses are configured.
sourcepub(crate) async fn set_primary_self_addr(
&self,
primary_new: &str
) -> Result<()>
pub(crate) async fn set_primary_self_addr( &self, primary_new: &str ) -> Result<()>
Sets primary_new
as the new primary self address and saves the old
primary address (if exists) as a secondary address.
This should only be used by test code and during configure.
sourcepub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>>
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>>
Returns all primary and secondary self addresses.
sourcepub(crate) async fn get_secondary_self_addrs(&self) -> Result<Vec<String>>
pub(crate) async fn get_secondary_self_addrs(&self) -> Result<Vec<String>>
Returns all secondary self addresses.
sourcepub async fn get_primary_self_addr(&self) -> Result<String>
pub async fn get_primary_self_addr(&self) -> Result<String>
Returns the primary self address. Returns an error if no self addr is configured.
source§impl Context
impl Context
sourcepub async fn new(
dbfile: &Path,
id: u32,
events: Events,
stock_strings: StockStrings
) -> Result<Context>
pub async fn new( dbfile: &Path, id: u32, events: Events, stock_strings: StockStrings ) -> Result<Context>
Creates new context and opens the database.
sourcepub async fn new_closed(
dbfile: &Path,
id: u32,
events: Events,
stockstrings: StockStrings
) -> Result<Context>
pub async fn new_closed( dbfile: &Path, id: u32, events: Events, stockstrings: StockStrings ) -> Result<Context>
Creates new context without opening the database.
sourcepub async fn open(&self, passphrase: String) -> Result<bool>
pub async fn open(&self, passphrase: String) -> Result<bool>
Opens the database with the given passphrase.
Returns true if passphrase is correct, false is passphrase is not correct. Fails on other errors.
sourcepub async fn change_passphrase(&self, passphrase: String) -> Result<()>
pub async fn change_passphrase(&self, passphrase: String) -> Result<()>
Changes encrypted database passphrase.
sourcepub(crate) async fn check_passphrase(&self, passphrase: String) -> Result<bool>
pub(crate) async fn check_passphrase(&self, passphrase: String) -> Result<bool>
Tests the database passphrase.
Returns true if passphrase is correct.
Fails if database is already open.
pub(crate) fn with_blobdir( dbfile: PathBuf, blobdir: PathBuf, id: u32, events: Events, stockstrings: StockStrings ) -> Result<Context>
sourcepub async fn restart_io_if_running(&self)
pub async fn restart_io_if_running(&self)
Restarts the IO scheduler if it was running before when it is not running this is an no-op
sourcepub async fn maybe_network(&self)
pub async fn maybe_network(&self)
Indicate that the network likely has come back.
pub(crate) async fn schedule_resync(&self) -> Result<()>
sourcepub fn get_dbfile(&self) -> &Path
pub fn get_dbfile(&self) -> &Path
Returns database file path.
sourcepub fn get_blobdir(&self) -> &Path
pub fn get_blobdir(&self) -> &Path
Returns blob directory path.
sourcepub fn emit_event(&self, event: EventType)
pub fn emit_event(&self, event: EventType)
Emits a single event.
sourcepub fn emit_msgs_changed_without_ids(&self)
pub fn emit_msgs_changed_without_ids(&self)
Emits a generic MsgsChanged event (without chat or message id)
sourcepub fn emit_msgs_changed(&self, chat_id: ChatId, msg_id: MsgId)
pub fn emit_msgs_changed(&self, chat_id: ChatId, msg_id: MsgId)
Emits a MsgsChanged event with specified chat and message ids
sourcepub fn emit_incoming_msg(&self, chat_id: ChatId, msg_id: MsgId)
pub fn emit_incoming_msg(&self, chat_id: ChatId, msg_id: MsgId)
Emits an IncomingMsg event with specified chat and message ids
sourcepub fn get_event_emitter(&self) -> EventEmitter
pub fn get_event_emitter(&self) -> EventEmitter
Returns a receiver for emitted events.
Multiple emitters can be created, but note that in this case each emitted event will only be received by one of the emitters, not by all of them.
sourcepub(crate) async fn alloc_ongoing(&self) -> Result<Receiver<()>>
pub(crate) async fn alloc_ongoing(&self) -> Result<Receiver<()>>
Tries to acquire the global UI “ongoing” mutex.
This is for modal operations during which no other user actions are allowed. Only one such operation is allowed at any given time.
The return value is a cancel token, which will release the ongoing mutex when dropped.
pub(crate) async fn free_ongoing(&self)
sourcepub async fn stop_ongoing(&self)
pub async fn stop_ongoing(&self)
Signal an ongoing process to stop.
pub(crate) async fn shall_stop_ongoing(&self) -> bool
sourcepub async fn get_info(&self) -> Result<BTreeMap<&'static str, String>>
pub async fn get_info(&self) -> Result<BTreeMap<&'static str, String>>
Returns information about the context as key-value pairs.
sourcepub async fn get_fresh_msgs(&self) -> Result<Vec<MsgId>>
pub async fn get_fresh_msgs(&self) -> Result<Vec<MsgId>>
Get a list of fresh, unmuted messages in unblocked chats.
The list starts with the most recent message and is typically used to show notifications. Moreover, the number of returned messages can be used for a badge counter on the app icon.
sourcepub async fn get_next_msgs(&self) -> Result<Vec<MsgId>>
pub async fn get_next_msgs(&self) -> Result<Vec<MsgId>>
Returns a list of messages with database ID higher than requested.
Blocked contacts and chats are excluded, but self-sent messages and contact requests are included in the results.
sourcepub async fn wait_next_msgs(&self) -> Result<Vec<MsgId>>
pub async fn wait_next_msgs(&self) -> Result<Vec<MsgId>>
Returns a list of messages with database ID higher than last marked as seen.
This function is supposed to be used by bot to request messages that are not processed yet.
Waits for notification and returns a result.
Note that the result may be empty if the message is deleted
shortly after notification or notification is manually triggered
to interrupt waiting.
Notification may be manually triggered by calling Self::stop_io
.
sourcepub async fn search_msgs(
&self,
chat_id: Option<ChatId>,
query: &str
) -> Result<Vec<MsgId>>
pub async fn search_msgs( &self, chat_id: Option<ChatId>, query: &str ) -> Result<Vec<MsgId>>
Searches for messages containing the query string.
If chat_id
is provided this searches only for messages in this chat, if chat_id
is None
this searches messages from all chats.
sourcepub async fn is_inbox(&self, folder_name: &str) -> Result<bool>
pub async fn is_inbox(&self, folder_name: &str) -> Result<bool>
Returns true if given folder name is the name of the inbox.
sourcepub async fn is_sentbox(&self, folder_name: &str) -> Result<bool>
pub async fn is_sentbox(&self, folder_name: &str) -> Result<bool>
Returns true if given folder name is the name of the “sent” folder.
sourcepub async fn is_mvbox(&self, folder_name: &str) -> Result<bool>
pub async fn is_mvbox(&self, folder_name: &str) -> Result<bool>
Returns true if given folder name is the name of the “Delta Chat” folder.
sourcepub async fn is_trash(&self, folder_name: &str) -> Result<bool>
pub async fn is_trash(&self, folder_name: &str) -> Result<bool>
Returns true if given folder name is the name of the trash folder.
pub(crate) async fn should_delete_to_trash(&self) -> Result<bool>
sourcepub(crate) async fn get_delete_msgs_target(&self) -> Result<String>
pub(crate) async fn get_delete_msgs_target(&self) -> Result<String>
Returns target
for deleted messages as per imap
table. Empty string means “delete w/o
moving to trash”.
pub(crate) fn derive_blobdir(dbfile: &Path) -> PathBuf
pub(crate) fn derive_walfile(dbfile: &Path) -> PathBuf
source§impl Context
impl Context
sourcepub(crate) async fn update_recent_quota(&self, imap: &mut Imap) -> Result<()>
pub(crate) async fn update_recent_quota(&self, imap: &mut Imap) -> Result<()>
Updates quota.recent
, sets quota.modified
to the current time
and emits an event to let the UIs update connectivity view.
Moreover, once each time quota gets larger than QUOTA_WARN_THRESHOLD_PERCENTAGE
,
a device message is added.
As the message is added only once, the user is not spammed
in case for some providers the quota is always at ~100%
and new space is allocated as needed.
source§impl Context
impl Context
sourcepub async fn get_connectivity(&self) -> Connectivity
pub async fn get_connectivity(&self) -> Connectivity
Get the current connectivity, i.e. whether the device is connected to the IMAP server. One of:
- DC_CONNECTIVITY_NOT_CONNECTED (1000-1999): Show e.g. the string “Not connected” or a red dot
- DC_CONNECTIVITY_CONNECTING (2000-2999): Show e.g. the string “Connecting…” or a yellow dot
- DC_CONNECTIVITY_WORKING (3000-3999): Show e.g. the string “Updating…” or a spinning wheel
- DC_CONNECTIVITY_CONNECTED (>=4000): Show e.g. the string “Connected” or a green dot
We don’t use exact values but ranges here so that we can split up states into multiple states in the future.
Meant as a rough overview that can be shown e.g. in the title of the main screen.
If the connectivity changes, a DC_EVENT_CONNECTIVITY_CHANGED will be emitted.
sourcepub async fn get_connectivity_html(&self) -> Result<String>
pub async fn get_connectivity_html(&self) -> Result<String>
Get an overview of the current connectivity, and possibly more statistics. Meant to give the user more insight about the current status than the basic connectivity info returned by dc_get_connectivity(); show this e.g., if the user taps on said basic connectivity info.
If this page changes, a DC_EVENT_CONNECTIVITY_CHANGED will be emitted.
This comes as an HTML from the core so that we can easily improve it and the improvement instantly reaches all UIs.
sourcepub async fn all_work_done(&self) -> bool
pub async fn all_work_done(&self) -> bool
Returns true if all background work is done.
source§impl Context
impl Context
sourcepub async fn set_stock_translation(
&self,
id: StockMessage,
stockstring: String
) -> Result<()>
pub async fn set_stock_translation( &self, id: StockMessage, stockstring: String ) -> Result<()>
Set the stock string for the StockMessage.
sourcepub(crate) async fn stock_protection_msg(
&self,
protect: ProtectionStatus,
contact_id: Option<ContactId>
) -> String
pub(crate) async fn stock_protection_msg( &self, protect: ProtectionStatus, contact_id: Option<ContactId> ) -> String
Returns a stock message saying that protection status has changed.
pub(crate) async fn update_device_chats(&self) -> Result<()>
source§impl Context
impl Context
sourcepub(crate) async fn add_sync_item(&self, data: SyncData) -> Result<()>
pub(crate) async fn add_sync_item(&self, data: SyncData) -> Result<()>
Adds an item to the list of items that should be synchronized to other devices.
NB: Private and pub(crate)
functions shouldn’t call this unless Sync::Sync
is explicitly
passed to them. This way it’s always clear whether the code performs synchronisation.
sourceasync fn add_sync_item_with_timestamp(
&self,
data: SyncData,
timestamp: i64
) -> Result<()>
async fn add_sync_item_with_timestamp( &self, data: SyncData, timestamp: i64 ) -> Result<()>
Adds item and timestamp to the list of items that should be synchronized to other devices. If device synchronization is disabled, the function does nothing.
sourcepub(crate) async fn sync_qr_code_tokens(
&self,
chat_id: Option<ChatId>
) -> Result<()>
pub(crate) async fn sync_qr_code_tokens( &self, chat_id: Option<ChatId> ) -> Result<()>
Adds most recent qr-code tokens for a given chat to the list of items to be synced. If device synchronization is disabled, no tokens exist or the chat is unpromoted, the function does nothing.
sourcepub(crate) async fn sync_qr_code_token_deletion(
&self,
invitenumber: String,
auth: String
) -> Result<()>
pub(crate) async fn sync_qr_code_token_deletion( &self, invitenumber: String, auth: String ) -> Result<()>
Adds deleted qr-code token to the list of items to be synced so that the token also gets deleted on the other devices.
sourcepub async fn send_sync_msg(&self) -> Result<Option<MsgId>>
pub async fn send_sync_msg(&self) -> Result<Option<MsgId>>
Sends out a self-sent message with items to be synchronized, if any.
sourcepub(crate) async fn build_sync_json(&self) -> Result<Option<(String, String)>>
pub(crate) async fn build_sync_json(&self) -> Result<Option<(String, String)>>
Copies all sync items to a JSON string and clears the sync-table. Returns the JSON string and a comma-separated string of the IDs used.
pub(crate) fn build_sync_part(&self, json: String) -> PartBuilder
sourcepub(crate) async fn delete_sync_ids(&self, ids: String) -> Result<()>
pub(crate) async fn delete_sync_ids(&self, ids: String) -> Result<()>
Deletes IDs as returned by build_sync_json()
.
sourcepub(crate) fn parse_sync_items(&self, serialized: String) -> Result<SyncItems>
pub(crate) fn parse_sync_items(&self, serialized: String) -> Result<SyncItems>
Takes a JSON string created by build_sync_json()
and construct SyncItems
from it.
sourcepub(crate) async fn execute_sync_items(&self, items: &SyncItems)
pub(crate) async fn execute_sync_items(&self, items: &SyncItems)
Executes sync items sent by other device.
CAVE: When changing the code to handle other sync items,
take care that does not result in calls to add_sync_item()
as otherwise we would add in a dead-loop between two devices
sending message back and forth.
If an error is returned, the caller shall not try over because some sync items could be already executed. Sync items are considered independent and executed in the given order but regardless of whether executing of the previous items succeeded.
async fn add_qr_token(&self, token: &QrTokenData) -> Result<()>
async fn delete_qr_token(&self, token: &QrTokenData) -> Result<()>
source§impl Context
impl Context
sourcepub(crate) async fn update_contacts_timestamp(
&self,
contact_id: ContactId,
scope: Param,
new_timestamp: i64
) -> Result<bool>
pub(crate) async fn update_contacts_timestamp( &self, contact_id: ContactId, scope: Param, new_timestamp: i64 ) -> Result<bool>
Updates a contact’s timestamp, if reasonable. Returns true if the caller shall update the settings belonging to the scope. (if we have a ContactId type at some point, the function should go there)
source§impl Context
impl Context
sourcepub(crate) async fn is_webxdc_file(
&self,
filename: &str,
file: &[u8]
) -> Result<bool>
pub(crate) async fn is_webxdc_file( &self, filename: &str, file: &[u8] ) -> Result<bool>
check if a file is an acceptable webxdc for sending or receiving.
sourcepub(crate) async fn ensure_sendable_webxdc_file(
&self,
path: &Path
) -> Result<()>
pub(crate) async fn ensure_sendable_webxdc_file( &self, path: &Path ) -> Result<()>
ensure that a file is an acceptable webxdc for sending (sending has more strict size limits).
sourceasync fn get_overwritable_info_msg_id(
&self,
instance: &Message,
from_id: ContactId
) -> Result<Option<MsgId>>
async fn get_overwritable_info_msg_id( &self, instance: &Message, from_id: ContactId ) -> Result<Option<MsgId>>
Check if the last message of a chat is an info message belonging to the given instance and sender. If so, the id of this message is returned.
sourceasync fn create_status_update_record(
&self,
instance: &mut Message,
status_update_item: StatusUpdateItem,
timestamp: i64,
can_info_msg: bool,
from_id: ContactId
) -> Result<Option<StatusUpdateSerial>>
async fn create_status_update_record( &self, instance: &mut Message, status_update_item: StatusUpdateItem, timestamp: i64, can_info_msg: bool, from_id: ContactId ) -> Result<Option<StatusUpdateSerial>>
Takes an update-json as {payload: PAYLOAD}
writes it to the database and handles events, info-messages, document name and summary.
sourcepub(crate) async fn write_status_update_inner(
&self,
instance_id: &MsgId,
status_update_item: &StatusUpdateItem
) -> Result<Option<StatusUpdateSerial>>
pub(crate) async fn write_status_update_inner( &self, instance_id: &MsgId, status_update_item: &StatusUpdateItem ) -> Result<Option<StatusUpdateSerial>>
Inserts a status update item into msgs_status_updates
table.
Returns serial ID of the status update if a new item is inserted.
sourcepub async fn get_status_update(
&self,
msg_id: MsgId,
status_update_serial: StatusUpdateSerial
) -> Result<String>
pub async fn get_status_update( &self, msg_id: MsgId, status_update_serial: StatusUpdateSerial ) -> Result<String>
Returns the update_item with status_update_serial
from the webxdc with message id msg_id
.
sourcepub async fn send_webxdc_status_update(
&self,
instance_msg_id: MsgId,
update_str: &str,
descr: &str
) -> Result<()>
pub async fn send_webxdc_status_update( &self, instance_msg_id: MsgId, update_str: &str, descr: &str ) -> Result<()>
Sends a status update for an webxdc instance.
If the instance is a draft, the status update is sent once the instance is actually sent. Otherwise, the update is sent as soon as possible.
sourcepub async fn send_webxdc_status_update_struct(
&self,
instance_msg_id: MsgId,
status_update: StatusUpdateItem,
descr: &str
) -> Result<()>
pub async fn send_webxdc_status_update_struct( &self, instance_msg_id: MsgId, status_update: StatusUpdateItem, descr: &str ) -> Result<()>
Sends a status update for an webxdc instance. Also see Self::send_webxdc_status_update
sourceasync fn pop_smtp_status_update(
&self
) -> Result<Option<(MsgId, StatusUpdateSerial, StatusUpdateSerial, String)>>
async fn pop_smtp_status_update( &self ) -> Result<Option<(MsgId, StatusUpdateSerial, StatusUpdateSerial, String)>>
Pops one record of queued webxdc status updates. This function exists to make the sqlite statement testable.
sourcepub(crate) async fn flush_status_updates(&self) -> Result<()>
pub(crate) async fn flush_status_updates(&self) -> Result<()>
Attempts to send queued webxdc status updates.
pub(crate) fn build_status_update_part(&self, json: &str) -> PartBuilder
sourcepub(crate) async fn receive_status_update(
&self,
from_id: ContactId,
msg_id: MsgId,
json: &str
) -> Result<()>
pub(crate) async fn receive_status_update( &self, from_id: ContactId, msg_id: MsgId, json: &str ) -> Result<()>
Receives status updates from receive_imf to the database and sends out an event.
from_id
is the sender
msg_id
may be an instance (in case there are initial status updates)
or a reply to an instance (for all other updates).
json
is an array containing one or more update items as created by send_webxdc_status_update(),
the array is parsed using serde, the single payloads are used as is.
sourcepub async fn get_webxdc_status_updates(
&self,
instance_msg_id: MsgId,
last_known_serial: StatusUpdateSerial
) -> Result<String>
pub async fn get_webxdc_status_updates( &self, instance_msg_id: MsgId, last_known_serial: StatusUpdateSerial ) -> Result<String>
Returns status updates as an JSON-array, ready to be consumed by a webxdc.
Example: [{"serial":1, "max_serial":3, "payload":"any update data"}, {"serial":3, "max_serial":3, "payload":"another update data"}]
Updates with serials larger than last_known_serial
are returned.
If no last serial is known, set last_known_serial
to 0.
If no updates are available, an empty JSON-array is returned.
sourcepub(crate) async fn render_webxdc_status_update_object(
&self,
instance_msg_id: MsgId,
range: Option<(StatusUpdateSerial, StatusUpdateSerial)>
) -> Result<Option<String>>
pub(crate) async fn render_webxdc_status_update_object( &self, instance_msg_id: MsgId, range: Option<(StatusUpdateSerial, StatusUpdateSerial)> ) -> Result<Option<String>>
Renders JSON-object for status updates as used on the wire.
Example: {"updates": [{"payload":"any update data"}, {"payload":"another update data"}]}
range
is an optional range of status update serials to send.
If it is None
, all updates are sent.
This is used when a message is resent using crate::chat::resend_msgs
.