objc2-mail-kit 0.3.2

Bindings to the MailKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern "C" {
    /// Error domain and codes for extensions to report errors before message is delivered.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityerrordomain?language=objc)
    pub static MEMessageSecurityErrorDomain: &'static NSErrorDomain;
}

/// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityerrorcode?language=objc)
// NS_ERROR_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MEMessageSecurityErrorCode(pub NSInteger);
impl MEMessageSecurityErrorCode {
    #[doc(alias = "MEMessageSecurityEncodingError")]
    pub const EncodingError: Self = Self(0);
    #[doc(alias = "MEMessageSecurityDecodingError")]
    pub const DecodingError: Self = Self(1);
}

unsafe impl Encode for MEMessageSecurityErrorCode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for MEMessageSecurityErrorCode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mailkit/memessagesecurityhandler?language=objc)
    #[cfg(all(feature = "MEMessageDecoder", feature = "MEMessageEncoder"))]
    pub unsafe trait MEMessageSecurityHandler:
        MEMessageEncoder + MEMessageDecoder + MainThreadOnly
    {
        #[cfg(all(
            feature = "MEExtensionViewController",
            feature = "MEMessageSigner",
            feature = "objc2-app-kit"
        ))]
        /// Invoked by Mail to request a subclass of
        /// `MEExtensionViewController.`Extensions can maintain any additional state in their subclasses and associate it with
        /// `messsageComposeSession`instance.
        #[unsafe(method(extensionViewControllerForMessageSigners:))]
        #[unsafe(method_family = none)]
        unsafe fn extensionViewControllerForMessageSigners(
            &self,
            message_signers: &NSArray<MEMessageSigner>,
        ) -> Option<Retained<MEExtensionViewController>>;

        #[cfg(all(feature = "MEExtensionViewController", feature = "objc2-app-kit"))]
        /// Invoked by Mail to request a subclass of
        /// `MEExtensionViewController`when the user clicks a banner or on the extensions icon in the message header view.
        #[unsafe(method(extensionViewControllerForMessageContext:))]
        #[unsafe(method_family = none)]
        unsafe fn extensionViewControllerForMessageContext(
            &self,
            context: &NSData,
        ) -> Option<Retained<MEExtensionViewController>>;

        #[cfg(all(
            feature = "MEExtensionViewController",
            feature = "block2",
            feature = "objc2-app-kit"
        ))]
        /// Invoked when the primary action for the message banner is clicked. The extension can provide an optional view controller to render any additional information.
        #[unsafe(method(primaryActionClickedForMessageContext:completionHandler:))]
        #[unsafe(method_family = none)]
        unsafe fn primaryActionClickedForMessageContext_completionHandler(
            &self,
            context: &NSData,
            completion_handler: &block2::DynBlock<dyn Fn(*mut MEExtensionViewController)>,
        );
    }
);