chore: deltachat-jsonrpc/src/api/types/events.rs: Apply rustfmt

This commit is contained in:
iequidoo
2024-01-10 16:38:40 -03:00
committed by iequidoo
parent d5da2bed75
commit 406b59501b

View File

@@ -28,55 +28,37 @@ pub enum EventType {
/// ///
/// This event should *not* be reported to the end-user using a popup or something like /// This event should *not* be reported to the end-user using a popup or something like
/// that. /// that.
Info { Info { msg: String },
msg: String,
},
/// Emitted when SMTP connection is established and login was successful. /// Emitted when SMTP connection is established and login was successful.
SmtpConnected { SmtpConnected { msg: String },
msg: String,
},
/// Emitted when IMAP connection is established and login was successful. /// Emitted when IMAP connection is established and login was successful.
ImapConnected { ImapConnected { msg: String },
msg: String,
},
/// Emitted when a message was successfully sent to the SMTP server. /// Emitted when a message was successfully sent to the SMTP server.
SmtpMessageSent { SmtpMessageSent { msg: String },
msg: String,
},
/// Emitted when an IMAP message has been marked as deleted /// Emitted when an IMAP message has been marked as deleted
ImapMessageDeleted { ImapMessageDeleted { msg: String },
msg: String,
},
/// Emitted when an IMAP message has been moved /// Emitted when an IMAP message has been moved
ImapMessageMoved { ImapMessageMoved { msg: String },
msg: String,
},
/// Emitted before going into IDLE on the Inbox folder. /// Emitted before going into IDLE on the Inbox folder.
ImapInboxIdle, ImapInboxIdle,
/// Emitted when an new file in the $BLOBDIR was created /// Emitted when an new file in the $BLOBDIR was created
NewBlobFile { NewBlobFile { file: String },
file: String,
},
/// Emitted when an file in the $BLOBDIR was deleted /// Emitted when an file in the $BLOBDIR was deleted
DeletedBlobFile { DeletedBlobFile { file: String },
file: String,
},
/// The library-user should write a warning string to the log. /// The library-user should write a warning string to the log.
/// ///
/// This event should *not* be reported to the end-user using a popup or something like /// This event should *not* be reported to the end-user using a popup or something like
/// that. /// that.
Warning { Warning { msg: String },
msg: String,
},
/// The library-user should report an error to the end-user. /// The library-user should report an error to the end-user.
/// ///
@@ -88,18 +70,14 @@ pub enum EventType {
/// it might be better to delay showing these events until the function has really /// it might be better to delay showing these events until the function has really
/// failed (returned false). It should be sufficient to report only the *last* error /// failed (returned false). It should be sufficient to report only the *last* error
/// in a messasge box then. /// in a messasge box then.
Error { Error { msg: String },
msg: String,
},
/// An action cannot be performed because the user is not in the group. /// An action cannot be performed because the user is not in the group.
/// Reported eg. after a call to /// Reported eg. after a call to
/// setChatName(), setChatProfileImage(), /// setChatName(), setChatProfileImage(),
/// addContactToChat(), removeContactFromChat(), /// addContactToChat(), removeContactFromChat(),
/// and messages sending functions. /// and messages sending functions.
ErrorSelfNotInGroup { ErrorSelfNotInGroup { msg: String },
msg: String,
},
/// Messages or chats changed. One or more messages or chats changed for various /// Messages or chats changed. One or more messages or chats changed for various
/// reasons in the database: /// reasons in the database:
@@ -110,10 +88,7 @@ pub enum EventType {
/// `chatId` is set if only a single chat is affected by the changes, otherwise 0. /// `chatId` is set if only a single chat is affected by the changes, otherwise 0.
/// `msgId` is set if only a single message is affected by the changes, otherwise 0. /// `msgId` is set if only a single message is affected by the changes, otherwise 0.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgsChanged { MsgsChanged { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// Reactions for the message changed. /// Reactions for the message changed.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
@@ -128,10 +103,7 @@ pub enum EventType {
/// ///
/// There is no extra #DC_EVENT_MSGS_CHANGED event send together with this event. /// There is no extra #DC_EVENT_MSGS_CHANGED event send together with this event.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
IncomingMsg { IncomingMsg { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// Downloading a bunch of messages just finished. This is an experimental /// Downloading a bunch of messages just finished. This is an experimental
/// event to allow the UI to only show one notification per message bunch, /// event to allow the UI to only show one notification per message bunch,
@@ -139,47 +111,31 @@ pub enum EventType {
/// ///
/// msg_ids contains the message ids. /// msg_ids contains the message ids.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
IncomingMsgBunch { IncomingMsgBunch { msg_ids: Vec<u32> },
msg_ids: Vec<u32>,
},
/// Messages were seen or noticed. /// Messages were seen or noticed.
/// chat id is always set. /// chat id is always set.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgsNoticed { MsgsNoticed { chat_id: u32 },
chat_id: u32,
},
/// A single message is sent successfully. State changed from DC_STATE_OUT_PENDING to /// A single message is sent successfully. State changed from DC_STATE_OUT_PENDING to
/// DC_STATE_OUT_DELIVERED, see `Message.state`. /// DC_STATE_OUT_DELIVERED, see `Message.state`.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgDelivered { MsgDelivered { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// A single message could not be sent. State changed from DC_STATE_OUT_PENDING or DC_STATE_OUT_DELIVERED to /// A single message could not be sent. State changed from DC_STATE_OUT_PENDING or DC_STATE_OUT_DELIVERED to
/// DC_STATE_OUT_FAILED, see `Message.state`. /// DC_STATE_OUT_FAILED, see `Message.state`.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgFailed { MsgFailed { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// A single message is read by the receiver. State changed from DC_STATE_OUT_DELIVERED to /// A single message is read by the receiver. State changed from DC_STATE_OUT_DELIVERED to
/// DC_STATE_OUT_MDN_RCVD, see `Message.state`. /// DC_STATE_OUT_MDN_RCVD, see `Message.state`.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgRead { MsgRead { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// A single message is deleted. /// A single message is deleted.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
MsgDeleted { MsgDeleted { chat_id: u32, msg_id: u32 },
chat_id: u32,
msg_id: u32,
},
/// Chat changed. The name or the image of a chat group was changed or members were added or removed. /// Chat changed. The name or the image of a chat group was changed or members were added or removed.
/// Or the verify state of a chat has changed. /// Or the verify state of a chat has changed.
@@ -189,24 +145,17 @@ pub enum EventType {
/// This event does not include ephemeral timer modification, which /// This event does not include ephemeral timer modification, which
/// is a separate event. /// is a separate event.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ChatModified { ChatModified { chat_id: u32 },
chat_id: u32,
},
/// Chat ephemeral timer changed. /// Chat ephemeral timer changed.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ChatEphemeralTimerModified { ChatEphemeralTimerModified { chat_id: u32, timer: u32 },
chat_id: u32,
timer: u32,
},
/// Contact(s) created, renamed, blocked or deleted. /// Contact(s) created, renamed, blocked or deleted.
/// ///
/// @param data1 (int) If set, this is the contact_id of an added contact that should be selected. /// @param data1 (int) If set, this is the contact_id of an added contact that should be selected.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ContactsChanged { ContactsChanged { contact_id: Option<u32> },
contact_id: Option<u32>,
},
/// Location of one or more contact has changed. /// Location of one or more contact has changed.
/// ///
@@ -214,9 +163,7 @@ pub enum EventType {
/// If the locations of several contacts have been changed, /// If the locations of several contacts have been changed,
/// this parameter is set to `None`. /// this parameter is set to `None`.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
LocationChanged { LocationChanged { contact_id: Option<u32> },
contact_id: Option<u32>,
},
/// Inform about the configuration progress started by configure(). /// Inform about the configuration progress started by configure().
ConfigureProgress { ConfigureProgress {
@@ -234,9 +181,7 @@ pub enum EventType {
/// @param data1 (usize) 0=error, 1-999=progress in permille, 1000=success and done /// @param data1 (usize) 0=error, 1-999=progress in permille, 1000=success and done
/// @param data2 0 /// @param data2 0
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ImexProgress { ImexProgress { progress: usize },
progress: usize,
},
/// A file has been exported. A file has been written by imex(). /// A file has been exported. A file has been written by imex().
/// This event may be sent multiple times by a single call to imex(). /// This event may be sent multiple times by a single call to imex().
@@ -246,9 +191,7 @@ pub enum EventType {
/// ///
/// @param data2 0 /// @param data2 0
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
ImexFileWritten { ImexFileWritten { path: String },
path: String,
},
/// Progress information of a secure-join handshake from the view of the inviter /// Progress information of a secure-join handshake from the view of the inviter
/// (Alice, the person who shows the QR code). /// (Alice, the person who shows the QR code).
@@ -263,10 +206,7 @@ pub enum EventType {
/// 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol. /// 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol.
/// 1000=Protocol finished for this contact. /// 1000=Protocol finished for this contact.
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
SecurejoinInviterProgress { SecurejoinInviterProgress { contact_id: u32, progress: usize },
contact_id: u32,
progress: usize,
},
/// Progress information of a secure-join handshake from the view of the joiner /// Progress information of a secure-join handshake from the view of the joiner
/// (Bob, the person who scans the QR code). /// (Bob, the person who scans the QR code).
@@ -277,10 +217,7 @@ pub enum EventType {
/// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." /// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
/// (Bob has verified alice and waits until Alice does the same for him) /// (Bob has verified alice and waits until Alice does the same for him)
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
SecurejoinJoinerProgress { SecurejoinJoinerProgress { contact_id: u32, progress: usize },
contact_id: u32,
progress: usize,
},
/// The connectivity to the server changed. /// The connectivity to the server changed.
/// This means that you should refresh the connectivity view /// This means that you should refresh the connectivity view
@@ -307,9 +244,7 @@ pub enum EventType {
/// Inform that a message containing a webxdc instance has been deleted /// Inform that a message containing a webxdc instance has been deleted
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
WebxdcInstanceDeleted { WebxdcInstanceDeleted { msg_id: u32 },
msg_id: u32,
},
} }
impl From<CoreEventType> for EventType { impl From<CoreEventType> for EventType {