From b3713c0d84c3c00fbd5583cc2fe6913bfdcecd44 Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Wed, 7 Jan 2015 00:24:58 -0800 Subject: Java wrapper for POP, NNTP and SMTP --- src/java/com/libmailcore/NNTPGroupInfo.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/java/com/libmailcore/NNTPGroupInfo.java (limited to 'src/java/com/libmailcore/NNTPGroupInfo.java') diff --git a/src/java/com/libmailcore/NNTPGroupInfo.java b/src/java/com/libmailcore/NNTPGroupInfo.java new file mode 100644 index 00000000..f5bbfccb --- /dev/null +++ b/src/java/com/libmailcore/NNTPGroupInfo.java @@ -0,0 +1,16 @@ +package com.libmailcore; + +public class NNTPGroupInfo extends NativeObject { + public NNTPGroupInfo() + { + setupNative(); + } + + public native void setName(String name); + public native String name(); + + public native void setMessageCount(long count); + public native long messageCount(); + + private native void setupNative(); +} -- cgit v1.2.3 From 9358b2fda79ff8ef9ae712e76a05181536a2febd Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Sat, 17 Jan 2015 22:30:00 -0800 Subject: Javadoc --- src/java/com/libmailcore/IMAPOperation.java | 1 + .../libmailcore/NNTPFetchAllArticlesOperation.java | 2 ++ .../com/libmailcore/NNTPFetchArticleOperation.java | 2 ++ .../com/libmailcore/NNTPFetchHeaderOperation.java | 2 ++ .../libmailcore/NNTPFetchOverviewOperation.java | 1 + .../libmailcore/NNTPFetchServerTimeOperation.java | 1 + src/java/com/libmailcore/NNTPGroupInfo.java | 6 ++++ .../libmailcore/NNTPListNewsgroupsOperation.java | 1 + src/java/com/libmailcore/NNTPOperation.java | 10 ++++++ src/java/com/libmailcore/NNTPSession.java | 36 +++++++++++++++++++ .../com/libmailcore/POPFetchHeaderOperation.java | 2 ++ .../com/libmailcore/POPFetchMessageOperation.java | 2 ++ .../com/libmailcore/POPFetchMessagesOperation.java | 1 + src/java/com/libmailcore/POPMessageInfo.java | 8 +++++ src/java/com/libmailcore/POPOperation.java | 10 ++++++ src/java/com/libmailcore/POPSession.java | 41 ++++++++++++++++++++++ src/java/com/libmailcore/SMTPOperation.java | 5 +++ 17 files changed, 131 insertions(+) (limited to 'src/java/com/libmailcore/NNTPGroupInfo.java') diff --git a/src/java/com/libmailcore/IMAPOperation.java b/src/java/com/libmailcore/IMAPOperation.java index aebc707a..cf6d8ee4 100644 --- a/src/java/com/libmailcore/IMAPOperation.java +++ b/src/java/com/libmailcore/IMAPOperation.java @@ -1,5 +1,6 @@ package com.libmailcore; +/** IMAP Operation. */ public class IMAPOperation extends Operation { /** Returns error once the operation finished running. It will return null if the operation diff --git a/src/java/com/libmailcore/NNTPFetchAllArticlesOperation.java b/src/java/com/libmailcore/NNTPFetchAllArticlesOperation.java index 697af5bb..abc37ad2 100644 --- a/src/java/com/libmailcore/NNTPFetchAllArticlesOperation.java +++ b/src/java/com/libmailcore/NNTPFetchAllArticlesOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Operation to fetch all numbers of all the articles of a newsgroup. */ public class NNTPFetchAllArticlesOperation extends NNTPOperation { + /** numbers of all the articles. */ public native IndexSet articles(); } diff --git a/src/java/com/libmailcore/NNTPFetchArticleOperation.java b/src/java/com/libmailcore/NNTPFetchArticleOperation.java index 56f147db..2f60e38b 100644 --- a/src/java/com/libmailcore/NNTPFetchArticleOperation.java +++ b/src/java/com/libmailcore/NNTPFetchArticleOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Operation to fetch the content of a given article. */ public class NNTPFetchArticleOperation extends NNTPOperation { + /** Content of the article in RFC 822 format. */ public native byte[] data(); } diff --git a/src/java/com/libmailcore/NNTPFetchHeaderOperation.java b/src/java/com/libmailcore/NNTPFetchHeaderOperation.java index f0c40f31..a05f6a30 100644 --- a/src/java/com/libmailcore/NNTPFetchHeaderOperation.java +++ b/src/java/com/libmailcore/NNTPFetchHeaderOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Operation to fetch header of a given article. */ public class NNTPFetchHeaderOperation extends NNTPOperation { + /** Parsed header of the article. */ public native MessageHeader header(); } diff --git a/src/java/com/libmailcore/NNTPFetchOverviewOperation.java b/src/java/com/libmailcore/NNTPFetchOverviewOperation.java index 2707723e..4abe85b8 100644 --- a/src/java/com/libmailcore/NNTPFetchOverviewOperation.java +++ b/src/java/com/libmailcore/NNTPFetchOverviewOperation.java @@ -2,6 +2,7 @@ package com.libmailcore; import java.util.List; +/** Operation to fetch list of summary headers of a set of articles of a newsgroup. */ public class NNTPFetchOverviewOperation extends NNTPOperation { public native List articles(); } diff --git a/src/java/com/libmailcore/NNTPFetchServerTimeOperation.java b/src/java/com/libmailcore/NNTPFetchServerTimeOperation.java index 72fd5b85..41af4152 100644 --- a/src/java/com/libmailcore/NNTPFetchServerTimeOperation.java +++ b/src/java/com/libmailcore/NNTPFetchServerTimeOperation.java @@ -2,6 +2,7 @@ package com.libmailcore; import java.util.Date; +/** Operation to fetch the server time. */ public class NNTPFetchServerTimeOperation extends NNTPOperation { public native Date time(); } diff --git a/src/java/com/libmailcore/NNTPGroupInfo.java b/src/java/com/libmailcore/NNTPGroupInfo.java index f5bbfccb..b7bb1dba 100644 --- a/src/java/com/libmailcore/NNTPGroupInfo.java +++ b/src/java/com/libmailcore/NNTPGroupInfo.java @@ -1,15 +1,21 @@ package com.libmailcore; +/** Newsgroup infos. */ public class NNTPGroupInfo extends NativeObject { + /** Constructor. */ public NNTPGroupInfo() { setupNative(); } + /** Sets the name of the newsgroup. */ public native void setName(String name); + /** Returns the name of the newsgroup. */ public native String name(); + /** Sets the number of messages in the newsgroup. */ public native void setMessageCount(long count); + /** Returns the number of messages in the newsgroup. */ public native long messageCount(); private native void setupNative(); diff --git a/src/java/com/libmailcore/NNTPListNewsgroupsOperation.java b/src/java/com/libmailcore/NNTPListNewsgroupsOperation.java index f5bf4b97..ae21ba12 100644 --- a/src/java/com/libmailcore/NNTPListNewsgroupsOperation.java +++ b/src/java/com/libmailcore/NNTPListNewsgroupsOperation.java @@ -2,6 +2,7 @@ package com.libmailcore; import java.util.List; +/** Operation to list newsgroups. */ public class NNTPListNewsgroupsOperation extends NNTPOperation { public native List groups(); } diff --git a/src/java/com/libmailcore/NNTPOperation.java b/src/java/com/libmailcore/NNTPOperation.java index 5787e03a..243d3177 100644 --- a/src/java/com/libmailcore/NNTPOperation.java +++ b/src/java/com/libmailcore/NNTPOperation.java @@ -1,6 +1,11 @@ package com.libmailcore; +/** NNTP Operation. */ public class NNTPOperation 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 +15,11 @@ public class NNTPOperation 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/NNTPSession.java b/src/java/com/libmailcore/NNTPSession.java index eb7d3d2e..c54291b7 100644 --- a/src/java/com/libmailcore/NNTPSession.java +++ b/src/java/com/libmailcore/NNTPSession.java @@ -12,61 +12,97 @@ public class NNTPSession extends NativeObject { super.finalize(); } + /** Sets the NNTP server hostname. */ public native void setHostname(String hostname); + /** Returns the NNTP 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(); + /** + 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 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 fetch the list of numbers of all articles of a newsgroup. */ public native NNTPFetchAllArticlesOperation fetchAllArticlesOperation(String group); + /** Returns an operation to fetch the headers of a given article. */ public native NNTPFetchHeaderOperation fetchHeaderOperation(String group, int idx); + /** Returns an operation to fetch the content of a given article. */ public native NNTPFetchArticleOperation fetchArticleOperation(String group, int idx); + /** Returns an operation to fetch the content of a given articl using the Message-ID. */ public native NNTPFetchArticleOperation fetchArticleByMessageIDOperation(String group, String messageID); + /** Returns an operation to fetch the summary headers of set of articles of a newsgroup. */ public native NNTPFetchOverviewOperation fetchOverviewOperationWithIndexes(String group, IndexSet indexes); + /** Returns an operation to fetch the server date. */ public native NNTPFetchServerTimeOperation fetchServerDateOperation(); + /** Returns an operation to fetch the list of all newsgroups. */ public native NNTPListNewsgroupsOperation listAllNewsgroupsOperation(); + /** Returns an operation to fetch the ist of default newsgroups. */ public native NNTPListNewsgroupsOperation listDefaultNewsgroupsOperation(); + /** Returns an operation to disconnect. */ public native NNTPOperation disconnectOperation(); + /** Returns an operation to check credentials. */ public native NNTPOperation checkAccountOperation(); private native void setupNative(); diff --git a/src/java/com/libmailcore/POPFetchHeaderOperation.java b/src/java/com/libmailcore/POPFetchHeaderOperation.java index 4750ca8e..d43ba1d4 100644 --- a/src/java/com/libmailcore/POPFetchHeaderOperation.java +++ b/src/java/com/libmailcore/POPFetchHeaderOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Operation to fetch the header of a message. */ public class POPFetchHeaderOperation extends POPOperation { + /** Parsed header of the message. */ public native MessageHeader header(); } diff --git a/src/java/com/libmailcore/POPFetchMessageOperation.java b/src/java/com/libmailcore/POPFetchMessageOperation.java index f0bbed6b..b1a39814 100644 --- a/src/java/com/libmailcore/POPFetchMessageOperation.java +++ b/src/java/com/libmailcore/POPFetchMessageOperation.java @@ -1,5 +1,7 @@ package com.libmailcore; +/** Operation to fetch a message. */ public class POPFetchMessageOperation extends POPOperation { + /** Content of the message in RFC 822 format. */ public native byte[] data(); } diff --git a/src/java/com/libmailcore/POPFetchMessagesOperation.java b/src/java/com/libmailcore/POPFetchMessagesOperation.java index 4844db24..c120d233 100644 --- a/src/java/com/libmailcore/POPFetchMessagesOperation.java +++ b/src/java/com/libmailcore/POPFetchMessagesOperation.java @@ -2,6 +2,7 @@ package com.libmailcore; import java.util.List; +/** Operation to fetch the list of messages. */ public class POPFetchMessagesOperation extends POPOperation { public native List messages(); } diff --git a/src/java/com/libmailcore/POPMessageInfo.java b/src/java/com/libmailcore/POPMessageInfo.java index cbb2aa31..70230fe7 100644 --- a/src/java/com/libmailcore/POPMessageInfo.java +++ b/src/java/com/libmailcore/POPMessageInfo.java @@ -1,18 +1,26 @@ package com.libmailcore; +/** Info about a message. */ public class POPMessageInfo extends NativeObject { + /** Constructor. */ public POPMessageInfo() { setupNative(); } + /** Sets the index of the message. */ public native void setIndex(int index); + /** Returns the index of the message, valid during the POP session. */ public native int index(); + /** Sets the size of the message. */ public native void setSize(long size); + /** Returns the size of the message. */ public native long size(); + /** Sets the unique identifier of the message. */ public native void setUid(String uid); + /** Returns the unique identifier of the message. */ public native String uid(); private native void setupNative(); diff --git a/src/java/com/libmailcore/POPOperation.java b/src/java/com/libmailcore/POPOperation.java index e349a0c8..5f8baed3 100644 --- a/src/java/com/libmailcore/POPOperation.java +++ b/src/java/com/libmailcore/POPOperation.java @@ -1,6 +1,11 @@ package com.libmailcore; +/** POP Operation. */ public class POPOperation 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 +15,11 @@ public class POPOperation 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/POPSession.java b/src/java/com/libmailcore/POPSession.java index b18c25e2..9feba046 100644 --- a/src/java/com/libmailcore/POPSession.java +++ b/src/java/com/libmailcore/POPSession.java @@ -12,61 +12,102 @@ public class POPSession extends NativeObject { super.finalize(); } + /** Sets the POP server hostname. */ public native void setHostname(String hostname); + /** Returns the POP 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 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 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 fetch the list of messages. */ public native POPFetchMessagesOperation fetchMessagesOperation(); + /** Returns an operation to fetch headers of a given message. */ public native POPFetchHeaderOperation fetchHeaderOperation(int index); + /** Returns an operation to fetch the content of a given message. */ public native POPFetchMessageOperation fetchMessageOperation(int index); + /** Returns an operation to delete messages. */ public native POPOperation deleteMessagesOperation(IndexSet indexes); + /** Returns an operation to disconnect. */ public native POPOperation disconnectOperation(); + /** Returns an operation to check credentials. */ public native POPOperation checkAccountOperation(); + /** Returns a POP NOOP operation. */ public native POPOperation noopOperation(); private native void setupNative(); diff --git a/src/java/com/libmailcore/SMTPOperation.java b/src/java/com/libmailcore/SMTPOperation.java index af10d96b..a4c8f562 100644 --- a/src/java/com/libmailcore/SMTPOperation.java +++ b/src/java/com/libmailcore/SMTPOperation.java @@ -14,6 +14,11 @@ public class SMTPOperation 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) { -- cgit v1.2.3