mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 08:16:32 +03:00
add some empty lines to enums & co to make things more readable and to avoid errors this way :)
This commit is contained in:
committed by
holger krekel
parent
980bb35441
commit
7f6a1ad1a7
@@ -191,6 +191,7 @@ pub const AVATAR_SIZE: u32 = 192;
|
|||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum Viewtype {
|
pub enum Viewtype {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
|
|
||||||
/// Text message.
|
/// Text message.
|
||||||
/// The text of the message is set using dc_msg_set_text()
|
/// The text of the message is set using dc_msg_set_text()
|
||||||
/// and retrieved with dc_msg_get_text().
|
/// and retrieved with dc_msg_get_text().
|
||||||
|
|||||||
@@ -48,20 +48,26 @@ pub struct Contact {
|
|||||||
///
|
///
|
||||||
/// Normal contact IDs are larger than these special ones (larger than DC_CONTACT_ID_LAST_SPECIAL).
|
/// Normal contact IDs are larger than these special ones (larger than DC_CONTACT_ID_LAST_SPECIAL).
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
|
|
||||||
/// Contact name. It is recommended to use `Contact::get_name`,
|
/// Contact name. It is recommended to use `Contact::get_name`,
|
||||||
/// `Contact::get_display_name` or `Contact::get_name_n_addr` to access this field.
|
/// `Contact::get_display_name` or `Contact::get_name_n_addr` to access this field.
|
||||||
/// May be empty, initially set to `authname`.
|
/// May be empty, initially set to `authname`.
|
||||||
name: String,
|
name: String,
|
||||||
|
|
||||||
/// Name authorized by the contact himself. Only this name may be spread to others,
|
/// Name authorized by the contact himself. Only this name may be spread to others,
|
||||||
/// e.g. in To:-lists. May be empty. It is recommended to use `Contact::get_authname`,
|
/// e.g. in To:-lists. May be empty. It is recommended to use `Contact::get_authname`,
|
||||||
/// to access this field.
|
/// to access this field.
|
||||||
authname: String,
|
authname: String,
|
||||||
|
|
||||||
/// E-Mail-Address of the contact. It is recommended to use `Contact::get_addr`` to access this field.
|
/// E-Mail-Address of the contact. It is recommended to use `Contact::get_addr`` to access this field.
|
||||||
addr: String,
|
addr: String,
|
||||||
|
|
||||||
/// Blocked state. Use dc_contact_is_blocked to access this field.
|
/// Blocked state. Use dc_contact_is_blocked to access this field.
|
||||||
blocked: bool,
|
blocked: bool,
|
||||||
|
|
||||||
/// The origin/source of the contact.
|
/// The origin/source of the contact.
|
||||||
pub origin: Origin,
|
pub origin: Origin,
|
||||||
|
|
||||||
/// Parameters as Param::ProfileImage
|
/// Parameters as Param::ProfileImage
|
||||||
pub param: Params,
|
pub param: Params,
|
||||||
}
|
}
|
||||||
@@ -73,36 +79,52 @@ pub struct Contact {
|
|||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum Origin {
|
pub enum Origin {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
|
|
||||||
/// From: of incoming messages of unknown sender
|
/// From: of incoming messages of unknown sender
|
||||||
IncomingUnknownFrom = 0x10,
|
IncomingUnknownFrom = 0x10,
|
||||||
|
|
||||||
/// Cc: of incoming messages of unknown sender
|
/// Cc: of incoming messages of unknown sender
|
||||||
IncomingUnknownCc = 0x20,
|
IncomingUnknownCc = 0x20,
|
||||||
|
|
||||||
/// To: of incoming messages of unknown sender
|
/// To: of incoming messages of unknown sender
|
||||||
IncomingUnknownTo = 0x40,
|
IncomingUnknownTo = 0x40,
|
||||||
|
|
||||||
/// address scanned but not verified
|
/// address scanned but not verified
|
||||||
UnhandledQrScan = 0x80,
|
UnhandledQrScan = 0x80,
|
||||||
|
|
||||||
/// Reply-To: of incoming message of known sender
|
/// Reply-To: of incoming message of known sender
|
||||||
IncomingReplyTo = 0x100,
|
IncomingReplyTo = 0x100,
|
||||||
|
|
||||||
/// Cc: of incoming message of known sender
|
/// Cc: of incoming message of known sender
|
||||||
IncomingCc = 0x200,
|
IncomingCc = 0x200,
|
||||||
|
|
||||||
/// additional To:'s of incoming message of known sender
|
/// additional To:'s of incoming message of known sender
|
||||||
IncomingTo = 0x400,
|
IncomingTo = 0x400,
|
||||||
|
|
||||||
/// a chat was manually created for this user, but no message yet sent
|
/// a chat was manually created for this user, but no message yet sent
|
||||||
CreateChat = 0x800,
|
CreateChat = 0x800,
|
||||||
|
|
||||||
/// message sent by us
|
/// message sent by us
|
||||||
OutgoingBcc = 0x1000,
|
OutgoingBcc = 0x1000,
|
||||||
|
|
||||||
/// message sent by us
|
/// message sent by us
|
||||||
OutgoingCc = 0x2000,
|
OutgoingCc = 0x2000,
|
||||||
|
|
||||||
/// message sent by us
|
/// message sent by us
|
||||||
OutgoingTo = 0x4000,
|
OutgoingTo = 0x4000,
|
||||||
|
|
||||||
/// internal use
|
/// internal use
|
||||||
Internal = 0x40000,
|
Internal = 0x40000,
|
||||||
|
|
||||||
/// address is in our address book
|
/// address is in our address book
|
||||||
AdressBook = 0x80000,
|
AdressBook = 0x80000,
|
||||||
|
|
||||||
/// set on Alice's side for contacts like Bob that have scanned the QR code offered by her. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() !
|
/// set on Alice's side for contacts like Bob that have scanned the QR code offered by her. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() !
|
||||||
SecurejoinInvited = 0x0100_0000,
|
SecurejoinInvited = 0x0100_0000,
|
||||||
|
|
||||||
/// set on Bob's side for contacts scanned and verified from a QR code. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() !
|
/// set on Bob's side for contacts scanned and verified from a QR code. Only means the contact has once been established using the "securejoin" procedure in the past, getting the current key verification status requires calling dc_contact_is_verified() !
|
||||||
SecurejoinJoined = 0x0200_0000,
|
SecurejoinJoined = 0x0200_0000,
|
||||||
|
|
||||||
/// contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names
|
/// contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names
|
||||||
ManuallyCreated = 0x0400_0000,
|
ManuallyCreated = 0x0400_0000,
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/error.rs
15
src/error.rs
@@ -6,34 +6,49 @@ use lettre_email::mime;
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
Failure(failure::Error),
|
Failure(failure::Error),
|
||||||
|
|
||||||
#[fail(display = "SQL error: {:?}", _0)]
|
#[fail(display = "SQL error: {:?}", _0)]
|
||||||
SqlError(#[cause] crate::sql::Error),
|
SqlError(#[cause] crate::sql::Error),
|
||||||
|
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
Io(std::io::Error),
|
Io(std::io::Error),
|
||||||
|
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
Message(String),
|
Message(String),
|
||||||
|
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
Image(image_meta::ImageError),
|
Image(image_meta::ImageError),
|
||||||
|
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
Utf8(std::str::Utf8Error),
|
Utf8(std::str::Utf8Error),
|
||||||
|
|
||||||
#[fail(display = "PGP: {:?}", _0)]
|
#[fail(display = "PGP: {:?}", _0)]
|
||||||
Pgp(pgp::errors::Error),
|
Pgp(pgp::errors::Error),
|
||||||
|
|
||||||
#[fail(display = "Base64Decode: {:?}", _0)]
|
#[fail(display = "Base64Decode: {:?}", _0)]
|
||||||
Base64Decode(base64::DecodeError),
|
Base64Decode(base64::DecodeError),
|
||||||
|
|
||||||
#[fail(display = "{:?}", _0)]
|
#[fail(display = "{:?}", _0)]
|
||||||
FromUtf8(std::string::FromUtf8Error),
|
FromUtf8(std::string::FromUtf8Error),
|
||||||
|
|
||||||
#[fail(display = "{}", _0)]
|
#[fail(display = "{}", _0)]
|
||||||
BlobError(#[cause] crate::blob::BlobError),
|
BlobError(#[cause] crate::blob::BlobError),
|
||||||
|
|
||||||
#[fail(display = "Invalid Message ID.")]
|
#[fail(display = "Invalid Message ID.")]
|
||||||
InvalidMsgId,
|
InvalidMsgId,
|
||||||
|
|
||||||
#[fail(display = "Watch folder not found {:?}", _0)]
|
#[fail(display = "Watch folder not found {:?}", _0)]
|
||||||
WatchFolderNotFound(String),
|
WatchFolderNotFound(String),
|
||||||
|
|
||||||
#[fail(display = "Invalid Email: {:?}", _0)]
|
#[fail(display = "Invalid Email: {:?}", _0)]
|
||||||
MailParseError(#[cause] mailparse::MailParseError),
|
MailParseError(#[cause] mailparse::MailParseError),
|
||||||
|
|
||||||
#[fail(display = "Building invalid Email: {:?}", _0)]
|
#[fail(display = "Building invalid Email: {:?}", _0)]
|
||||||
LettreError(#[cause] lettre_email::error::Error),
|
LettreError(#[cause] lettre_email::error::Error),
|
||||||
|
|
||||||
#[fail(display = "FromStr error: {:?}", _0)]
|
#[fail(display = "FromStr error: {:?}", _0)]
|
||||||
FromStr(#[cause] mime::FromStrError),
|
FromStr(#[cause] mime::FromStrError),
|
||||||
|
|
||||||
#[fail(display = "Not Configured")]
|
#[fail(display = "Not Configured")]
|
||||||
NotConfigured,
|
NotConfigured,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,16 +33,19 @@ pub enum ImexMode {
|
|||||||
/// and `private-key-default.asc`, if there are more keys, they are written to files as
|
/// and `private-key-default.asc`, if there are more keys, they are written to files as
|
||||||
/// `public-key-<id>.asc` and `private-key-<id>.asc`
|
/// `public-key-<id>.asc` and `private-key-<id>.asc`
|
||||||
ExportSelfKeys = 1,
|
ExportSelfKeys = 1,
|
||||||
|
|
||||||
/// Import private keys found in the directory given as `param1`.
|
/// Import private keys found in the directory given as `param1`.
|
||||||
/// The last imported key is made the default keys unless its name contains the string `legacy`.
|
/// The last imported key is made the default keys unless its name contains the string `legacy`.
|
||||||
/// Public keys are not imported.
|
/// Public keys are not imported.
|
||||||
ImportSelfKeys = 2,
|
ImportSelfKeys = 2,
|
||||||
|
|
||||||
/// Export a backup to the directory given as `param1`.
|
/// Export a backup to the directory given as `param1`.
|
||||||
/// The backup contains all contacts, chats, images and other data and device independent settings.
|
/// The backup contains all contacts, chats, images and other data and device independent settings.
|
||||||
/// The backup does not contain device dependent settings as ringtones or LED notification settings.
|
/// The backup does not contain device dependent settings as ringtones or LED notification settings.
|
||||||
/// The name of the backup is typically `delta-chat.<day>.bak`, if more than one backup is create on a day,
|
/// The name of the backup is typically `delta-chat.<day>.bak`, if more than one backup is create on a day,
|
||||||
/// the format is `delta-chat.<day>-<number>.bak`
|
/// the format is `delta-chat.<day>-<number>.bak`
|
||||||
ExportBackup = 11,
|
ExportBackup = 11,
|
||||||
|
|
||||||
/// `param1` is the file (not: directory) to import. The file is normally
|
/// `param1` is the file (not: directory) to import. The file is normally
|
||||||
/// created by DC_IMEX_EXPORT_BACKUP and detected by dc_imex_has_backup(). Importing a backup
|
/// created by DC_IMEX_EXPORT_BACKUP and detected by dc_imex_has_backup(). Importing a backup
|
||||||
/// is only possible as long as the context is not configured or used in another way.
|
/// is only possible as long as the context is not configured or used in another way.
|
||||||
|
|||||||
@@ -73,20 +73,28 @@ pub enum LotState {
|
|||||||
// Qr States
|
// Qr States
|
||||||
/// id=contact
|
/// id=contact
|
||||||
QrAskVerifyContact = 200,
|
QrAskVerifyContact = 200,
|
||||||
|
|
||||||
/// text1=groupname
|
/// text1=groupname
|
||||||
QrAskVerifyGroup = 202,
|
QrAskVerifyGroup = 202,
|
||||||
|
|
||||||
/// id=contact
|
/// id=contact
|
||||||
QrFprOk = 210,
|
QrFprOk = 210,
|
||||||
|
|
||||||
/// id=contact
|
/// id=contact
|
||||||
QrFprMissmatch = 220,
|
QrFprMissmatch = 220,
|
||||||
|
|
||||||
/// test1=formatted fingerprint
|
/// test1=formatted fingerprint
|
||||||
QrFprWithoutAddr = 230,
|
QrFprWithoutAddr = 230,
|
||||||
|
|
||||||
/// id=contact
|
/// id=contact
|
||||||
QrAddr = 320,
|
QrAddr = 320,
|
||||||
|
|
||||||
/// text1=text
|
/// text1=text
|
||||||
QrText = 330,
|
QrText = 330,
|
||||||
|
|
||||||
/// text1=URL
|
/// text1=URL
|
||||||
QrUrl = 332,
|
QrUrl = 332,
|
||||||
|
|
||||||
/// text1=error string
|
/// text1=error string
|
||||||
QrError = 400,
|
QrError = 400,
|
||||||
|
|
||||||
|
|||||||
30
src/param.rs
30
src/param.rs
@@ -16,36 +16,51 @@ use crate::mimeparser::SystemMessage;
|
|||||||
pub enum Param {
|
pub enum Param {
|
||||||
/// For messages and jobs
|
/// For messages and jobs
|
||||||
File = b'f',
|
File = b'f',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Width = b'w',
|
Width = b'w',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Height = b'h',
|
Height = b'h',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Duration = b'd',
|
Duration = b'd',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
MimeType = b'm',
|
MimeType = b'm',
|
||||||
/// For Messages: message is encryoted, outgoing: guarantee E2EE or the message is not send
|
|
||||||
|
/// For Messages: message is encrypted, outgoing: guarantee E2EE or the message is not send
|
||||||
GuaranteeE2ee = b'c',
|
GuaranteeE2ee = b'c',
|
||||||
|
|
||||||
/// For Messages: decrypted with validation errors or without mutual set, if neither
|
/// For Messages: decrypted with validation errors or without mutual set, if neither
|
||||||
/// 'c' nor 'e' are preset, the messages is only transport encrypted.
|
/// 'c' nor 'e' are preset, the messages is only transport encrypted.
|
||||||
ErroneousE2ee = b'e',
|
ErroneousE2ee = b'e',
|
||||||
|
|
||||||
/// For Messages: force unencrypted message, either `ForcePlaintext::AddAutocryptHeader` (1),
|
/// For Messages: force unencrypted message, either `ForcePlaintext::AddAutocryptHeader` (1),
|
||||||
/// `ForcePlaintext::NoAutocryptHeader` (2) or 0.
|
/// `ForcePlaintext::NoAutocryptHeader` (2) or 0.
|
||||||
ForcePlaintext = b'u',
|
ForcePlaintext = b'u',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
WantsMdn = b'r',
|
WantsMdn = b'r',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Forwarded = b'a',
|
Forwarded = b'a',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Cmd = b'S',
|
Cmd = b'S',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Arg = b'E',
|
Arg = b'E',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Arg2 = b'F',
|
Arg2 = b'F',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Arg3 = b'G',
|
Arg3 = b'G',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Arg4 = b'H',
|
Arg4 = b'H',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
Error = b'L',
|
Error = b'L',
|
||||||
|
|
||||||
@@ -62,30 +77,43 @@ pub enum Param {
|
|||||||
/// When the original message is then finally sent this parameter
|
/// When the original message is then finally sent this parameter
|
||||||
/// is used to also send all the forwarded messages.
|
/// is used to also send all the forwarded messages.
|
||||||
PrepForwards = b'P',
|
PrepForwards = b'P',
|
||||||
|
|
||||||
/// For Jobs
|
/// For Jobs
|
||||||
SetLatitude = b'l',
|
SetLatitude = b'l',
|
||||||
|
|
||||||
/// For Jobs
|
/// For Jobs
|
||||||
SetLongitude = b'n',
|
SetLongitude = b'n',
|
||||||
|
|
||||||
/// For Jobs
|
/// For Jobs
|
||||||
ServerFolder = b'Z',
|
ServerFolder = b'Z',
|
||||||
|
|
||||||
/// For Jobs
|
/// For Jobs
|
||||||
ServerUid = b'z',
|
ServerUid = b'z',
|
||||||
|
|
||||||
/// For Jobs
|
/// For Jobs
|
||||||
AlsoMove = b'M',
|
AlsoMove = b'M',
|
||||||
|
|
||||||
/// For Jobs: space-separated list of message recipients
|
/// For Jobs: space-separated list of message recipients
|
||||||
Recipients = b'R',
|
Recipients = b'R',
|
||||||
|
|
||||||
// For Groups
|
// For Groups
|
||||||
Unpromoted = b'U',
|
Unpromoted = b'U',
|
||||||
|
|
||||||
// For Groups and Contacts
|
// For Groups and Contacts
|
||||||
ProfileImage = b'i',
|
ProfileImage = b'i',
|
||||||
|
|
||||||
// For Chats
|
// For Chats
|
||||||
Selftalk = b'K',
|
Selftalk = b'K',
|
||||||
|
|
||||||
// For Chats
|
// For Chats
|
||||||
Devicetalk = b'D',
|
Devicetalk = b'D',
|
||||||
|
|
||||||
// For QR
|
// For QR
|
||||||
Auth = b's',
|
Auth = b's',
|
||||||
|
|
||||||
// For QR
|
// For QR
|
||||||
GroupId = b'x',
|
GroupId = b'x',
|
||||||
|
|
||||||
// For QR
|
// For QR
|
||||||
GroupName = b'g',
|
GroupName = b'g',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ pub enum ToSave {
|
|||||||
pub enum DegradeEvent {
|
pub enum DegradeEvent {
|
||||||
/// Recoverable by an incoming encrypted mail.
|
/// Recoverable by an incoming encrypted mail.
|
||||||
EncryptionPaused = 0x01,
|
EncryptionPaused = 0x01,
|
||||||
|
|
||||||
/// Recoverable by a new verify.
|
/// Recoverable by a new verify.
|
||||||
FingerprintChanged = 0x02,
|
FingerprintChanged = 0x02,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,23 @@ const SMTP_TIMEOUT: u64 = 30;
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[fail(display = "Bad parameters")]
|
#[fail(display = "Bad parameters")]
|
||||||
BadParameters,
|
BadParameters,
|
||||||
|
|
||||||
#[fail(display = "Invalid login address {}: {}", address, error)]
|
#[fail(display = "Invalid login address {}: {}", address, error)]
|
||||||
InvalidLoginAddress {
|
InvalidLoginAddress {
|
||||||
address: String,
|
address: String,
|
||||||
#[cause]
|
#[cause]
|
||||||
error: error::Error,
|
error: error::Error,
|
||||||
},
|
},
|
||||||
|
|
||||||
#[fail(display = "SMTP failed to connect: {:?}", _0)]
|
#[fail(display = "SMTP failed to connect: {:?}", _0)]
|
||||||
ConnectionFailure(#[cause] smtp::error::Error),
|
ConnectionFailure(#[cause] smtp::error::Error),
|
||||||
|
|
||||||
#[fail(display = "SMTP: failed to setup connection {:?}", _0)]
|
#[fail(display = "SMTP: failed to setup connection {:?}", _0)]
|
||||||
ConnectionSetupFailure(#[cause] smtp::error::Error),
|
ConnectionSetupFailure(#[cause] smtp::error::Error),
|
||||||
|
|
||||||
#[fail(display = "SMTP: oauth2 error {:?}", _0)]
|
#[fail(display = "SMTP: oauth2 error {:?}", _0)]
|
||||||
Oauth2Error { address: String },
|
Oauth2Error { address: String },
|
||||||
|
|
||||||
#[fail(display = "TLS error")]
|
#[fail(display = "TLS error")]
|
||||||
Tls(#[cause] native_tls::Error),
|
Tls(#[cause] native_tls::Error),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ pub type Result<T> = std::result::Result<T, Error>;
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[fail(display = "Envelope error: {}", _0)]
|
#[fail(display = "Envelope error: {}", _0)]
|
||||||
EnvelopeError(#[cause] async_smtp::error::Error),
|
EnvelopeError(#[cause] async_smtp::error::Error),
|
||||||
|
|
||||||
#[fail(display = "Send error: {}", _0)]
|
#[fail(display = "Send error: {}", _0)]
|
||||||
SendError(#[cause] async_smtp::smtp::error::Error),
|
SendError(#[cause] async_smtp::smtp::error::Error),
|
||||||
|
|
||||||
#[fail(display = "SMTP has no transport")]
|
#[fail(display = "SMTP has no transport")]
|
||||||
NoTransport,
|
NoTransport,
|
||||||
|
|
||||||
#[fail(display = "SMTP send timed out")]
|
#[fail(display = "SMTP send timed out")]
|
||||||
SendTimeout(#[cause] async_std::future::TimeoutError),
|
SendTimeout(#[cause] async_std::future::TimeoutError),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user