IP*Works!

ipworks
Class Nntp

java.lang.Object
  |
  +--ipworks.Nntp

public class Nntp
extends java.lang.Object

The NNTP control is used to read and post articles on Usenet news servers.

The NNTP control implements a standard Usenet news reader as specified in RFC 977. It can be used to browse Usenet news groups and read and post articles.

The control operates mainly by calling methods. Setting action codes to the Action property will achieve identical results. The CurrentGroup property sets the current newsgroup. From then on, news articles from that group can be read by setting the article number in CurrentArticle and then setting the appropriate method or Action code. Properties such as ArticleCount , FirstArticle , LastArticle provide information about the current state.

The headers and text of the articles are received respectively through the Header and Transfer events. Additionally, up to MaxLines from the article body are provided in the ArticleText property. The GroupOverview event returns information about a range of articles ( OverviewRange ) in CurrentGroup , and the GroupList event is used when listing newsgroup names. The PITrail event provides a trace of the interaction with the server.

The control supports posting of articles through the ArticleText and AttachedFile properties. The article text is specified in one or both of the above, and then the PostArticle method is called or the appropriate Action code is sent. Article headers are given in a series of properties like From , Subject , Organization , etc. that map directly to the USENET article header with the same name.


Field Summary
static int fwNone
           
static int fwSOCKS4
           
static int fwSOCKS5
           
static int fwTunnel
           
static int nntpConnect
           
static int nntpDisconnect
           
static int nntpGetArticle
           
static int nntpGetArticleBody
           
static int nntpGetArticleHeaders
           
static int nntpGroupOverview
           
static int nntpGroupSearch
           
static int nntpIdle
           
static int nntpListGroups
           
static int nntpListNewGroups
           
static int nntpPostArticle
           
static int nntpResetHeaders
           
 
Constructor Summary
Nntp()
           
 
Method Summary
 void addNntpEventListener(NntpEventListener l)
           
 void connect()
          Connect to the news server.
 void disconnect()
          Disconnect from the news server.
 void fetchArticle()
          Get the headers and body of an article specified in CurrentArticle .
 void fetchArticleBody()
          Get only the body of an article specified in CurrentArticle .
 void fetchArticleHeaders()
          Get only the headers of an article specified in CurrentArticle .
 void fireEndTransfer()
          Fired when the article text completes transferring.
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void fireGroupList(java.lang.String group, int firstArticle, int lastArticle, boolean canPost)
          Fired while group data transfers (during group listings).
 void fireGroupOverview(int articleNumber, java.lang.String subject, java.lang.String from, java.lang.String articleDate, java.lang.String messageId, java.lang.String references, int articleSize, int articleLines, java.lang.String otherHeaders)
          Fired for each line of article overview data (during group overviews).
 void fireGroupSearch(int articleNumber, java.lang.String header)
          Fired for each line of group search data (during group searches).
 void fireHeader(java.lang.String field, java.lang.String value)
          Fired for every article header being retrieved during article retrieval.
 void firePITrail(int direction, java.lang.String message)
          Traces the commands sent to the mail server, and the respective replies.
 void fireStartTransfer()
          Fired when the article text starts transferring.
 void fireTransfer(int bytesTransferred, byte[] text, boolean EOL)
          Fired while the article text gets transferred (to or from the NewsServer ).
 int getAction()
          An action code for the component.
 int getArticleCount()
          The estimated number of articles in CurrentGroup .
 java.lang.String getArticleHeaders()
          The full headers of the article as retrieved from the server.
 java.lang.String getArticleText()
          The full text of the article (without the headers).
 java.lang.String getAttachedFile()
          A file name which contents to append to ArticleText when posting articles.
 java.lang.String getCheckDate()
          The date (format YYMMDD HHMMSS) since when to check for creation of new groups.
 java.lang.String getCurrentArticle()
          The number or message-id of the current article.
 java.lang.String getCurrentGroup()
          The name of the current group (action property).
 byte[] getFirewallData()
          Used to send other data to firewall.
 java.lang.String getFirewallHost()
          Name or IP address of firewall (optional).
 java.lang.String getFirewallPassword()
          A password if authentication is to be used connecting through the firewall.
 int getFirewallPort()
          Port of the firewall to connect to.
 int getFirewallType()
          Determines the type of firewall to connect through.
 java.lang.String getFirewallUser()
          A user name if authentication is to be used connecting through a firewall.
 int getFirstArticle()
          The number of the first article in CurrentGroup.
 java.lang.String getFrom()
          The email address of the author (for posting articles).
 int getLastArticle()
          The number of the last article in CurrentGroup .
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 int getMaxHeaderLength()
          Maximum length for headers to avoid line folding (default 80).
 int getMaxLines()
          The maximum number of message lines beside headers to retrieve.
 java.lang.String getNewsgroups()
          A comma separated list of newsgroups where to post the article.
 int getNewsPort()
          The server port for NNTP (default 119).
 java.lang.String getNewsServer()
          The name or address of a news server.
 java.lang.String getOrganization()
          The organization of the author (for posting articles).
 java.lang.String getOtherHeaders()
          An RFC850 compliant string consisting of extra headers (for posting articles).
 java.lang.String getOverviewRange()
          A range for the nntpGroupOverview action (first-last).
 java.lang.String getPassword()
          A login password to login with in the NewsServer .
 java.lang.String getReferences()
          Articles the posted article follows up to.
 java.lang.String getReplyTo()
          The address to reply to (for posting articles).
 java.lang.String getSearchHeader()
          A header for the nntpGroupSearch action.
 java.lang.String getSearchPattern()
          A search pattern for the nntpGroupSearch action.
 java.lang.String getSearchRange()
          A range for the nntpGroupSearch action (first-last).
 java.lang.String getSubject()
          The article subject (for posted articles).
 int getTimeout()
          A timeout for the component.
 java.lang.String getUser()
          A user id to login as in the NewsServer .
 void groupOverview()
          Receive an overview for the articles in range OverviewRange in the CurrentGroup .
 void groupSearch()
          Receive an overview for the articles in range OverviewRange in the CurrentGroup .
 void interrupt()
          Interrupt the Action in progress (if any).
 boolean isConnected()
          Shows whether the component is connected.
 void listGroups()
          List all groups on the server.
 void listNewGroups()
          List all new groups on the server.
 void postArticle()
          Post the current article and attached file.
 void removeNntpEventListener(NntpEventListener l)
           
 void resetHeaders()
          Reset all of the article headers.
 void setAction(int action)
          An action code for the component.
 void setArticleText(java.lang.String articleText)
          The full text of the article (without the headers).
 void setAttachedFile(java.lang.String attachedFile)
          A file name which contents to append to ArticleText when posting articles.
 void setCheckDate(java.lang.String checkDate)
          The date (format YYMMDD HHMMSS) since when to check for creation of new groups.
 void setCommand(java.lang.String command)
          Can be used to send additional commands directly to the NNTP server.
 void setCurrentArticle(java.lang.String currentArticle)
          The number or message-id of the current article.
 void setCurrentGroup(java.lang.String currentGroup)
          The name of the current group (action property).
 void setFirewallData(byte[] firewallData)
          Used to send other data to firewall.
 void setFirewallHost(java.lang.String firewallHost)
          Name or IP address of firewall (optional).
 void setFirewallPassword(java.lang.String firewallPassword)
          A password if authentication is to be used connecting through the firewall.
 void setFirewallPort(int firewallPort)
          Port of the firewall to connect to.
 void setFirewallType(int firewallType)
          Determines the type of firewall to connect through.
 void setFirewallUser(java.lang.String firewallUser)
          A user name if authentication is to be used connecting through a firewall.
 void setFrom(java.lang.String from)
          The email address of the author (for posting articles).
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setMaxHeaderLength(int maxHeaderLength)
          Maximum length for headers to avoid line folding (default 80).
 void setMaxLines(int maxLines)
          The maximum number of message lines beside headers to retrieve.
 void setNewsgroups(java.lang.String newsgroups)
          A comma separated list of newsgroups where to post the article.
 void setNewsPort(int newsPort)
          The server port for NNTP (default 119).
 void setNewsServer(java.lang.String newsServer)
          The name or address of a news server.
 void setOrganization(java.lang.String organization)
          The organization of the author (for posting articles).
 void setOtherHeaders(java.lang.String otherHeaders)
          An RFC850 compliant string consisting of extra headers (for posting articles).
 void setOverviewRange(java.lang.String overviewRange)
          A range for the nntpGroupOverview action (first-last).
 void setPassword(java.lang.String password)
          A login password to login with in the NewsServer .
 void setReferences(java.lang.String references)
          Articles the posted article follows up to.
 void setReplyTo(java.lang.String replyTo)
          The address to reply to (for posting articles).
 void setSearchHeader(java.lang.String searchHeader)
          A header for the nntpGroupSearch action.
 void setSearchPattern(java.lang.String searchPattern)
          A search pattern for the nntpGroupSearch action.
 void setSearchRange(java.lang.String searchRange)
          A range for the nntpGroupSearch action (first-last).
 void setSubject(java.lang.String subject)
          The article subject (for posted articles).
 void setTimeout(int timeout)
          A timeout for the component.
 void setUser(java.lang.String user)
          A user id to login as in the NewsServer .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nntpIdle

public static final int nntpIdle

nntpConnect

public static final int nntpConnect

nntpDisconnect

public static final int nntpDisconnect

nntpListGroups

public static final int nntpListGroups

nntpListNewGroups

public static final int nntpListNewGroups

nntpGroupOverview

public static final int nntpGroupOverview

nntpGetArticle

public static final int nntpGetArticle

nntpGetArticleHeaders

public static final int nntpGetArticleHeaders

nntpGetArticleBody

public static final int nntpGetArticleBody

nntpPostArticle

public static final int nntpPostArticle

nntpResetHeaders

public static final int nntpResetHeaders

nntpGroupSearch

public static final int nntpGroupSearch

fwNone

public static final int fwNone

fwTunnel

public static final int fwTunnel

fwSOCKS4

public static final int fwSOCKS4

fwSOCKS5

public static final int fwSOCKS5
Constructor Detail

Nntp

public Nntp()
Method Detail

getAction

public int getAction()
An action code for the component. Setting the Action property to a valid action code makes the control perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The following are the possible values for the Action property and the corresponding descriptions:

nntpIdle (0)
Default action. It can also be used to interrupt the current operation.
nntpConnect (1)
Connect to the news server. If the User and/or Password are set, then corresponding AUTHINFO commands are sent to the NewsServer as well.
nntpDisconnect (2)
Disconnect from the NewsServer . First the control attempts to send a QUIT command, and if that fails, the connection is broken.
nntpListGroups (3)
Asks the server to list all its newsgroups. Use this action with caution as listing groups may take quite long over dialup lines. The group names and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpListNewGroups (4)
Asks the server to list all the newsgroups created since CheckDate . The group names (if any) and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGroupOverview (5)
Receive an overview for the articles in range OverviewRange in the CurrentGroup . The overview data are delivered via the GroupOverview event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticle (6)
Get the headers and body of the article specified in CurrentArticle . The headers are delivered via the Header event, and the article body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticleHeaders (7)
Get only the headers of the article specified in CurrentArticle . The headers are delivered via the Header event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticleBody (8)
Get only the body of the article specified in CurrentArticle . The body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpPostArticle (9)
Post the current article and attached file (if any). If a connection to the NewsServer doesn't already exist, a new one is created.
nntpResetHeaders (10)
Resets all the article headers to "" (empty string). Use this property before posting a new article, so that headers from the previous article are not carried over to the next one.
nntpGroupSearch (11)
Searches the current newsgroup for articles in range SearchRange in the CurrentGroup , where SearchHeader matches SearchPattern . The results are delivered via the GroupSearch event. If a connection to the NewsServer doesn't already exist, a new one is created.


setAction

public void setAction(int action)
               throws IPWorksException
An action code for the component. Setting the Action property to a valid action code makes the control perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The following are the possible values for the Action property and the corresponding descriptions:

nntpIdle (0)
Default action. It can also be used to interrupt the current operation.
nntpConnect (1)
Connect to the news server. If the User and/or Password are set, then corresponding AUTHINFO commands are sent to the NewsServer as well.
nntpDisconnect (2)
Disconnect from the NewsServer . First the control attempts to send a QUIT command, and if that fails, the connection is broken.
nntpListGroups (3)
Asks the server to list all its newsgroups. Use this action with caution as listing groups may take quite long over dialup lines. The group names and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpListNewGroups (4)
Asks the server to list all the newsgroups created since CheckDate . The group names (if any) and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGroupOverview (5)
Receive an overview for the articles in range OverviewRange in the CurrentGroup . The overview data are delivered via the GroupOverview event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticle (6)
Get the headers and body of the article specified in CurrentArticle . The headers are delivered via the Header event, and the article body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticleHeaders (7)
Get only the headers of the article specified in CurrentArticle . The headers are delivered via the Header event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpGetArticleBody (8)
Get only the body of the article specified in CurrentArticle . The body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.
nntpPostArticle (9)
Post the current article and attached file (if any). If a connection to the NewsServer doesn't already exist, a new one is created.
nntpResetHeaders (10)
Resets all the article headers to "" (empty string). Use this property before posting a new article, so that headers from the previous article are not carried over to the next one.
nntpGroupSearch (11)
Searches the current newsgroup for articles in range SearchRange in the CurrentGroup , where SearchHeader matches SearchPattern . The results are delivered via the GroupSearch event. If a connection to the NewsServer doesn't already exist, a new one is created.


getArticleCount

public int getArticleCount()
The estimated number of articles in CurrentGroup . The value of this property is 0 if there is no current group ( CurrentGroup is ""). Otherwise, it is the number of articles in the group as shown by the news server when CurrentGroup is set. For most news servers, this is an estimated value of the number of the articles, rather than the exact value.


getArticleHeaders

public java.lang.String getArticleHeaders()
The full headers of the article as retrieved from the server. If the control is not connected, or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full headers of the article as reported by the server.

The NewsServer is asked about the headers of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the control returns a cached value.


getArticleText

public java.lang.String getArticleText()
The full text of the article (without the headers). If the control is not connected, or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full text of the article as reported by the server.

The NewsServer is asked about the text of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the control returns a cached value.

When posting articles, the ArticleText property contains the full text of the article to post.

It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n"). The text in the article lines must contain 7-bit characters so that the article can be successfully transferred through the various Usenet news servers on the Internet.

The control automatically escapes lines that start with a "." by adding another "." as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.


setArticleText

public void setArticleText(java.lang.String articleText)
                    throws IPWorksException
The full text of the article (without the headers). If the control is not connected, or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full text of the article as reported by the server.

The NewsServer is asked about the text of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the control returns a cached value.

When posting articles, the ArticleText property contains the full text of the article to post.

It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n"). The text in the article lines must contain 7-bit characters so that the article can be successfully transferred through the various Usenet news servers on the Internet.

The control automatically escapes lines that start with a "." by adding another "." as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.


getAttachedFile

public java.lang.String getAttachedFile()
A file name which contents to append to ArticleText when posting articles. The content of AttachedFile is appended to the text in ArticleText (if any) and sent to the news server. This property is useful for posting arbitrarily large articles and/or sending MIME attachments.

It is advisable that the text contained in the file be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the message lines must contain only 7-bit characters so that the message may be successfully sent through the various Usenet news servers on the Internet.

The control automatically escapes lines that start with a "." by adding another as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.


setAttachedFile

public void setAttachedFile(java.lang.String attachedFile)
                     throws IPWorksException
A file name which contents to append to ArticleText when posting articles. The content of AttachedFile is appended to the text in ArticleText (if any) and sent to the news server. This property is useful for posting arbitrarily large articles and/or sending MIME attachments.

It is advisable that the text contained in the file be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the message lines must contain only 7-bit characters so that the message may be successfully sent through the various Usenet news servers on the Internet.

The control automatically escapes lines that start with a "." by adding another as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.


getCheckDate

public java.lang.String getCheckDate()
The date (format YYMMDD HHMMSS) since when to check for creation of new groups. The value of this property is used as an argument for the nntpListNewGroups action. See the description of the Action property for more information.


setCheckDate

public void setCheckDate(java.lang.String checkDate)
                  throws IPWorksException
The date (format YYMMDD HHMMSS) since when to check for creation of new groups. The value of this property is used as an argument for the nntpListNewGroups action. See the description of the Action property for more information.


setCommand

public void setCommand(java.lang.String command)
                throws IPWorksException
Can be used to send additional commands directly to the NNTP server. Check the LastReply property and/or trap the PITrail events comming from the server to get the response.


isConnected

public boolean isConnected()
Shows whether the component is connected. Use this property to determine whether the control is connected to the remote host or not.


getCurrentArticle

public java.lang.String getCurrentArticle()
The number or message-id of the current article. The CurrentArticle property specifies either a message id or an article number uniquely identifying a particular article. It is then used as an argument to actions like nntpGetArticle . Please refer to the description of the Action property for more information.


setCurrentArticle

public void setCurrentArticle(java.lang.String currentArticle)
                       throws IPWorksException
The number or message-id of the current article. The CurrentArticle property specifies either a message id or an article number uniquely identifying a particular article. It is then used as an argument to actions like nntpGetArticle . Please refer to the description of the Action property for more information.


getCurrentGroup

public java.lang.String getCurrentGroup()
The name of the current group (action property). When the CurrentGroup property is set to a valid group name, the control sends an NNTP GROUP commands to the NewsServer and enters the specified group. If this action is successful, then FirstArticle , LastArticle , and ArticleCount are set to the reported values for the group. CurrentGroup is then used for all references to articles (until changed to another group).


setCurrentGroup

public void setCurrentGroup(java.lang.String currentGroup)
                     throws IPWorksException
The name of the current group (action property). When the CurrentGroup property is set to a valid group name, the control sends an NNTP GROUP commands to the NewsServer and enters the specified group. If this action is successful, then FirstArticle , LastArticle , and ArticleCount are set to the reported values for the group. CurrentGroup is then used for all references to articles (until changed to another group).


getFirewallData

public byte[] getFirewallData()
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


setFirewallData

public void setFirewallData(byte[] firewallData)
                     throws IPWorksException
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


getFirewallHost

public java.lang.String getFirewallHost()
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.


setFirewallHost

public void setFirewallHost(java.lang.String firewallHost)
                     throws IPWorksException
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.


getFirewallPassword

public java.lang.String getFirewallPassword()
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallPassword

public void setFirewallPassword(java.lang.String firewallPassword)
                         throws IPWorksException
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


getFirewallPort

public int getFirewallPort()
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


setFirewallPort

public void setFirewallPort(int firewallPort)
                     throws IPWorksException
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


getFirewallType

public int getFirewallType()
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


setFirewallType

public void setFirewallType(int firewallType)
                     throws IPWorksException
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


getFirewallUser

public java.lang.String getFirewallUser()
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallUser

public void setFirewallUser(java.lang.String firewallUser)
                     throws IPWorksException
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


getFirstArticle

public int getFirstArticle()
The number of the first article in CurrentGroup. The value of this property is 0 if there is no current group ( CurrentGroup is "").


getFrom

public java.lang.String getFrom()
The email address of the author (for posting articles). The string in From is posted with a From article header to the news server.

If the resulting From header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setFrom

public void setFrom(java.lang.String from)
             throws IPWorksException
The email address of the author (for posting articles). The string in From is posted with a From article header to the news server.

If the resulting From header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getLastArticle

public int getLastArticle()
The number of the last article in CurrentGroup . The value of this property is 0 if there is no current group ( CurrentGroup is "").


getLastReply

public java.lang.String getLastReply()
The last reply from the server. This is the last reply received from the server. It can be used for information purposes. The same information and more can also be retrieved through the PITrail event.


getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


getMaxHeaderLength

public int getMaxHeaderLength()
Maximum length for headers to avoid line folding (default 80). The MaxHeaderLength specifies the maximum line length supported by the news delivery system. Any headers longer than MaxHeaderLength are folded as specified in RFC 850.

It is generally a good idea to use a MaxHeaderLength of less than 100 bytes, although different news servers have different requirements for header lengths.


setMaxHeaderLength

public void setMaxHeaderLength(int maxHeaderLength)
                        throws IPWorksException
Maximum length for headers to avoid line folding (default 80). The MaxHeaderLength specifies the maximum line length supported by the news delivery system. Any headers longer than MaxHeaderLength are folded as specified in RFC 850.

It is generally a good idea to use a MaxHeaderLength of less than 100 bytes, although different news servers have different requirements for header lengths.


getMaxLines

public int getMaxLines()
The maximum number of message lines beside headers to retrieve. The MaxLines property is used to limit the number of text lines besides headers retrieved for messages. This property is used in conjunction with the ArticleText property. Please note that due to NNTP protocol limitations, the full text of the article is always retrieved from the server, but only MaxLines will be stored in ArticleText .

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.


setMaxLines

public void setMaxLines(int maxLines)
                 throws IPWorksException
The maximum number of message lines beside headers to retrieve. The MaxLines property is used to limit the number of text lines besides headers retrieved for messages. This property is used in conjunction with the ArticleText property. Please note that due to NNTP protocol limitations, the full text of the article is always retrieved from the server, but only MaxLines will be stored in ArticleText .

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.


getNewsgroups

public java.lang.String getNewsgroups()
A comma separated list of newsgroups where to post the article. The string in Newsgroups is posted with a Newsgroups article header to the news server. It specifies the list of groups where the article is posted (comma separated).

If the Newsgroups property contains "" (empty string), then the value of the CurrentGroup property is used to specify the target newsgroup for the posted article.

If the resulting Newsgroups header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setNewsgroups

public void setNewsgroups(java.lang.String newsgroups)
                   throws IPWorksException
A comma separated list of newsgroups where to post the article. The string in Newsgroups is posted with a Newsgroups article header to the news server. It specifies the list of groups where the article is posted (comma separated).

If the Newsgroups property contains "" (empty string), then the value of the CurrentGroup property is used to specify the target newsgroup for the posted article.

If the resulting Newsgroups header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getNewsPort

public int getNewsPort()
The server port for NNTP (default 119). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the NewsPort while connected will fail with an error.


setNewsPort

public void setNewsPort(int newsPort)
                 throws IPWorksException
The server port for NNTP (default 119). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the NewsPort while connected will fail with an error.


getNewsServer

public java.lang.String getNewsServer()
The name or address of a news server. The NewsServer property specifies the IP address (IP number in dotted internet format) or Domain Name for the news server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the NewsServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the NewsServer property is set to the corresponding address. If the search is not successful, an error is returned.


setNewsServer

public void setNewsServer(java.lang.String newsServer)
                   throws IPWorksException
The name or address of a news server. The NewsServer property specifies the IP address (IP number in dotted internet format) or Domain Name for the news server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the NewsServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the NewsServer property is set to the corresponding address. If the search is not successful, an error is returned.


getOrganization

public java.lang.String getOrganization()
The organization of the author (for posting articles). If the Organization property contains a non-empty string, an Organization article header is created for the article. This header shows the organization of the author and is used for information purposes only.

If the resulting Organization header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setOrganization

public void setOrganization(java.lang.String organization)
                     throws IPWorksException
The organization of the author (for posting articles). If the Organization property contains a non-empty string, an Organization article header is created for the article. This header shows the organization of the author and is used for information purposes only.

If the resulting Organization header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getOtherHeaders

public java.lang.String getOtherHeaders()
An RFC850 compliant string consisting of extra headers (for posting articles). The OtherHeaders property contains a string of headers to be appended to the message headers created from other properties like From , Subject , etc.

The headers must be of the format "header: value" as specified in RFC 850. Header lines should be separated by CRLF ("\\r\\n").

Use this property with caution. If OtherHeaders contains invalid headers, article posting might not be successful.

The OtherHeaders property is useful for extending the functionality of the control. A good example is posting of MIME attachments.

SPECIAL CASE: if OtherHeaders starts with an empty line (CRLF), then the value of OtherHeaders is used instead of the normally computed article headers.


setOtherHeaders

public void setOtherHeaders(java.lang.String otherHeaders)
                     throws IPWorksException
An RFC850 compliant string consisting of extra headers (for posting articles). The OtherHeaders property contains a string of headers to be appended to the message headers created from other properties like From , Subject , etc.

The headers must be of the format "header: value" as specified in RFC 850. Header lines should be separated by CRLF ("\\r\\n").

Use this property with caution. If OtherHeaders contains invalid headers, article posting might not be successful.

The OtherHeaders property is useful for extending the functionality of the control. A good example is posting of MIME attachments.

SPECIAL CASE: if OtherHeaders starts with an empty line (CRLF), then the value of OtherHeaders is used instead of the normally computed article headers.


getOverviewRange

public java.lang.String getOverviewRange()
A range for the nntpGroupOverview action (first-last). The OverviewRange specifies a range of articles for which to retrieve article overviews from the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'all articles in the group' .


setOverviewRange

public void setOverviewRange(java.lang.String overviewRange)
                      throws IPWorksException
A range for the nntpGroupOverview action (first-last). The OverviewRange specifies a range of articles for which to retrieve article overviews from the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'all articles in the group' .


getPassword

public java.lang.String getPassword()
A login password to login with in the NewsServer . If the Password property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO PASS command is sent in order to provide authentication information for the user. This command is not part of the NNTP protocol, but it is widely used by popular news servers.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
A login password to login with in the NewsServer . If the Password property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO PASS command is sent in order to provide authentication information for the user. This command is not part of the NNTP protocol, but it is widely used by popular news servers.


getReferences

public java.lang.String getReferences()
Articles the posted article follows up to. If the References property contains a non-empty string, a References article header is created for the article. This header shows the article-ids the posted article refers to.

The references must be separated by commas with no spaces in between.

If the resulting References header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setReferences

public void setReferences(java.lang.String references)
                   throws IPWorksException
Articles the posted article follows up to. If the References property contains a non-empty string, a References article header is created for the article. This header shows the article-ids the posted article refers to.

The references must be separated by commas with no spaces in between.

If the resulting References header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getReplyTo

public java.lang.String getReplyTo()
The address to reply to (for posting articles). If the ReplyTo property contains a non-empty string, a Reply-To article header is created for the article. This header shows the address to use for replies (useful if this address is different from the one in From ).

If the resulting Reply-To header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setReplyTo

public void setReplyTo(java.lang.String replyTo)
                throws IPWorksException
The address to reply to (for posting articles). If the ReplyTo property contains a non-empty string, a Reply-To article header is created for the article. This header shows the address to use for replies (useful if this address is different from the one in From ).

If the resulting Reply-To header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getSearchHeader

public java.lang.String getSearchHeader()
A header for the nntpGroupSearch action. The SearchHeader property specifies the header to search for SearchPattern (e.g. "Subject").


setSearchHeader

public void setSearchHeader(java.lang.String searchHeader)
                     throws IPWorksException
A header for the nntpGroupSearch action. The SearchHeader property specifies the header to search for SearchPattern (e.g. "Subject").


getSearchPattern

public java.lang.String getSearchPattern()
A search pattern for the nntpGroupSearch action. The format of the pattern is the same as the patterns used by the UNIX 'find' command.

As an example, "* new *" will match all headers that contain the word "new".


setSearchPattern

public void setSearchPattern(java.lang.String searchPattern)
                      throws IPWorksException
A search pattern for the nntpGroupSearch action. The format of the pattern is the same as the patterns used by the UNIX 'find' command.

As an example, "* new *" will match all headers that contain the word "new".


getSearchRange

public java.lang.String getSearchRange()
A range for the nntpGroupSearch action (first-last). The OverviewRange specifies a range of articles for which to to do a search on the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'search all articles in the group' .


setSearchRange

public void setSearchRange(java.lang.String searchRange)
                    throws IPWorksException
A range for the nntpGroupSearch action (first-last). The OverviewRange specifies a range of articles for which to to do a search on the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'search all articles in the group' .


getSubject

public java.lang.String getSubject()
The article subject (for posted articles). The string in Subject is posted with a Subject article header to the news server.

If the resulting Subject header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


setSubject

public void setSubject(java.lang.String subject)
                throws IPWorksException
The article subject (for posted articles). The string in Subject is posted with a Subject article header to the news server.

If the resulting Subject header is longer than MaxHeaderLength , then it is folded according to RFC 850 specifications.


getTimeout

public int getTimeout()
A timeout for the component. If the Timeout property is set to 0 (default value) all actions will run uninterrupted until succesful completion, or an error condition is encountered.

If Timeout is set to a positive value, and any action does not complete within Timeout seconds, the action is aborted, and a 'Timeout' error is fired..

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and always remains responsive.


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the component. If the Timeout property is set to 0 (default value) all actions will run uninterrupted until succesful completion, or an error condition is encountered.

If Timeout is set to a positive value, and any action does not complete within Timeout seconds, the action is aborted, and a 'Timeout' error is fired..

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and always remains responsive.


getUser

public java.lang.String getUser()
A user id to login as in the NewsServer . If the User property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO USER command is sent in order to provide authentication information for the user. Although this command is not part of the NNTP protocol, it is widely used by news servers for authentication purposes.


setUser

public void setUser(java.lang.String user)
             throws IPWorksException
A user id to login as in the NewsServer . If the User property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO USER command is sent in order to provide authentication information for the user. Although this command is not part of the NNTP protocol, it is widely used by news servers for authentication purposes.


fireEndTransfer

public void fireEndTransfer()
Fired when the article text completes transferring. (Called internally to dispatch the event.)
See Also:
NntpEndTransferEvent

fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
NntpErrorEvent

fireGroupList

public void fireGroupList(java.lang.String group,
                          int firstArticle,
                          int lastArticle,
                          boolean canPost)
Fired while group data transfers (during group listings). (Called internally to dispatch the event.)
See Also:
NntpGroupListEvent

fireGroupOverview

public void fireGroupOverview(int articleNumber,
                              java.lang.String subject,
                              java.lang.String from,
                              java.lang.String articleDate,
                              java.lang.String messageId,
                              java.lang.String references,
                              int articleSize,
                              int articleLines,
                              java.lang.String otherHeaders)
Fired for each line of article overview data (during group overviews). (Called internally to dispatch the event.)
See Also:
NntpGroupOverviewEvent

fireGroupSearch

public void fireGroupSearch(int articleNumber,
                            java.lang.String header)
Fired for each line of group search data (during group searches). (Called internally to dispatch the event.)
See Also:
NntpGroupSearchEvent

fireHeader

public void fireHeader(java.lang.String field,
                       java.lang.String value)
Fired for every article header being retrieved during article retrieval. (Called internally to dispatch the event.)
See Also:
NntpHeaderEvent

firePITrail

public void firePITrail(int direction,
                        java.lang.String message)
Traces the commands sent to the mail server, and the respective replies. (Called internally to dispatch the event.)
See Also:
NntpPITrailEvent

fireStartTransfer

public void fireStartTransfer()
Fired when the article text starts transferring. (Called internally to dispatch the event.)
See Also:
NntpStartTransferEvent

fireTransfer

public void fireTransfer(int bytesTransferred,
                         byte[] text,
                         boolean EOL)
Fired while the article text gets transferred (to or from the NewsServer ). (Called internally to dispatch the event.)
See Also:
NntpTransferEvent

connect

public void connect()
             throws IPWorksException
Connect to the news server. Connect to the news server. If the User and/or Password are set, then corresponding AUTHINFO commands are sent to the NewsServer as well.

Calling this method is equivalent to setting the Action property to nntpConnect .


disconnect

public void disconnect()
                throws IPWorksException
Disconnect from the news server. Disconnect from the NewsServer . First the control attempts to send a QUIT command, and if that fails, the connection is broken.

Calling this method is equivalent to setting the Action property to nntpDisconnect .


fetchArticle

public void fetchArticle()
                  throws IPWorksException
Get the headers and body of an article specified in CurrentArticle . Get the headers and body of the article specified in CurrentArticle . The headers are delivered via the Header event, and the article body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpGetArticle .


fetchArticleBody

public void fetchArticleBody()
                      throws IPWorksException
Get only the body of an article specified in CurrentArticle . Get only the body of the article specified in CurrentArticle . The body via the Transfer event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpGetArticleBody .


fetchArticleHeaders

public void fetchArticleHeaders()
                         throws IPWorksException
Get only the headers of an article specified in CurrentArticle . Get only the headers of the article specified in CurrentArticle . The headers are delivered via the Header event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpGetArticleHeaders .


groupOverview

public void groupOverview()
                   throws IPWorksException
Receive an overview for the articles in range OverviewRange in the CurrentGroup . Receive an overview for the articles in range OverviewRange in the CurrentGroup . The overview data are delivered via the GroupOverview event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpGroupOverview .


groupSearch

public void groupSearch()
                 throws IPWorksException
Receive an overview for the articles in range OverviewRange in the CurrentGroup . Searches the current newsgroup for articles in range SearchRange in the CurrentGroup , where SearchHeader matches SearchPattern . The results are delivered via the GroupSearch event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpSearchGroup .


interrupt

public void interrupt()
               throws IPWorksException
Interrupt the Action in progress (if any). Calling this method is equivalent to setting the Action property to Idle (0) .


listGroups

public void listGroups()
                throws IPWorksException
List all groups on the server. Asks the server to list all its newsgroups. Use this action with caution as listing groups may take quite long over dialup lines. The group names and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpListGroups .


listNewGroups

public void listNewGroups()
                   throws IPWorksException
List all new groups on the server. Asks the server to list all the newsgroups created since CheckDate . The group names (if any) and other information are returned via the GroupList event. If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpListNewGroups .


postArticle

public void postArticle()
                 throws IPWorksException
Post the current article and attached file. Post the current article and attached file (if any). If a connection to the NewsServer doesn't already exist, a new one is created.

Calling this method is equivalent to setting the Action property to nntpPostArticle .


resetHeaders

public void resetHeaders()
                  throws IPWorksException
Reset all of the article headers. Resets all the article headers to "" (empty string). Use this property before posting a new article, so that headers from the previous article are not carried over to the next one.

Calling this method is equivalent to setting the Action property to nntpResetHeaders .


addNntpEventListener

public void addNntpEventListener(NntpEventListener l)
                          throws java.util.TooManyListenersException

removeNntpEventListener

public void removeNntpEventListener(NntpEventListener l)

IP*Works!

Copyright (c) 2001 /n software inc. - All rights reserved.