#$K+ Contents
Click any of the topics below, or to display an alphabetical list of topics, click on the Index button on the toolbar.
Overview Topics
IMsg Properties
Rule Engine Behavior
Event Types
NNTP_ON_POST Event
NNTP_ON_POST_FINAL Event
GUIDs
CATID_NNTP_ON_POST
CATID_NNTP_ON_POST_FINAL
NNTP_SOURCE_TYPE_GUID
COM Interfaces
IMsg
IMsgLog
INNTPFilter
INNTPFilterOnPostFinal

#$K+ CATID_NNTP_ON_POST
GUID Value = {C028FD83-F943-11d0-85BD-00C04FB960EA}
Description
This is the GUID that is used for the NNTP_ON_POST event.

#$K+ CATID_NNTP_ON_POST_FINAL
GUID Value = {C028FD83-F943-11d0-85BD-00C04FB960EA}
Description
This is the GUID that is used for the NNTP_ON_POST_FINAL event.

#$K+ IMsg Properties
The IMsg object passed into the INNTPFilter::OnPost and INNTPFilterOnPostFinal::OnPostFinal methods supports the following properties:
Property Name	Type	Access	Events	Description						
header-*	String	Read	NNTP_ON_POST, NNTP_ON_POST_FINAL	Any property name that starts with "header-" can be used to read up an article's header.  For instance the property "header-from" would get the contents of the From: header, and "header-subject" would get the contents of the Subject: header.	
					
feedid	Numeric	Read-Only	NNTP_ON_POST, NNTP_ON_POST_FINAL	Returns the feed id that this message was generated from.  It will return -1 if the message is coming from a client, or -2 if the message is was picked up from the pickup directory.	
					
message stream	Interface	Read-Only	NNTP_ON_POST, NNTP_ON_POST_FINAL	Returns a read-only IStream pointer with the contents of the message.	
					
newsgroups	String	Read/Write	NNTP_ON_POST, NNTP_ON_POST_FINAL	This returns a comma-delimited list of newsgroups that the message will be stored in (which may be different then what is in the Newsgroups header).  This is read only during the NNTP_ON_POST_FINAL event.	
post	Numeric	Read/Write	NNTP_ON_POST	If this is 0 then the post will be failed, any other number will cause the message to be posted.	
					
process control	Numeric	Read/Write	NNTP_ON_POST	If this is 0 then the server will disable its control message logic for this message.  Any other number will cause the server to run the control message logic normally.	
					
process moderator	Numeric	Read/Write	NNTP_ON_POST	If this is 0 then the server will disable its moderated posting logic for this message.  Any other number will cause the server to run the moderated posting logic normally.	

#$K+ NNTP_ON_POST Event
The NNTP_ON_POST event is triggered by the NNTP server when a new message is being posted (either from a client or from a feed), before the message is processed or put into the store.  Filters installed at this point can control server processing of the message, alter the newgroups that the message will be posted to, or stop the message from being posted.
Filter Object Interfaces
Filter objects that are bound to the NNTP_ON_POST event must support the INNTPFilter interface.
See Also
CATID_NNTP_ON_POST
NNTP_ON_POST_FINAL Event
INNTPFilter

#$K+ NNTP_ON_POST_FINAL Event
The NNTP_ON_POST_FINAL event is triggered by the NNTP server when a new message is being posted (either from a client or from a feed) after the message has been written into the store.  Filters should install at this point if they require notification of message postings.  It is guaranteed that if this event is triggered that the message has been added to the store.
Filter Object Interfaces
Filter objects that are bound to the NNTP_ON_POST_FINAL event must support the INNTPFilterOnPostFinal interface or the INNTPFilter interface. If both interfaces are supported then the server will use the INNTPFilterOnPostFinal interface.
See Also
CATID_NNTP_ON_POST_FINAL
NNTP_ON_POST Event
INNTPFilterOnPostFinal

#$K+ NNTP_SOURCE_TYPE_GUID
GUID Value = {C028FD82-F943-11d0-85BD-00C04FB960EA}
Description
This is the source type GUID for NNTP instances.

#$K+ Rule Engine Behavior
The NNTP server looks for two properties under the SourceProperties property bag for each event binding before calling a sink object.  The first is "Rule", which allows headers and metaheaders values to be examined.  The second is "NewsgroupList", which is an explicit list of newsgroups to act upon.
Rule property
The rule property is built up from clauses in the format "header=value1,value2".  There can be any number of values, each separated by commas.  If any of the values matches then the clause passes. The values can include wildcards.  If there are no values supplied then just having the header exist in the message will cause the rule to pass.
There can be many of these clauses in one rule.  They should be separated by semi-colons.  All of the clauses must pass for the rule to pass.
There are two special pseudo-headers called ":newsgroups" and ":feedid".  The ":newsgroups" pseudo-header contains the list of newsgroups that the message will be stored in (note that this may be different then the Newsgroups header, eg. control messages).  With the :newsgroups header each value is checked against newsgroup that the message will be stored in.
The ":feedid" pseudo-header contains the feed ID which this message originated from.  There are two special feed IDs, -1 and -2.  A feed ID of -1 means that the message came from a client posting.  A feed ID of -2 means that the message was picked up through directory pickup.  You can use the :feedid pseudo-header to cause sinks to be called based on where messages originated from.
By default all string comparisons are case-insensitive.  To change this behavior the clause "case-sensitive" can be used to turn on case-sensitivity.  The clause "case-insensitive" can be used to turn off case-sensitivity as well.  These can be mixed in one rule.  The rule is processed left-to-right.
Examples
This example checks for messages with the header X-testhdr with the contents test:
X-testhdr=test

This example checks for messages with the header X-testhdr with the contents one or two:
X-testhdr=one,two

This example checks to see if the message contains a control header:
control=

This example checks for messages with the header from containing the string "user@company.com" and the header subject containing the string "forsale":
from=*user@company.com*,forsale

This example checks for all messages which are being stored in the the alt hierarchy:
:newsgroups=alt.*

This example checks to see if the from header contains the string "test" in any case and the subject header contains the string "test" in any case:
case-sensitive;from=TEST;case-insensitive;subject=test

This example checks to see if the from header contains the string "TEST" in all upper case and the subject header contains the string "test" in any case:
case-sensitive;from=TEST;case-insensitive;subject=test

This example checks to see if the message originated from a client posting or from a file picked up through directory pickup:
:feedid=-1,-2

This example checks to see if the message originated from the feeds with IDs 1, 2, or 7:
:feedid=1,2,7

NewsgroupList property
The NewsgroupList property contains a comma delimited list of newsgroups names.  These newsgroup names can not contain any wildcards.  If the message is being stored in any of these newsgroups then the rule will trigger.  For a large number of newsgroups this is faster then using the ":newsgroups" pseudo-header with the "Rule" property.  If no groups are listed supplied then this rule will always fail.
Examples
This example checks for messages going to group1
group1

This example checks for messages going to group1 or group2
group1,group2

Mixing Rule Properties
You can use both the Rule and NewsgroupList property in one event.  If both properties are present then they both need to pass for the sink object to be called.  If neither property is present then the sink object will always be called.

#$K+ Module IMSG.IDL - IDL for the IMsg interface
Filename: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Description
This interface is used by the server events model in the NNTP and SMTP servers.

#$K+ IMsg
The message interface
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Methods
HRESULT Value [propget]
Get a property value
HRESULT Value [propput]
Set a property value
HRESULT GetVariantA
High performance method to get a property value as a variant.  This method is not automation compatible.
HRESULT SetVariantA
High performance method to set a property value as a variant.  This method is not automation compatible.
HRESULT GetStringA
High performance method to get a string property value.  This method is not automation compatible.
HRESULT SetStringA
High performance method to set a string property value.  This method is not automation compatible.
HRESULT GetDwordA
High performance method to get a DWORD property value.  This method is not automation compatible.
HRESULT SetDwordA
High performance method to set a DWORD property value.  This method is not automation compatible.
HRESULT GetInterfaceA
High performance method to get a interface property value.  This method is not automation compatible.
HRESULT SetInterfaceA
High performance method to set a interface property value.  This method is not automation compatible.
See Also
IMsg Properties

#$K+ IMsg::GetDwordA
HRESULT GetDwordA(LPCSTR pszName, VARIANT * pvarResult)
Get a numeric property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not a number	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[out] The value of the property
See Also
IMsg
SetDwordA
Value [propget]
Value [propput]

#$K+ IMsg::GetInterfaceA
HRESULT GetInterfaceA(LPCSTR pszName, VARIANT * pvarResult)
Get a COM interface property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not an interface pointer	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[out] The value of the property
See Also
IMsg
SetInterfaceA
Value [propget]
Value [propput]

#$K+ IMsg::GetStringA
HRESULT GetStringA(LPCSTR pszName, VARIANT * pvarResult)
Get a string property as an ANSI string using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not a string	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[out] The value of the property
See Also
IMsg
SetStringA
Value [propget]
Value [propput]

#$K+ IMsg::GetVariantA
HRESULT GetVariantA(LPCSTR pszName, VARIANT * pvarResult)
Get a variant property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to get
pvarResult
[out] The value of the property
See Also
IMsg
SetVariantA
Value [propget]
Value [propput]

#$K+ IMsg::SetDwordA
HRESULT SetDwordA(LPCWSTR pszName, VARIANT * pvarResult)
Set a numeric property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not a number	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[out] The value of the property
See Also
IMsg
GetDwordA
Value [propget]
Value [propput]

#$K+ IMsg::SetInterfaceA
HRESULT SetInterfaceA(LPCWSTR pszName, VARIANT * varResult)
Set a COM interface property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not an interface pointer	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
varResult
[in] The value of the property
See Also
IMsg
GetInterfaceA
Value [propget]
Value [propput]

#$K+ IMsg::SetStringA
HRESULT SetStringA(LPCWSTR pszName, VARIANT * pvarResult)
Set a string property as an ANSI string using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
TYPE_E_TYPEMISMATCH	Failure, property is not a string	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[in] The value of the property
See Also
IMsg
GetStringA
Value [propget]
Value [propput]

#$K+ IMsg::SetVariantA
HRESULT SetVariantA(LPCWSTR pszName, VARIANT * pvarResult)
Set a variant property using the ANSI property name
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
pszName
[in] The name of the property to set
pvarResult
[in] The value of the property
See Also
IMsg
GetVariantA
Value [propget]
Value [propput]

#$K+ IMsg::Value [propget]
HRESULT Value [propget](BSTR bstrProperty, VARIANT * pvarValue)
Get the value of a property
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
bstrProperty
[in] The name of the property to retrieve
pvarValue
[out, retval] The value of the property
See Also
IMsg
Value [propput]

#$K+ IMsg::Value [propput]
HRESULT Value [propput](BSTR bstrProperty, VARIANT * pvarValue)
Put the value of a property
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
S_FALSE	Property doesn't exist	
E_OUTOFMEMORY	Failure, out of memory	
E_INVALIDARG	Failure, invalid argument or argument type	
E_ACCESSDENIED	Failure, operation not permitted	

Parameters
bstrProperty
[in] The name of the property to set
pvarValue
[out, retval] The value of the property
See Also
IMsg
Value [propget]

#$K+ IMsgLog
The message logging interface
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Methods
HRESULT WriteToLog
Write to the log

#$K+ IMsgLog::WriteToLog
HRESULT WriteToLog(LPCWSTR pszClientHostName, LPCWSTR pszClientUserName, LPCWSTR pszServerAddress, LPCWSTR pszOperation, LPCWSTR pszTarget, LPCWSTR pszParameters, LPCWSTR pszVersion, DWORD dwBytesSent, DWORD dwBytesReceived, DWORD dwProcessingTimeMS, DWORD dwWin32Status, DWORD dwProtocolStatus, DWORD dwPort, LPCWSTR pszHTTPHeader)
Write to the log
Defined in: C:/EX/STACKS/SRC/CORE/IMSG/IMSG.IDL
Return Codes
S_OK	Success	
E_FAIL	Failure.	
E_NOTIMPL	Failure, not implemented.	

Parameters
pszClientHostName
[in] Specifies the Client Host Name.  May be NULL.
pszClientUserName
[in] Specifies the Client User Name.  May be NULL.
pszServerAddress
[in] Specifies the Server Address  May be NULL.
pszOperation
[in] Specifies the operation.  May be NULL.
pszTarget
[in] Specifies the target.  May be NULL.
pszParameters
[in] Specifies the parameters.  May be NULL.
pszVersion
[in] Specifies the version.  May be NULL.
dwBytesSent
[in] Specifies the number of bytes sent.
dwBytesReceived
[in] Specifies the number of bytes received.
dwProcessingTimeMS
[in] Specifies the time spent processing, in milliseconds.
dwWin32Status
[in] Specifies the Win32 status code.
dwProtocolStatus
[in] Specifies the protocol status code.
dwPort
[in] Specifies the port.
pszHTTPHeader
[in] Specifies the HTTP header.  May be NULL.
See Also
IMsgLog

#$K+ INNTPFilter
This interface should be implemented by sink objects that want to support the NNTP_ON_POST and NNTP_ON_POST_FINAL events.
Defined in: C:/EX/STACKS/SRC/CORE/NNTPFILT/NNTPFILT.IDL
Methods
HRESULT OnPost
The OnPost method is called by the NNTP server when the NNTP_ON_POST or NNTP_ON_POST_FINAL event occurs.
See Also
IMsg
INNTPFilterOnPostFinal
NNTP_ON_POST Event
NNTP_ON_POST_FINAL Event

#$K+ INNTPFilter::OnPost
HRESULT OnPost(IMsg * pMessage)
The NNTP server calls this method when the NNTP_ON_POST or NNTP_ON_POST_FINAL event is triggered and passes the rule found in the binding database.
Defined in: C:/EX/STACKS/SRC/CORE/NNTPFILT/NNTPFILT.IDL
Return Codes
S_OK	Success, call the next installed sink	
S_FALSE	Success, don't call any other sink	
Any COM error code	Failure, don't call any other sinks	

Parameters
pMessage
[in] A pointer to the IMsg object for the message which is being posted
See Also
IMsg
INNTPFilterOnPostFinal::OnPostFinal
NNTP_ON_POST Event
NNTP_ON_POST_FINAL Event

#$K+ INNTPFilterOnPostFinal
This interface should be implemented by sink objects that want to support the NNTP_ON_POST_FINAL event.
Defined in: C:/EX/STACKS/SRC/CORE/NNTPFILT/NNTPFILT.IDL
Methods
HRESULT OnPostFinal
The OnPostFinal method is called by the NNTP server when an NNTP_ON_POST_FINAL event occurs.
See Also
IMsg
INNTPFilter
NNTP_ON_POST Event
NNTP_ON_POST_FINAL Event

#$K+ INNTPFilterOnPostFinal::OnPostFinal
HRESULT OnPostFinal(IMsg * pMessage)
The NNTP server calls this method when the NNTP_ON_POST_FINAL event is triggered and the passes the rule found in the binding database.
Defined in: C:/EX/STACKS/SRC/CORE/NNTPFILT/NNTPFILT.IDL
Return Codes
S_OK	Success, call the next installed sink	
S_FALSE	Success, don't call any other sinks	
Any COM error code	Failure, don't call any other sinks	

Parameters
pMessage
[in] A pointer to the IMsg object for the message which is being posted.
See Also
IMsg
INNTPFilter::OnPost
NNTP_ON_POST Event
NNTP_ON_POST_FINAL Event