diff --git a/src/constants.rs b/src/constants.rs index bb4d2f142..dc0d8a013 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -191,6 +191,7 @@ pub const AVATAR_SIZE: u32 = 192; #[repr(i32)] pub enum Viewtype { Unknown = 0, + /// Text message. /// The text of the message is set using dc_msg_set_text() /// and retrieved with dc_msg_get_text(). diff --git a/src/contact.rs b/src/contact.rs index c42707d95..9742c5854 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -48,20 +48,26 @@ pub struct Contact { /// /// Normal contact IDs are larger than these special ones (larger than DC_CONTACT_ID_LAST_SPECIAL). pub id: u32, + /// Contact name. It is recommended to use `Contact::get_name`, /// `Contact::get_display_name` or `Contact::get_name_n_addr` to access this field. /// May be empty, initially set to `authname`. name: String, + /// 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`, /// to access this field. authname: String, + /// E-Mail-Address of the contact. It is recommended to use `Contact::get_addr`` to access this field. addr: String, + /// Blocked state. Use dc_contact_is_blocked to access this field. blocked: bool, + /// The origin/source of the contact. pub origin: Origin, + /// Parameters as Param::ProfileImage pub param: Params, } @@ -73,36 +79,52 @@ pub struct Contact { #[repr(i32)] pub enum Origin { Unknown = 0, + /// From: of incoming messages of unknown sender IncomingUnknownFrom = 0x10, + /// Cc: of incoming messages of unknown sender IncomingUnknownCc = 0x20, + /// To: of incoming messages of unknown sender IncomingUnknownTo = 0x40, + /// address scanned but not verified UnhandledQrScan = 0x80, + /// Reply-To: of incoming message of known sender IncomingReplyTo = 0x100, + /// Cc: of incoming message of known sender IncomingCc = 0x200, + /// additional To:'s of incoming message of known sender IncomingTo = 0x400, + /// a chat was manually created for this user, but no message yet sent CreateChat = 0x800, + /// message sent by us OutgoingBcc = 0x1000, + /// message sent by us OutgoingCc = 0x2000, + /// message sent by us OutgoingTo = 0x4000, + /// internal use Internal = 0x40000, + /// address is in our address book 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() ! 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() ! SecurejoinJoined = 0x0200_0000, + /// contact added mannually by dc_create_contact(), this should be the largets origin as otherwise the user cannot modify the names ManuallyCreated = 0x0400_0000, } diff --git a/src/error.rs b/src/error.rs index 5f0558f48..0ac209e81 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,34 +6,49 @@ use lettre_email::mime; pub enum Error { #[fail(display = "{:?}", _0)] Failure(failure::Error), + #[fail(display = "SQL error: {:?}", _0)] SqlError(#[cause] crate::sql::Error), + #[fail(display = "{:?}", _0)] Io(std::io::Error), + #[fail(display = "{:?}", _0)] Message(String), + #[fail(display = "{:?}", _0)] Image(image_meta::ImageError), + #[fail(display = "{:?}", _0)] Utf8(std::str::Utf8Error), + #[fail(display = "PGP: {:?}", _0)] Pgp(pgp::errors::Error), + #[fail(display = "Base64Decode: {:?}", _0)] Base64Decode(base64::DecodeError), + #[fail(display = "{:?}", _0)] FromUtf8(std::string::FromUtf8Error), + #[fail(display = "{}", _0)] BlobError(#[cause] crate::blob::BlobError), + #[fail(display = "Invalid Message ID.")] InvalidMsgId, + #[fail(display = "Watch folder not found {:?}", _0)] WatchFolderNotFound(String), + #[fail(display = "Invalid Email: {:?}", _0)] MailParseError(#[cause] mailparse::MailParseError), + #[fail(display = "Building invalid Email: {:?}", _0)] LettreError(#[cause] lettre_email::error::Error), + #[fail(display = "FromStr error: {:?}", _0)] FromStr(#[cause] mime::FromStrError), + #[fail(display = "Not Configured")] NotConfigured, } diff --git a/src/imex.rs b/src/imex.rs index 821e37ca2..101e1cc13 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -33,16 +33,19 @@ pub enum ImexMode { /// and `private-key-default.asc`, if there are more keys, they are written to files as /// `public-key-.asc` and `private-key-.asc` ExportSelfKeys = 1, + /// 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`. /// Public keys are not imported. ImportSelfKeys = 2, + /// 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 does not contain device dependent settings as ringtones or LED notification settings. /// The name of the backup is typically `delta-chat..bak`, if more than one backup is create on a day, /// the format is `delta-chat.-.bak` ExportBackup = 11, + /// `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 /// is only possible as long as the context is not configured or used in another way. diff --git a/src/lot.rs b/src/lot.rs index b1734b397..e1c14e6e3 100644 --- a/src/lot.rs +++ b/src/lot.rs @@ -73,20 +73,28 @@ pub enum LotState { // Qr States /// id=contact QrAskVerifyContact = 200, + /// text1=groupname QrAskVerifyGroup = 202, + /// id=contact QrFprOk = 210, + /// id=contact QrFprMissmatch = 220, + /// test1=formatted fingerprint QrFprWithoutAddr = 230, + /// id=contact QrAddr = 320, + /// text1=text QrText = 330, + /// text1=URL QrUrl = 332, + /// text1=error string QrError = 400, diff --git a/src/param.rs b/src/param.rs index 399a7d152..42610a819 100644 --- a/src/param.rs +++ b/src/param.rs @@ -16,36 +16,51 @@ use crate::mimeparser::SystemMessage; pub enum Param { /// For messages and jobs File = b'f', + /// For Messages Width = b'w', + /// For Messages Height = b'h', + /// For Messages Duration = b'd', + /// For Messages 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', + /// For Messages: decrypted with validation errors or without mutual set, if neither /// 'c' nor 'e' are preset, the messages is only transport encrypted. ErroneousE2ee = b'e', + /// For Messages: force unencrypted message, either `ForcePlaintext::AddAutocryptHeader` (1), /// `ForcePlaintext::NoAutocryptHeader` (2) or 0. ForcePlaintext = b'u', + /// For Messages WantsMdn = b'r', + /// For Messages Forwarded = b'a', + /// For Messages Cmd = b'S', + /// For Messages Arg = b'E', + /// For Messages Arg2 = b'F', + /// For Messages Arg3 = b'G', + /// For Messages Arg4 = b'H', + /// For Messages Error = b'L', @@ -62,30 +77,43 @@ pub enum Param { /// When the original message is then finally sent this parameter /// is used to also send all the forwarded messages. PrepForwards = b'P', + /// For Jobs SetLatitude = b'l', + /// For Jobs SetLongitude = b'n', + /// For Jobs ServerFolder = b'Z', + /// For Jobs ServerUid = b'z', + /// For Jobs AlsoMove = b'M', + /// For Jobs: space-separated list of message recipients Recipients = b'R', + // For Groups Unpromoted = b'U', + // For Groups and Contacts ProfileImage = b'i', + // For Chats Selftalk = b'K', + // For Chats Devicetalk = b'D', + // For QR Auth = b's', + // For QR GroupId = b'x', + // For QR GroupName = b'g', } diff --git a/src/peerstate.rs b/src/peerstate.rs index ad879bf1a..dba0627d1 100644 --- a/src/peerstate.rs +++ b/src/peerstate.rs @@ -95,6 +95,7 @@ pub enum ToSave { pub enum DegradeEvent { /// Recoverable by an incoming encrypted mail. EncryptionPaused = 0x01, + /// Recoverable by a new verify. FingerprintChanged = 0x02, } diff --git a/src/smtp/mod.rs b/src/smtp/mod.rs index 1776f46a6..20ad5672f 100644 --- a/src/smtp/mod.rs +++ b/src/smtp/mod.rs @@ -20,18 +20,23 @@ const SMTP_TIMEOUT: u64 = 30; pub enum Error { #[fail(display = "Bad parameters")] BadParameters, + #[fail(display = "Invalid login address {}: {}", address, error)] InvalidLoginAddress { address: String, #[cause] error: error::Error, }, + #[fail(display = "SMTP failed to connect: {:?}", _0)] ConnectionFailure(#[cause] smtp::error::Error), + #[fail(display = "SMTP: failed to setup connection {:?}", _0)] ConnectionSetupFailure(#[cause] smtp::error::Error), + #[fail(display = "SMTP: oauth2 error {:?}", _0)] Oauth2Error { address: String }, + #[fail(display = "TLS error")] Tls(#[cause] native_tls::Error), } diff --git a/src/smtp/send.rs b/src/smtp/send.rs index cc628fbdc..f39a3b469 100644 --- a/src/smtp/send.rs +++ b/src/smtp/send.rs @@ -12,10 +12,13 @@ pub type Result = std::result::Result; pub enum Error { #[fail(display = "Envelope error: {}", _0)] EnvelopeError(#[cause] async_smtp::error::Error), + #[fail(display = "Send error: {}", _0)] SendError(#[cause] async_smtp::smtp::error::Error), + #[fail(display = "SMTP has no transport")] NoTransport, + #[fail(display = "SMTP send timed out")] SendTimeout(#[cause] async_std::future::TimeoutError), }