From 686d0e22b545808486cadb4d1e1a272515ecc7fd Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Wed, 14 Jan 2015 23:26:38 -0800 Subject: Work in progress on javadoc --- src/java/com/libmailcore/Encoding.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/java/com/libmailcore/Encoding.java') diff --git a/src/java/com/libmailcore/Encoding.java b/src/java/com/libmailcore/Encoding.java index bbc469f6..0e1e0c6f 100644 --- a/src/java/com/libmailcore/Encoding.java +++ b/src/java/com/libmailcore/Encoding.java @@ -1,6 +1,8 @@ package com.libmailcore; +/** MIME encoding. */ public class Encoding { + /** 7-bit encoding. */ final public static int Encoding7Bit = 0; final public static int Encoding8Bit = 1; final public static int EncodingBinary = 2; -- cgit v1.2.3 From e2b178f73a516d50698e5b98e093d595aac34b2c Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Fri, 16 Jan 2015 23:14:21 -0800 Subject: Work in progress on javadoc --- src/java/com/libmailcore/AuthType.java | 16 ++++ src/java/com/libmailcore/ConnectionLogType.java | 3 +- src/java/com/libmailcore/Encoding.java | 3 +- src/java/com/libmailcore/ErrorCode.java | 3 +- .../com/libmailcore/IMAPCapabilityOperation.java | 2 + src/java/com/libmailcore/IMAPFolderFlags.java | 3 +- src/java/com/libmailcore/IMAPMultipart.java | 3 + src/java/com/libmailcore/IMAPNamespace.java | 15 ++++ src/java/com/libmailcore/IMAPNamespaceItem.java | 7 ++ src/java/com/libmailcore/IMAPOperation.java | 9 ++ .../IMAPOperationItemProgressListener.java | 2 + .../libmailcore/IMAPOperationProgressListener.java | 2 + src/java/com/libmailcore/IMAPPart.java | 14 ++++ src/java/com/libmailcore/IMAPQuotaOperation.java | 3 + src/java/com/libmailcore/IMAPSearchExpression.java | 42 ++++++++-- src/java/com/libmailcore/IMAPSearchKind.java | 2 + src/java/com/libmailcore/IMAPSearchOperation.java | 2 + src/java/com/libmailcore/IMAPSession.java | 98 ++++++++++++++++++++++ .../com/libmailcore/IMAPStoreFlagsRequestKind.java | 2 + src/java/com/libmailcore/IndexSet.java | 19 +++++ src/java/com/libmailcore/Log.java | 3 + src/java/com/libmailcore/MailException.java | 6 ++ src/java/com/libmailcore/MainThreadUtils.java | 4 +- src/java/com/libmailcore/MessageBuilder.java | 27 ++++++ src/java/com/libmailcore/MessageFlag.java | 26 +++--- src/java/com/libmailcore/MessageHeader.java | 40 +++++++++ src/java/com/libmailcore/MessageParser.java | 9 ++ src/java/com/libmailcore/Multipart.java | 1 + src/java/com/libmailcore/NativeObject.java | 3 + src/java/com/libmailcore/Operation.java | 4 + src/java/com/libmailcore/OperationCallback.java | 3 + .../com/libmailcore/OperationQueueListener.java | 3 + src/java/com/libmailcore/PartType.java | 2 + src/java/com/libmailcore/Range.java | 14 ++++ src/java/com/libmailcore/SMTPOperation.java | 4 + src/java/com/libmailcore/SMTPSession.java | 43 ++++++++++ src/java/native/com_libmailcore_AuthType.h | 13 +++ .../native/com_libmailcore_IMAPSearchExpression.h | 8 -- 38 files changed, 430 insertions(+), 33 deletions(-) create mode 100644 src/java/com/libmailcore/AuthType.java create mode 100644 src/java/native/com_libmailcore_AuthType.h (limited to 'src/java/com/libmailcore/Encoding.java') diff --git a/src/java/com/libmailcore/AuthType.java b/src/java/com/libmailcore/AuthType.java new file mode 100644 index 00000000..6394a4c7 --- /dev/null +++ b/src/java/com/libmailcore/AuthType.java @@ -0,0 +1,16 @@ +package com.libmailcore; + +/** Authentication type. */ +public class AuthType { + public static int AuthTypeSASLNone = 0; + public static int AuthTypeSASLCRAMMD5 = 1 << 0; + public static int AuthTypeSASLPlain = 1 << 1; + public static int AuthTypeSASLGSSAPI = 1 << 2; + public static int AuthTypeSASLDIGESTMD5 = 1 << 3; + public static int AuthTypeSASLLogin = 1 << 4; + public static int AuthTypeSASLSRP = 1 << 5; + public static int AuthTypeSASLNTLM = 1 << 6; + public static int AuthTypeSASLKerberosV4 = 1 << 7; + public static int AuthTypeXOAuth2 = 1 << 8; + public static int AuthTypeXOAuth2Outlook = 1 << 9; +} diff --git a/src/java/com/libmailcore/ConnectionLogType.java b/src/java/com/libmailcore/ConnectionLogType.java index 40037e5e..b8001cdc 100644 --- a/src/java/com/libmailcore/ConnectionLogType.java +++ b/src/java/com/libmailcore/ConnectionLogType.java @@ -1,6 +1,7 @@ package com.libmailcore; -/** Logs type for the connection logger. */ +/** Logs type for the connection logger. + @see ConnectionLogger#log(long connectionID, int type, byte[] data) */ public class ConnectionLogType { /** Received data. */ final public static int ConnectionLogTypeReceived = 0; diff --git a/src/java/com/libmailcore/Encoding.java b/src/java/com/libmailcore/Encoding.java index 0e1e0c6f..c6d40912 100644 --- a/src/java/com/libmailcore/Encoding.java +++ b/src/java/com/libmailcore/Encoding.java @@ -1,6 +1,7 @@ package com.libmailcore; -/** MIME encoding. */ +/** MIME encoding. + See IMAPPart#encoding() */ public class Encoding { /** 7-bit encoding. */ final public static int Encoding7Bit = 0; diff --git a/src/java/com/libmailcore/ErrorCode.java b/src/java/com/libmailcore/ErrorCode.java index 16ec2b2e..bed7ed10 100644 --- a/src/java/com/libmailcore/ErrorCode.java +++ b/src/java/com/libmailcore/ErrorCode.java @@ -1,6 +1,7 @@ package com.libmailcore; -/** Error codes. */ +/** Error codes. + @see MailException#errorCode() */ public class ErrorCode { /** No error occurred.*/ public final static int ErrorNone = 0; // 0 diff --git a/src/java/com/libmailcore/IMAPCapabilityOperation.java b/src/java/com/libmailcore/IMAPCapabilityOperation.java index a688f7d6..63bc34f7 100644 --- a/src/java/com/libmailcore/IMAPCapabilityOperation.java +++ b/src/java/com/libmailcore/IMAPCapabilityOperation.java @@ -2,5 +2,7 @@ package com.libmailcore; /** Operation to fetch the capabilities of the IMAP server. */ public class IMAPCapabilityOperation extends IMAPOperation { + /** The result set will contains values of IMAPCabilityOperation. + @see IMAPCabilityOperation. */ public native IndexSet capabilities(); } diff --git a/src/java/com/libmailcore/IMAPFolderFlags.java b/src/java/com/libmailcore/IMAPFolderFlags.java index 3346bbc3..9d48a565 100644 --- a/src/java/com/libmailcore/IMAPFolderFlags.java +++ b/src/java/com/libmailcore/IMAPFolderFlags.java @@ -1,6 +1,7 @@ package com.libmailcore; -/** Flags of a folder. */ +/** Flags of a folder. + @see IMAPFolder#flags() */ public class IMAPFolderFlags { public final static int IMAPFolderFlagNone = 0; public final static int IMAPFolderFlagMarked = 1 << 0; diff --git a/src/java/com/libmailcore/IMAPMultipart.java b/src/java/com/libmailcore/IMAPMultipart.java index 5e30815e..f10e3514 100644 --- a/src/java/com/libmailcore/IMAPMultipart.java +++ b/src/java/com/libmailcore/IMAPMultipart.java @@ -1,7 +1,10 @@ package com.libmailcore; +/** IMAP multipart */ public class IMAPMultipart extends AbstractMultipart { + /** Sets part ID. */ public native void setPartID(String partID); + /** Returns part ID. */ public native String partID(); private native void setupNative(); diff --git a/src/java/com/libmailcore/IMAPNamespace.java b/src/java/com/libmailcore/IMAPNamespace.java index 5658b1aa..f590eb6e 100644 --- a/src/java/com/libmailcore/IMAPNamespace.java +++ b/src/java/com/libmailcore/IMAPNamespace.java @@ -2,18 +2,33 @@ package com.libmailcore; import java.util.List; +/** IMAP Namespace */ public class IMAPNamespace extends NativeObject { + /** Returns the prefix of the main namespace item. */ public native String mainPrefix(); + /** Returns the delimiter of the main namespace item. */ public native char mainDelimiter(); + /** Returns the list of prefixes. */ public native List prefixes(); + /** + Returns the folder path for the given list of path components in the context + of the main item of the namespace. + */ public native String pathForComponents(List components); + /** + Returns the folder path for the given list of path components and a prefix. + It will use the best item matching the prefix to compute the path. + */ public native String pathForComponentsAndPrefix(List components, String prefix); + /** Returns the components given a folder path. */ public native List componentsFromPath(String path); + /** Returns true if the namespace contains the given folder path. */ public native boolean containsFolderPath(String path); + /** Returns a namespace (with a single namespace item) with a prefix and a delimiter. */ public static native IMAPNamespace namespaceWithPrefix(String prefix, char delimiter); } diff --git a/src/java/com/libmailcore/IMAPNamespaceItem.java b/src/java/com/libmailcore/IMAPNamespaceItem.java index e8d0bfe7..4249a790 100644 --- a/src/java/com/libmailcore/IMAPNamespaceItem.java +++ b/src/java/com/libmailcore/IMAPNamespaceItem.java @@ -4,14 +4,21 @@ import java.util.List; public class IMAPNamespaceItem extends NativeObject { + /** Sets prefix. */ public native void setPrefix(String prefix); + /** Returns prefix. */ public native String prefix(); + /** Sets delimiter. */ public native void setDelimiter(char delimiter); + /** Returns delimiter. */ public native char delimiter(); + /** Returns the folder path for the given list of path components. */ public native String pathForComponents(List components); + /** Returns the components given a folder path. */ public native List componentsForPath(String path); + /** Returns true if the namespace contains the given folder path. */ public native boolean containsFolder(String folder); } diff --git a/src/java/com/libmailcore/IMAPOperation.java b/src/java/com/libmailcore/IMAPOperation.java index 4fea241f..aebc707a 100644 --- a/src/java/com/libmailcore/IMAPOperation.java +++ b/src/java/com/libmailcore/IMAPOperation.java @@ -1,6 +1,10 @@ package com.libmailcore; public class IMAPOperation extends Operation { + /** + Returns error once the operation finished running. It will return null if the operation + successfully ran. + */ public MailException exception() { if (errorCode() == ErrorCode.ErrorNone) { return null; @@ -10,6 +14,11 @@ public class IMAPOperation extends Operation { private native int errorCode(); + /** + Calls the method succeeded() of the callback if the operation succeeded or failed() + if the operation failed. + @see OperationCallback + */ protected void callCallback() { if (callback != null) { diff --git a/src/java/com/libmailcore/IMAPOperationItemProgressListener.java b/src/java/com/libmailcore/IMAPOperationItemProgressListener.java index 00a862ca..b26cd502 100644 --- a/src/java/com/libmailcore/IMAPOperationItemProgressListener.java +++ b/src/java/com/libmailcore/IMAPOperationItemProgressListener.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Progress listener for IMAP operations working with items such as IMAPFetchMessagesOperation. */ public interface IMAPOperationItemProgressListener { + /** Called when a progress has been notified. */ void itemProgress(long current, long maximum); } diff --git a/src/java/com/libmailcore/IMAPOperationProgressListener.java b/src/java/com/libmailcore/IMAPOperationProgressListener.java index 2754403b..a9154354 100644 --- a/src/java/com/libmailcore/IMAPOperationProgressListener.java +++ b/src/java/com/libmailcore/IMAPOperationProgressListener.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Progress listener for IMAP operations working with stream of data. */ public interface IMAPOperationProgressListener { + /** Called when a progress has been notified. */ void bodyProgress(long current, long maximum); } diff --git a/src/java/com/libmailcore/IMAPPart.java b/src/java/com/libmailcore/IMAPPart.java index 27765f41..28ad7cda 100644 --- a/src/java/com/libmailcore/IMAPPart.java +++ b/src/java/com/libmailcore/IMAPPart.java @@ -1,15 +1,29 @@ package com.libmailcore; +/** IMAP part. */ public class IMAPPart extends AbstractPart { + /** Sets part ID. */ public native void setPartID(String partID); + /** Returns part ID. */ public native String partID(); + /** Sets encoded size of the part. */ public native void setSize(long size); + /** Returns encoded size of the part. */ public native long size(); + /** Returns decoded size. */ public native long decodedSize(); + /** + Sets encoding used (base64, quoted-printable, etc). + @see Encoding + */ public native void setEncoding(int encoding); + /** + Returns encoding used (base64, quoted-printable, etc.) + @see Encoding + */ public native int encoding(); private static final long serialVersionUID = 1L; diff --git a/src/java/com/libmailcore/IMAPQuotaOperation.java b/src/java/com/libmailcore/IMAPQuotaOperation.java index b5f4e03a..97e7fbb4 100644 --- a/src/java/com/libmailcore/IMAPQuotaOperation.java +++ b/src/java/com/libmailcore/IMAPQuotaOperation.java @@ -1,6 +1,9 @@ package com.libmailcore; +/** IMAP QUOTA Operation. */ public class IMAPQuotaOperation extends IMAPOperation { + /** Returns quota usage. */ public native int usage(); + /** Returns quota limit. */ public native int limit(); } diff --git a/src/java/com/libmailcore/IMAPSearchExpression.java b/src/java/com/libmailcore/IMAPSearchExpression.java index 1319eb08..0d4d5e5d 100644 --- a/src/java/com/libmailcore/IMAPSearchExpression.java +++ b/src/java/com/libmailcore/IMAPSearchExpression.java @@ -3,46 +3,74 @@ package com.libmailcore; import java.util.Date; public class IMAPSearchExpression extends NativeObject { - public IMAPSearchExpression() - { - setupNative(); - } - + /** Returns search expression to return all emails. */ public static native IMAPSearchExpression searchAll(); + /** Returns search expression to return emails matching the From header. */ public static native IMAPSearchExpression searchFrom(String value); + /** Returns search expression to return emails matching the To header. */ public static native IMAPSearchExpression searchTo(String value); + /** Returns search expression to return emails matching the Cc header. */ public static native IMAPSearchExpression searchCc(String value); + /** Returns search expression to return emails matching the Bcc header. */ public static native IMAPSearchExpression searchBcc(String value); + /** Returns search expression to return emails matching any recipient header. */ public static native IMAPSearchExpression searchRecipient(String value); + /** Returns search expression to return emails matching the Subject header. */ public static native IMAPSearchExpression searchSubject(String value); + /** Returns search expression to return emails matching the content. */ public static native IMAPSearchExpression searchContent(String value); + /** Returns search expression to return emails matching the body. */ public static native IMAPSearchExpression searchBody(String value); + /** Returns search expression to return emails matching a given header. */ public static native IMAPSearchExpression searchHeader(String header, String value); + /** Returns search expression to return emails matching a set of UIDs. */ public static native IMAPSearchExpression searchUIDs(IndexSet uids); + /** Returns search expression to return read emails. */ public static native IMAPSearchExpression searchRead(); + /** Returns search expression to return unread emails. */ public static native IMAPSearchExpression searchUnread(); + /** Returns search expression to return flagged emails. */ public static native IMAPSearchExpression searchFlagged(); + /** Returns search expression to return unflagged emails. */ public static native IMAPSearchExpression searchUnflagged(); + /** Returns search expression to return answered emails. */ public static native IMAPSearchExpression searchAnswered(); + /** Returns search expression to return unanswered emails. */ public static native IMAPSearchExpression searchUnanswered(); + /** Returns search expression to return drafts. */ public static native IMAPSearchExpression searchDraft(); + /** Returns search expression to return undrafts. */ public static native IMAPSearchExpression searchUndraft(); + /** Returns search expression to return emails marked as deleted. */ public static native IMAPSearchExpression searchDeleted(); + /** Returns search expression to return emails marked as spam. */ public static native IMAPSearchExpression searchSpam(); + /** Returns search expression to return emails older than a specific date. */ public static native IMAPSearchExpression searchBeforeDate(Date date); + /** Returns search expression to return emails that matches a specific date. */ public static native IMAPSearchExpression searchOnDate(Date date); + /** Returns search expression to return emails more recent that a specific date. */ public static native IMAPSearchExpression searchSinceDate(Date date); + /** Returns search expression to return emails with received date older than a specific date. */ public static native IMAPSearchExpression searchBeforeReceivedDate(Date date); + /** Returns search expression to return emails with received date that matches a specific date. */ public static native IMAPSearchExpression searchOnReceivedDate(Date date); + /** Returns search expression to return emails with received date more recent than a specific date. */ public static native IMAPSearchExpression searchSinceReceivedDate(Date date); + /** Returns search expression to return emails larger than a given size. */ public static native IMAPSearchExpression searchSizeLarger(long size); + /** Returns search expression to return emails smaller than a given size. */ public static native IMAPSearchExpression searchSizeSmaller(long size); + /** Returns search expression to return emails with a specific thread identifier. */ public static native IMAPSearchExpression searchGmailThreadID(long number); + /** Returns search expression to return emails with a specific message identifier. */ public static native IMAPSearchExpression searchGmailMessageID(long number); + /** Returns search expression to return emails that match a Gmail search expression. */ public static native IMAPSearchExpression searchGmailRaw(String expr); + /** Returns search expression to return emails that match both expressions. */ public static native IMAPSearchExpression searchAnd(IMAPSearchExpression left, IMAPSearchExpression right); + /** Returns search expression to return emails that match one of the expressions. */ public static native IMAPSearchExpression searchOr(IMAPSearchExpression left, IMAPSearchExpression right); + /** Returns search expression to return emails that don't match a given expression. */ public static native IMAPSearchExpression searchNot(IMAPSearchExpression notExpr); - - private native void setupNative(); } diff --git a/src/java/com/libmailcore/IMAPSearchKind.java b/src/java/com/libmailcore/IMAPSearchKind.java index fe71fdcd..efbb0c9f 100644 --- a/src/java/com/libmailcore/IMAPSearchKind.java +++ b/src/java/com/libmailcore/IMAPSearchKind.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Search types. + @see IMAPSession#searchOperation(String folder, int kind, String searchString) */ public class IMAPSearchKind { public final static int IMAPSearchKindAll = 0; public final static int IMAPSearchKindNone = 1; diff --git a/src/java/com/libmailcore/IMAPSearchOperation.java b/src/java/com/libmailcore/IMAPSearchOperation.java index 2b9de495..81e314c6 100644 --- a/src/java/com/libmailcore/IMAPSearchOperation.java +++ b/src/java/com/libmailcore/IMAPSearchOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** IMAP Search operation. */ public class IMAPSearchOperation extends IMAPOperation { + /** Returns UIDs matching the search query. */ public native IndexSet uids(); } \ No newline at end of file diff --git a/src/java/com/libmailcore/IMAPSession.java b/src/java/com/libmailcore/IMAPSession.java index f3e305a4..eabcd63f 100644 --- a/src/java/com/libmailcore/IMAPSession.java +++ b/src/java/com/libmailcore/IMAPSession.java @@ -2,7 +2,9 @@ package com.libmailcore; import java.util.List; +/** IMAP session. */ public class IMAPSession extends NativeObject { + /** Constructor for the IMAPSession. */ public IMAPSession() { setupNative(); @@ -14,172 +16,268 @@ public class IMAPSession extends NativeObject { super.finalize(); } + /** Sets the IMAP server hostname. */ public native void setHostname(String hostname); + /** Returns the IMAP server hostname. */ public native String hostname(); + /** Sets the port. */ public native void setPort(int port); + /** Returns the port. */ public native int port(); + /** Sets the username. */ public native void setUsername(String username); + /** Returns the username. */ public native String username(); + /** Sets the password. */ public native void setPassword(String password); + /** Returns the password. */ public native String password(); + /** Sets the OAuth2 token. */ public native void setOAuth2Token(String token); + /** Returns the OAuth2 token. */ public native String OAuth2Token(); + /** + Sets the authentication type. + @see AuthType + */ public native void setAuthType(int authType); + /** + Returns authentication type. + @see Authtype + */ public native int authType(); + /** + Set connection type (clear-text, SSL or STARTTLS). + @see ConnectionType + */ public native void setConnectionType(int connectionType); + /** + Returns connection type (clear-text, SSL or STARTTLS). + @see ConnectionType + */ public native int connectionType(); + /** Sets network timeout in seconds. */ public native void setTimeout(long seconds); + /** Returns network timeout in seconds. */ public native long timeout(); + /** Sets whether the certificate of the server should be checked. */ public native void setCheckCertificateEnabled(boolean enabled); + /** Returns whether the certificate of the server should be checked. */ public native boolean isCheckCertificateEnabled(); + /** Sets the default namespace. */ public native void setDefaultNamespace(IMAPNamespace ns); + /** Returns the default namespace. */ public native IMAPNamespace defaultNamespace(); + /** Set whether the IMAP session can access folders using several IMAP connections. */ public native void setAllowsFolderConcurrentAccessEnabled(boolean enabled); + /** Returns whether the IMAP session can access folders using several IMAP connections. */ public native boolean allowsFolderConcurrentAccessEnabled(); + /** Sets the maximum number of IMAP connections to use. */ public native void setMaximumConnections(int maxConnections); + /** Returns the maximum number of IMAP connections to use. */ public native int maximumConnections(); + /** Sets the connection logger. */ public void setConnectionLogger(ConnectionLogger logger) { connectionLogger = logger; setupNativeConnectionLogger(); } + /** Returns the connection logger. */ public ConnectionLogger connectionLogger() { return connectionLogger; } + /** Sets the IMAP operations queue listener. */ public void setOperationQueueListener(OperationQueueListener listener) { operationQueueListener = listener; setupNativeOperationQueueListener(); } + /** Returns the IMAP operations queue listener. */ public OperationQueueListener operationQueueListener() { return operationQueueListener; } + /** Returns whether the operation queue is running. */ public native boolean isOperationQueueRunning(); + /** Cancels all queued operations. */ public native void cancelAllOperations(); + /** Returns server identity. */ public native IMAPIdentity serverIdentity(); + /** Returns client identity. It can be modified before establishing connection. */ public native IMAPIdentity clientIdentity(); + + /** Returns the Gmail user display name. */ public native String gmailUserDisplayName(); + /** Returns an operation to request the folder info. */ public native IMAPFolderInfoOperation folderInfoOperation(String folder); + /** Returns an operation to request the folder status. */ public native IMAPFolderStatusOperation folderStatusOperation(String folder); + /** Returns an operation to request the list of subscribed folders. */ public native IMAPFetchFoldersOperation fetchSubscribedFoldersOperation(); + /** Returns an operation to request the list of all folders. */ public native IMAPFetchFoldersOperation fetchAllFoldersOperation(); + /** Returns an operation to rename a folder. */ public native IMAPOperation renameFolderOperation(String folder, String otherName); + /** Returns an operation to delete a folder. */ public native IMAPOperation deleteFolderOperation(String folder); + /** Returns an operation to create a folder. */ public native IMAPOperation createFolderOperation(String folder); + /** Returns an operation to subscribe a folder. */ public native IMAPOperation subscribeFolderOperation(String folder); + /** Returns an operation to unsubscribe a folder. */ public native IMAPOperation unsubscribeFolderOperation(String folder); + /** Returns an operation to append a message to a folder. */ public native IMAPAppendMessageOperation appendMessageOperation(String folder, byte[] messageData, int messageFlags, List customFlags); + /** Returns an operation to append a message to a folder. */ public IMAPAppendMessageOperation appendMessageOperation(String folder, byte[] messageData, int messageFlags) { return appendMessageOperation(folder, messageData, messageFlags, null); } + /** Returns an operation to copy messages to a folder. */ public native IMAPCopyMessagesOperation copyMessagesOperation(String folder, IndexSet uids, String destFolder); + /** Returns an operation to expunge messages after they've been marked as deleted. */ public native IMAPOperation expungeOperation(String folder); + /** Returns an operation to fetch a list of messages by UID. */ public native IMAPFetchMessagesOperation fetchMessagesByUIDOperation(String folder, int requestKind, IndexSet indexes); + /** Returns an operation to fetch a list of messages by sequence number. */ public native IMAPFetchMessagesOperation fetchMessagesByNumberOperation(String folder, int requestKind, IndexSet indexes); + /** Returns an operation to sync a list of messages. */ public native IMAPFetchMessagesOperation syncMessagesByUIDOperation(String folder, int requestKind, IndexSet indexes, long modSeq); + /** Returns an operation to fetch a message content by UID. */ public native IMAPFetchContentOperation fetchMessageByUIDOperation(String folder, long uid, boolean urgent); + /** Returns an operation to fetch a message content by UID. */ public IMAPFetchContentOperation fetchMessageByUIDOperation(String folder, long uid) { return fetchMessageByUIDOperation(folder, uid, false); } + /** Returns an operation to fetch an attachment content using the UID of a message. */ public native IMAPFetchContentOperation fetchMessageAttachmentByUIDOperation(String folder, long uid, String partID, int encoding, boolean urgent); + /** Returns an operation to fetch an attachment content using the UID of a message. */ public IMAPFetchContentOperation fetchMessageAttachmentByUIDOperation(String folder, long uid, String partID, int encoding) { return fetchMessageAttachmentByUIDOperation(folder, uid, partID, encoding, false); } + /** Returns an operation to fetch a message content by sequence number. */ public native IMAPFetchContentOperation fetchMessageByNumberOperation(String folder, long number, boolean urgent); + /** Returns an operation to fetch a message content by sequence number. */ public IMAPFetchContentOperation fetchMessageByNumberOperation(String folder, long number) { return fetchMessageByNumberOperation(folder, number, false); } + /** Returns an operation to fetch an attachment content using the sequence number of a message. */ public native IMAPFetchContentOperation fetchMessageAttachmentByNumberOperation(String folder, long number, String partID, int encoding, boolean urgent); + /** Returns an operation to fetch an attachment content using the sequence number of a message. */ public IMAPFetchContentOperation fetchMessageAttachmentByNumberOperation(String folder, long number, String partID, int encoding) { return fetchMessageAttachmentByNumberOperation(folder, number, partID, encoding, false); } + /** Returns an operation to fetch a message content by UID and parse it. */ public native IMAPFetchParsedContentOperation fetchParsedMessageByUIDOperation(String folder, long uid, boolean urgent); + /** Returns an operation to fetch a message content by UID and parse it. */ public IMAPFetchParsedContentOperation fetchParsedMessageByUIDOperation(String folder, long uid) { return fetchParsedMessageByUIDOperation(folder, uid, false); } + /** Returns an operation to fetch a message content by sequence number and parse it. */ public native IMAPFetchParsedContentOperation fetchParsedMessageByNumberOperation(String folder, long number, boolean urgent); + /** Returns an operation to fetch a message content by sequence number and parse it. */ public IMAPFetchParsedContentOperation fetchParsedMessageByNumberOperation(String folder, long number) { return fetchParsedMessageByNumberOperation(folder, number, false); } + /** Returns an operation to store flags to a set of messages designated by UIDs. */ public native IMAPOperation storeFlagsByUIDOperation(String folder, IndexSet uids, int kind, int flags, List customFlags); + /** Returns an operation to store flags to a set of messages designated by UIDs. */ public IMAPOperation storeFlagsByUIDOperation(String folder, IndexSet uids, int kind, int flags) { return storeFlagsByUIDOperation(folder, uids, kind, flags, null); } + /** Returns an operation to store flags to a set of messages designated by sequence numbers. */ public native IMAPOperation storeFlagsByNumberOperation(String folder, IndexSet numbers, int kind, int flags, List customFlags); + /** Returns an operation to store flags to a set of messages designated by sequence numbers. */ public IMAPOperation storeFlagsByNumberOperation(String folder, IndexSet numbers, int kind, int flags) { return storeFlagsByNumberOperation(folder, numbers, kind, flags, null); } + /** Returns an operation to store labels to a set of messages designated by UIDs. */ public native IMAPOperation storeLabelsByUIDOperation(String folder, IndexSet uids, int kind, List labels); + /** Returns an operation to store labels to a set of messages designated by sequence numbers. */ public native IMAPOperation storeLabelsByNumberOperation(String folder, IndexSet numbers, int kind, List labels); + /** Returns a simple search operation. */ public native IMAPSearchOperation searchOperation(String folder, int kind, String searchString); + /** Returns a search operation using an expression. */ public native IMAPSearchOperation searchOperation(String folder, IMAPSearchExpression expression); + /** Returns an IDLE operation (wait for a new message). */ public native IMAPIdleOperation idleOperation(String folder, long lastKnownUID); + /** Returns an operation to fetch the namespace. */ public native IMAPFetchNamespaceOperation fetchNamespaceOperation(); + /** Returns an operation to send to the server the identity of the client and to get the identity of + the server. */ public native IMAPIdentityOperation identityOperation(IMAPIdentity identity); + /** Returns an operation to connect to the server. */ public native IMAPOperation connectOperation(); + /** Returns an operation to check whether the credentials of the account are correct. */ public native IMAPOperation checkAccountOperation(); + /** Returns an operation to disconnect from the server. */ public native IMAPOperation disconnectOperation(); + /** Returns an operation to fetch the capabilities. */ public native IMAPCapabilityOperation capabilityOperation(); + /** Returns an operation to fetch the quota information. */ public native IMAPQuotaOperation quotaOperation(); + /** Returns an IMAP NOOP operation. */ public native IMAPOperation noopOperation(); + /** Returns an operation to render a message as HTML. */ public native IMAPMessageRenderingOperation htmlRenderingOperation(IMAPMessage message, String folder); + /** Returns an operation to render the body of a message as HTML. */ public native IMAPMessageRenderingOperation htmlBodyRenderingOperation(IMAPMessage message, String folder); + /** Returns an operation to render a message as text. */ public native IMAPMessageRenderingOperation plainTextRenderingOperation(IMAPMessage message, String folder); + /** Returns an operation to render the body of a message as text. */ public native IMAPMessageRenderingOperation plainTextBodyRenderingOperation(IMAPMessage message, String folder, boolean stripWhitespace); private native void setupNative(); diff --git a/src/java/com/libmailcore/IMAPStoreFlagsRequestKind.java b/src/java/com/libmailcore/IMAPStoreFlagsRequestKind.java index dd0a2b81..7d6b65a6 100644 --- a/src/java/com/libmailcore/IMAPStoreFlagsRequestKind.java +++ b/src/java/com/libmailcore/IMAPStoreFlagsRequestKind.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Store request kind. + @see IMAPSession#storeFlagsByUIDOperation(String folder, IndexSet uids, int kind, int flags) */ public class IMAPStoreFlagsRequestKind { public final static int IMAPStoreFlagsRequestKindAdd = 0; public final static int IMAPStoreFlagsRequestKindRemove = 1; diff --git a/src/java/com/libmailcore/IndexSet.java b/src/java/com/libmailcore/IndexSet.java index 78e9a84f..76506bca 100644 --- a/src/java/com/libmailcore/IndexSet.java +++ b/src/java/com/libmailcore/IndexSet.java @@ -2,30 +2,49 @@ package com.libmailcore; import java.util.List; +/** Unordered set of indexes. */ public class IndexSet extends NativeObject { + /** Constructor. */ public IndexSet() { setupNative(); } + /** Returns an empty set of indexes. */ public static native IndexSet indexSet(); + /** Returns a set of indexes with a range. */ public static native IndexSet indexSetWithRange(Range range); + /** Returns a set of indexes with a single value. */ public static native IndexSet indexSetWithIndex(long idx); + /** Returns the number of indexes. */ public native int count(); + /** Adds an index. */ public native void addIndex(long idx); + /** Removes an index. */ public native void removeIndex(long idx); + /** Returns whether the set of indexes holds the given value. */ public native boolean containsIndex(long idx); + /** Adds a range of values. */ public native void addRange(Range range); + /** Remove a range of values. */ public native void removeRange(Range range); + /** Intersects with the given range. The set is modified to contains only indexes that + are part of the given range. */ public native void intersectsRange(Range range); + /** Adds indexes of the given set of indexes. */ public native void addIndexSet(IndexSet indexSet); + /** Removes indexes of the given set. */ public native void removeIndexSet(IndexSet indexSet); + /** Intersects with the given set of indexes. */ public native void intersectsIndexSet(IndexSet indexSet); + /** Returns all the ranges that the set contains. */ public native List allRanges(); + /** Returns the number of ranges that the set contains. */ public native int rangesCount(); + /** Empties the set. */ public native void removeAllIndexes(); private native void setupNative(); diff --git a/src/java/com/libmailcore/Log.java b/src/java/com/libmailcore/Log.java index 5d202242..ceace7f7 100644 --- a/src/java/com/libmailcore/Log.java +++ b/src/java/com/libmailcore/Log.java @@ -1,6 +1,9 @@ package com.libmailcore; +/** Logging. */ public class Log { + /** Set whether debug logs are enabled. */ static public native void setEnabled(boolean enabled); + /** Returns whether debug logs are enabled. */ static public native boolean isEnabled(); } diff --git a/src/java/com/libmailcore/MailException.java b/src/java/com/libmailcore/MailException.java index a101b3e3..0d475b6e 100644 --- a/src/java/com/libmailcore/MailException.java +++ b/src/java/com/libmailcore/MailException.java @@ -1,17 +1,23 @@ package com.libmailcore; public class MailException extends Exception { + /** + Error code. + @see ErrorCode + */ public int errorCode() { return errorCode; } + /** Constructor of an exception with the given code and message. */ public MailException(String message, int anErrorCode) { super(message); errorCode = anErrorCode; } + /** Constructor of an exception with the given code. It will generate a message based on the code. */ public MailException(int anErrorCode) { super(messageForErrorCode(anErrorCode)); diff --git a/src/java/com/libmailcore/MainThreadUtils.java b/src/java/com/libmailcore/MainThreadUtils.java index 00a9ead2..97327d7a 100644 --- a/src/java/com/libmailcore/MainThreadUtils.java +++ b/src/java/com/libmailcore/MainThreadUtils.java @@ -5,12 +5,12 @@ import android.os.Looper; import android.util.Log; import java.util.HashMap; -public class MainThreadUtils { +class MainThreadUtils { private static volatile MainThreadUtils instance = new MainThreadUtils(); private Handler handler; private HashMap runnablesForIdentifiers = new HashMap(); - static public MainThreadUtils singleton() { + static MainThreadUtils singleton() { return instance; } diff --git a/src/java/com/libmailcore/MessageBuilder.java b/src/java/com/libmailcore/MessageBuilder.java index 66539fc7..3ea586e7 100644 --- a/src/java/com/libmailcore/MessageBuilder.java +++ b/src/java/com/libmailcore/MessageBuilder.java @@ -2,39 +2,66 @@ package com.libmailcore; import java.util.List; +/** RFC 822 Message builder. */ public class MessageBuilder extends AbstractMessage { + /** Constructor. */ public MessageBuilder() { setupNative(); } + /** Sets HTML body. */ public native void setHTMLBody(String htmlBody); + /** Returns HTML body. */ public native String htmlBody(); + /** Sets plain/text body. */ public native void setTextBody(String textBody); + /** Returns plain/text body. */ public native String textBody(); + /** Sets the list of attachments. */ public native void setAttachments(List attachments); + /** Returns the list of attachments. */ public native List attachments(); + /** Adds an attachment. */ public native void addAttachment(Attachment attachment); + /** Sets the list of related attachments (for example, images included in the HTML body). */ public native void setRelatedAttachments(List attachments); + /** Returns the list of related attachments. */ public native List relatedAttachments(); + /** Adds a related attachment. */ public native void addRelatedAttachment(Attachment attachment); + /** Set the prefix to use when generating the boundary separator. */ public native void setBoundaryPrefix(String boundaryPrefix); + /** Returns the prefix to use when generating the boundary separator. */ public native String boundaryPrefix(); + /** Returns RFC 822 data. */ public native byte[] data(); + /** Returns RFC 822 data that can be used safely for encryption/signature. */ public native byte[] dataForEncryption(); + /** Renders the message to HTML. */ public native String htmlRendering(HTMLRendererTemplateCallback callback); + /** Renders the body to HTML. */ public native String htmlBodyRendering(); + /** Renders the message to plain text. */ public native String plainTextRendering(); + /** Render the body to plain text. If stripWhitespace is true, all end of line and extra blank + space will be removed. */ public native String plainTextBodyRendering(boolean stripWhitespace); + /** Returns the RFC 822 message signed using PGP given the signature. The signature + needs to be computed using an external component. It will make to sure generate + the message format to conform to OpenPGP standard. */ public native byte[] openPGPSignedMessageDataWithSignatureData(byte[] signature); + /** Returns the RFC 822 message encrypted using PGP given the encrypted data. The encrypted data + needs to be computed using an external component. It will make to sure generate + the message format to conform to OpenPGP standard. */ public native byte[] openPGPEncryptedMessageDataWithEncryptedData(byte[] encryptedData); private native void setupNative(); diff --git a/src/java/com/libmailcore/MessageFlag.java b/src/java/com/libmailcore/MessageFlag.java index 22c2ffc0..888e44de 100644 --- a/src/java/com/libmailcore/MessageFlag.java +++ b/src/java/com/libmailcore/MessageFlag.java @@ -1,17 +1,19 @@ package com.libmailcore; +/** Flags of a message. + @see IMAPMessage#flags() */ public class MessageFlag { - final public static int MessageFlagNone = 0; - final public static int MessageFlagSeen = 1 << 0; - final public static int MessageFlagAnswered = 1 << 1; - final public static int MessageFlagFlagged = 1 << 2; - final public static int MessageFlagDeleted = 1 << 3; - final public static int MessageFlagDraft = 1 << 4; - final public static int MessageFlagMDNSent = 1 << 5; - final public static int MessageFlagForwarded = 1 << 6; - final public static int MessageFlagSubmitPending = 1 << 7; - final public static int MessageFlagSubmitted = 1 << 8; - final public static int MessageFlagMaskAll = MessageFlagSeen | MessageFlagAnswered | MessageFlagFlagged | + final public static int MessageFlagNone = 0; + final public static int MessageFlagSeen = 1 << 0; + final public static int MessageFlagAnswered = 1 << 1; + final public static int MessageFlagFlagged = 1 << 2; + final public static int MessageFlagDeleted = 1 << 3; + final public static int MessageFlagDraft = 1 << 4; + final public static int MessageFlagMDNSent = 1 << 5; + final public static int MessageFlagForwarded = 1 << 6; + final public static int MessageFlagSubmitPending = 1 << 7; + final public static int MessageFlagSubmitted = 1 << 8; + final public static int MessageFlagMaskAll = MessageFlagSeen | MessageFlagAnswered | MessageFlagFlagged | MessageFlagDeleted | MessageFlagDraft | MessageFlagMDNSent | MessageFlagForwarded | - MessageFlagSubmitPending | MessageFlagSubmitted; + MessageFlagSubmitPending | MessageFlagSubmitted; } diff --git a/src/java/com/libmailcore/MessageHeader.java b/src/java/com/libmailcore/MessageHeader.java index 89f44694..5498ecf3 100644 --- a/src/java/com/libmailcore/MessageHeader.java +++ b/src/java/com/libmailcore/MessageHeader.java @@ -3,69 +3,109 @@ package com.libmailcore; import java.util.List; import java.util.Date; +/** Message header. */ public class MessageHeader extends NativeObject { + /** Constuctor. */ public MessageHeader() { setupNative(); } + /** The constructor will parse the data encoded using RFC 822 and initializes + the content using those data. */ public MessageHeader(byte[] headersData) { setupNative(); importHeadersData(headersData); } + /** Returns the Message-ID. */ public native String messageID(); + /** Sets the Message-ID. */ public native void setMessageID(String messageID); + /** Returns whether the Message-ID has been generated. */ public native boolean isMessageIDAutoGenerated(); + /** Returns the References. */ public native List references(); + /** Sets the References. */ public native void setReferences(List references); + /** Returns In-Reply-To. */ public native List inReplyTo(); + /** Sets In-Reply-To. */ public native void setInReplyTo(List inReplyTo); + /** Returns Date. */ public native Date date(); + /** Sets Date. */ public native void setDate(Date date); + /** Sets the received date (it's not part of the RFC 822 headers). */ public native Date receivedDate(); + /** Returns the received date (it's not part of the RFC 822 headers). */ public native void setReceivedDate(Date date); + /** Returns Sender. */ public native Address sender(); + /** Set Sender. */ public native void setSender(Address sender); + /** Return From. */ public native Address from(); + /** Sets From. */ public native void setFrom(Address from); + /** Returns To. */ public native List
to(); + /** Sets To. */ public native void setTo(List
to); + /** Returns Cc. */ public native List
cc(); + /** Sets Cc. */ public native void setCc(List
cc); + /** Returns Bcc. */ public native List
bcc(); + /** Sets Bcc. */ public native void setBcc(List
bcc); + /** Returns Reply-To. */ public native List
replyTo(); + /** Sets Reply-To. */ public native void setReplyTo(List
replyTo); + /** Returns Subject. */ public native String subject(); + /** Sets Subject. */ public native void setSubject(String subject); + /** Returns X-Mailer. */ public native String userAgent(); + /** Sets X-Mailer. */ public native void setUserAgent(String userAgent); + /** Sets a custom header value. */ public native void setExtraHeader(String name, String value); + /** Remove a custom header. */ public native void removeExtraHeader(String name); + /** Returns the value of a custom header. */ public native String extraHeaderValueForName(String name); + /** Returns all the names of the custom headers. */ public native List allExtraHeadersNames(); + /** Returns the extracted subject (removing all the Re:, Fwd:, etc). Also removes brackets. */ public native String extractedSubject(); + /** Returns extracted subject but do not remove brackets. */ public native String partialExtractedSubject(); + /** Parsed the given data in RFC 822 format and sets the headers. */ public native void importHeadersData(byte[] data); + /** Generates a header that could be used for a reply message. */ public native MessageHeader replyHeader(boolean replyAll, List
excludedRecipients); + /** Generates a header that could be used as a base for a forwarded message. */ public native MessageHeader forwardHeader(); private native void setupNative(); diff --git a/src/java/com/libmailcore/MessageParser.java b/src/java/com/libmailcore/MessageParser.java index 2586a6d9..650e089a 100644 --- a/src/java/com/libmailcore/MessageParser.java +++ b/src/java/com/libmailcore/MessageParser.java @@ -1,19 +1,28 @@ package com.libmailcore; +/** RFC 822 message parser. */ public class MessageParser extends AbstractMessage { + /** Returns a MessageParser that parses the given RFC 822 message data. */ public static native MessageParser messageParserWithData(byte[] messageData); + /** Returns a MessageParser that parses the given file containing RFC 822 message data. */ public static native MessageParser messageParserWithContentsOfFile(String filename); + /** Returns the main part of the message. */ public native AbstractPart mainPart(); + /** Returns the data of the message. */ public native byte[] data(); + /** Renders the message as HTML. */ public native String htmlRendering(HTMLRendererTemplateCallback callback); public String htmlRendering() { return htmlRendering(null); } + /** Renders the body of the message as HTML. */ public native String htmlBodyRendering(); + /** Renders the message as plain text. */ public native String plainTextRendering(); + /** Renders the body of the message as plain text. */ public native String plainTextBodyRendering(boolean stripWhitespace); private native void setupNative(byte[] messageData); diff --git a/src/java/com/libmailcore/Multipart.java b/src/java/com/libmailcore/Multipart.java index 5251d1b2..d348b303 100644 --- a/src/java/com/libmailcore/Multipart.java +++ b/src/java/com/libmailcore/Multipart.java @@ -1,4 +1,5 @@ package com.libmailcore; +/** Parsed multipart. */ public class Multipart extends AbstractMultipart { } diff --git a/src/java/com/libmailcore/NativeObject.java b/src/java/com/libmailcore/NativeObject.java index a1923056..9e92cbd7 100644 --- a/src/java/com/libmailcore/NativeObject.java +++ b/src/java/com/libmailcore/NativeObject.java @@ -4,6 +4,7 @@ import java.util.Map; import java.io.Serializable; import java.io.IOException; +/** Native C++ Object wrapper. */ public class NativeObject implements Cloneable, Serializable { protected void finalize() throws Throwable { @@ -13,7 +14,9 @@ public class NativeObject implements Cloneable, Serializable { protected native void initWithNative(long nativeHandle); private native void unsetupNative(); + /** Returns a string representing the object. */ public native String toString(); + /** Create a copy of the object. */ public native Object clone() throws CloneNotSupportedException; private long nativeHandle; diff --git a/src/java/com/libmailcore/Operation.java b/src/java/com/libmailcore/Operation.java index 9ea4c35d..acc7e127 100644 --- a/src/java/com/libmailcore/Operation.java +++ b/src/java/com/libmailcore/Operation.java @@ -1,9 +1,13 @@ package com.libmailcore; public class Operation extends NativeObject { + /** Cancel the operation. */ public native void cancel(); + /** Returns whether the operation has been cancelled. */ public native boolean isCancelled(); + /** Starts the operation. Calls the aCallback.finished() when the operation is finished. + @see OperationCallback.finished() */ public void start(OperationCallback aCallback) { callback = aCallback; diff --git a/src/java/com/libmailcore/OperationCallback.java b/src/java/com/libmailcore/OperationCallback.java index 3b70e5c5..0843513c 100644 --- a/src/java/com/libmailcore/OperationCallback.java +++ b/src/java/com/libmailcore/OperationCallback.java @@ -1,6 +1,9 @@ package com.libmailcore; +/** Callbacks of an operation. */ public interface OperationCallback { + /** Called when the operation succeeded. */ void succeeded(); + /** Called when the operation failed. */ void failed(MailException exception); } diff --git a/src/java/com/libmailcore/OperationQueueListener.java b/src/java/com/libmailcore/OperationQueueListener.java index 1e939952..a23e1963 100644 --- a/src/java/com/libmailcore/OperationQueueListener.java +++ b/src/java/com/libmailcore/OperationQueueListener.java @@ -1,7 +1,10 @@ package com.libmailcore; +/** Listener of the queue of operations. */ public interface OperationQueueListener { + /** Called when an operation has just been added and operations start running. */ void queueStartRunning(); + /** Called when all operations have ben run. */ void queueStoppedRunning(); } diff --git a/src/java/com/libmailcore/PartType.java b/src/java/com/libmailcore/PartType.java index b9ce8fcc..eda8997a 100644 --- a/src/java/com/libmailcore/PartType.java +++ b/src/java/com/libmailcore/PartType.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** MIME Part type. + @see AbstractPart#partType() */ public class PartType { public final static int PartTypeSingle = 0; public final static int PartTypeMessage = 1; diff --git a/src/java/com/libmailcore/Range.java b/src/java/com/libmailcore/Range.java index d81e9fbc..3e508f9b 100644 --- a/src/java/com/libmailcore/Range.java +++ b/src/java/com/libmailcore/Range.java @@ -1,26 +1,40 @@ package com.libmailcore; +/** Range of integer values. */ public class Range { + /** Location. */ public long location; + /** Length of the range. A length of 0 is a range with only one item: the location. */ public long length; + /** When using RangeMax as the length of the range, it means that the range is infinite. */ static public long RangeMax = 1 >> 63 - 1; + /** Constructor for a range starting at 0 and of length 0. */ public Range() {} + /** Constructor */ public Range(long aLocation, long aLength) { location = aLocation; length = aLength; } + /** Subtract otherRange from this range and returns the resulting set of indexes. */ public native IndexSet removeRange(Range otherRange); + /** Union of otherRange and this range and returns the resulting set of indexes. */ public native IndexSet union(Range otherRange); + /** Returns the range resulting from the intersection. */ public native Range intersection(Range otherRange); + /** Returns whether the intersection is non-empty. */ public native boolean hasIntersection(Range otherRange); + /** Returns the included left bound of the range. */ public native long leftBound(); + /** Returns the included right bound of the range. */ public native long rightBound(); + /** Returns a string representation of range. */ public native String toString(); + /** Create a range using a string representation. */ public static native Range rangeWithString(String rangeString); static { diff --git a/src/java/com/libmailcore/SMTPOperation.java b/src/java/com/libmailcore/SMTPOperation.java index 16567b5f..af10d96b 100644 --- a/src/java/com/libmailcore/SMTPOperation.java +++ b/src/java/com/libmailcore/SMTPOperation.java @@ -1,6 +1,10 @@ package com.libmailcore; public class SMTPOperation extends Operation { + /** + Returns error once the operation finished running. It will return null if the operation + successfully ran. + */ public MailException exception() { if (errorCode() == ErrorCode.ErrorNone) { return null; diff --git a/src/java/com/libmailcore/SMTPSession.java b/src/java/com/libmailcore/SMTPSession.java index 7eb8afe9..36e00566 100644 --- a/src/java/com/libmailcore/SMTPSession.java +++ b/src/java/com/libmailcore/SMTPSession.java @@ -14,65 +14,108 @@ public class SMTPSession extends NativeObject { super.finalize(); } + /** Sets the SMTP server hostname. */ public native void setHostname(String hostname); + /** Returns the SMTP server hostname. */ public native String hostname(); + /** Sets the port. */ public native void setPort(int port); + /** Returns the port. */ public native int port(); + /** Sets the username. */ public native void setUsername(String username); + /** Returns the username. */ public native String username(); + /** Sets the password. */ public native void setPassword(String password); + /** Returns the password. */ public native String password(); + /** Sets the OAuth2 token. */ public native void setOAuth2Token(String token); + /** Returns the OAuth2 token. */ public native String OAuth2Token(); + /** + Sets the authentication type. + @see AuthType + */ public native void setAuthType(int authType); + /** + Returns authentication type. + @see Authtype + */ public native int authType(); + /** + Set connection type (clear-text, SSL or STARTTLS). + @see ConnectionType + */ public native void setConnectionType(int connectionType); + /** + Returns connection type (clear-text, SSL or STARTTLS). + @see ConnectionType + */ public native int connectionType(); + /** Sets network timeout in seconds. */ public native void setTimeout(long seconds); + /** Returns network timeout in seconds. */ public native long timeout(); + /** Sets whether the certificate of the server should be checked. */ public native void setCheckCertificateEnabled(boolean enabled); + /** Returns whether the certificate of the server should be checked. */ public native boolean isCheckCertificateEnabled(); + /** Sets whether it should use the IP address while using EHLO. */ public native void setUseHeloIPEnabled(boolean enabled); + /** Returns whether it should use the IP address while using EHLO. */ public native boolean useHeloIPEnabled(); + /** Sets the connection logger. */ public void setConnectionLogger(ConnectionLogger logger) { connectionLogger = logger; setupNativeConnectionLogger(); } + /** Returns the connection logger. */ public ConnectionLogger connectionLogger() { return connectionLogger; } + /** Sets the IMAP operations queue listener. */ public void setOperationQueueListener(OperationQueueListener listener) { operationQueueListener = listener; setupNativeOperationQueueListener(); } + /** Returns the IMAP operations queue listener. */ public OperationQueueListener operationQueueListener() { return operationQueueListener; } + /** Returns whether the operation queue is running. */ public native boolean isOperationQueueRunning(); + /** Cancels all queued operations. */ public native void cancelAllOperations(); + /** Returns an operation to authenticate. */ public native SMTPOperation loginOperation(); + /** Returns an operation to send a message. The recipient is detected in the data of the message. */ public native SMTPOperation sendMessageOperation(byte[] messageData); + /** Returns an operation to send a message. */ public native SMTPOperation sendMessageOperation(Address from, List
recipients, byte[] messageData); + /** Returns an operation to check whether the credentials of the account are correct. */ public native SMTPOperation checkAccountOperation(Address from); + /** Returns a SMTP NOOP operation. */ public native SMTPOperation noopOperation(); private native void setupNative(); diff --git a/src/java/native/com_libmailcore_AuthType.h b/src/java/native/com_libmailcore_AuthType.h new file mode 100644 index 00000000..23310879 --- /dev/null +++ b/src/java/native/com_libmailcore_AuthType.h @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_libmailcore_AuthType */ + +#ifndef _Included_com_libmailcore_AuthType +#define _Included_com_libmailcore_AuthType +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/java/native/com_libmailcore_IMAPSearchExpression.h b/src/java/native/com_libmailcore_IMAPSearchExpression.h index 88b321e4..519a023a 100644 --- a/src/java/native/com_libmailcore_IMAPSearchExpression.h +++ b/src/java/native/com_libmailcore_IMAPSearchExpression.h @@ -289,14 +289,6 @@ JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPSearchExpression_searchOr JNIEXPORT jobject JNICALL Java_com_libmailcore_IMAPSearchExpression_searchNot (JNIEnv *, jclass, jobject); -/* - * Class: com_libmailcore_IMAPSearchExpression - * Method: setupNative - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_libmailcore_IMAPSearchExpression_setupNative - (JNIEnv *, jobject); - #ifdef __cplusplus } #endif -- cgit v1.2.3