Collabra Server API Guide

[Contents] [Previous] [Next] [Index]

Chapter 1
Collabra Server API Reference


Functions

AddRecipient
GetHeaderFile
NewRecipient
FreeMessage
GetNextRecipient
PostArticle
GetBodyFile
GetRecipientAddress
RemoveRecipient
GetFirstRecipient
NewMessage

Structures

Message
Recipient
Address

This chapter is a reference to Collabra Server API functions and structures.

For Collabra Server program definitions, see the plugin.h header file, included in The plugin.h Header File. For a quick reference to these functions and their uses, see "Functions."

See the "News Program" for an sample code that uses many of these functions in a program that creates and posts a news messages from within an application.

[Top] [Functions]


Functions

The Collabra Server API includes the following functions:

AddRecipient
Adds the specified recipient to the message.

FreeMessage
Frees the resources associated with a message.

GetBodyFile
Gets the path to the body file associated with the message.

GetFirstRecipient
Gets the first recipient in the message.

GetHeaderFile
Gets the path to the header file associated with the message.

GetNextRecipient
Gets all subsequent recipients in the message.

GetRecipientAddress
Gets the address of the specified recipient.

NewMessage
Creates a new message.

NewRecipient
Creates a new recipient.

PostArticle
Sends a message to the News Server.

RemoveRecipient
Deletes recipients from the message.

These functions are a subset of the utility functions that are supported by the Collabra Server SDK Library.

[Top] [Functions]


PostArticle

Sends a Message structure to the News Server.

Syntax
#include <plugin.h> 
int PostArticle (char *Server, Message *pMessage);
Parameters
The function has the following parameters:

Server
Pointer to the host name of News Server to receive the message.

pMessage
Pointer to the name of the existing Message structure.

Returns
The function returns one of the following values:

Description
This function sends an existing Message structure to the News Server. This function only sends mail to the Address structures in the message that were created with the ADDRTYPE_NEWS type.

See Also
Message

[Top] [Functions]


AddRecipient

Adds the specified recipients to the Message structure.

Syntax
#include <plugin.h> 
int AddRecipient (Message *pMessage, Recipient *pRecipient);
Parameters
The function has the following parameters:

pMessage
Pointer to the name of the Message structure.

pRecipient
Pointer to the address of the recipient.

Returns
The function returns one of the following values:

Description
This function adds the specified recipients to the Message structure. It succeeds if both input parameters are valid and no memory errors occur. Currently, no specific error codes for failure are defined.

See Also
GetFirstRecipient, GetNextRecipient, GetRecipientAddress, NewRecipient, RemoveRecipient [Top] [Functions]


FreeMessage

Frees the resources associated with a message.

Syntax
#include <plugin.h>
void FreeMessage (Message *pMessage);
Parameters
The function has the following parameters:

pMessage
Pointer to the Message structure with which the resources are associated.

Description
This function frees the resources associated with the Message structure pointed to by pMessage.

See Also
NewMessage

[Top] [Functions]


GetBodyFile

Gets the path to the body file associated with a message.

Syntax
#include <plugin.h>
char *GetBodyFile (Message *pMessage);
Parameters
The function has the following parameters:

pMessage
Pointer to the name of the Message structure.

Returns
The function returns one of the following values:

Description
This function returns the path to the body file associated with the Message structure pointed to by pMessage.

See Also
GetHeaderFile

[Top] [Functions]


GetFirstRecipient

Gets a pointer to the first recipient in the message.

Syntax
#include <plugin.h>
Recipient *GetFirstRecipient (Message *pMessage);
Parameters
The function has the following parameters:

pMessage
Pointer to the name of the Message structure.

Returns
The function returns one of the following values:

Description
This function returns a pointer to the first recipient in the Message structure pointed to by the pMessage parameter. Any subsequent call to GetFirstRecipient resets the retrieval of recipients so that calls to GetNextRecipient return the second, third, and all subsequent recipients.

See Also
AddRecipient, GetNextRecipient, GetRecipientAddress, NewRecipient, RemoveRecipient

[Top] [Functions]


GetHeaderFile

Gets the path to the header file associated with the specified message.

Syntax
#include <plugin.h> 
char *GetHeaderFile (Message *pMessage);
Parameters
The function has the following parameters:

pMessage
Pointer to the name of the Message structure.

Returns
The function returns one of the following values:

Description
This function returns the path to the header file associated with the Message structure pointed to by the pMessage parameter.

See Also
GetBodyFile

[Top] [Functions]


GetNextRecipient

Gets the second, third, and all subsequent recipients in the message.

Syntax
#include <plugin.h>
Recipient *GetNextRecipient (RecipientList *pRecipientList);
Parameters
The function has the following parameters:

pRecipientList
Pointer to the list of recipients in the Message structure.

Returns
The function returns one of the following values:

Description
This function returns the second, third, and all subsequent recipients in the Message structure.

See Also
AddRecipient, GetFirstRecipient, GetRecipientAddress, NewRecipient, RemoveRecipient

[Top] [Functions]


GetRecipientAddress

Gets the address string contained in the specified Recipient structure.

Syntax
#include <plugin.h> 
char *GetRecipientAddress (Recipient *pRecipient);
Parameters
The function has the following parameters:

pRecipient
Pointer to the address of the recipient.

Returns
The function returns one of the following values:

Description
This function returns the address string contained in the Recipient structure represented by the pRecipient parameter.

See Also
AddRecipient, GetFirstRecipient, GetNextRecipient, NewRecipient, RemoveRecipient

[Top] [Functions]


NewMessage

Creates a new message.

Syntax
#include <plugin.h> 
Message *NewMessage(char *szBodyFile, 
            char *szHeaderFile,
            char *szSenderAddr);
Parameters
The function has the following parameters:

szBodyFile
Pointer to the path to a text file that contains the body of the message.

szHeaderFile
Pointer to the path to a text file that contains the header of the message.

szSenderAddr
Pointer to the recipient of the sender property of the Message structure

Returns
The function returns one of the following values:

Description
This function creates a new Message structure. In the new message, it sets the sender property of the Message structure to szSenderAddr. You must still set the From header field in the header file.

See Also
FreeMessage

[Top] [Functions]


NewRecipient

Creates a new recipient.

Syntax
#include <plugin.h>
Recipient *NewRecipient (char *Address, long Type);
Parameters
The function has the following parameters:

Address
Pointer to an address. Possible values include:

Type
ADDRTYPE_NEWS value. Use NEWS.

Returns
The function returns one of the following values:

Description
This function creates a new Recipient structure.

To free a Recipient structure, use standard memory management calls.

See Also
AddRecipient, GetFirstRecipient, GetNextRecipient, GetRecipientAddress, RemoveRecipient

[Top] [Functions]


RemoveRecipient

Deletes recipients from the message.

Syntax
#include <plugin.h>
int RemoveRecipient (Message *pMessage, Recipient *pRecipient);
Parameters
The function has the following parameters:

pMessage
Pointer to the name of the Message structure.

pRecipient
Pointer to the address of the recipient.

Returns
The function returns one of the following values:

Description
This function deletes recipients from the Message structure pointed to by pMessage.

See Also
AddRecipient, GetFirstRecipient, GetNextRecipient, GetRecipientAddress, NewRecipient

[Top] [Functions]


Structures

The Collabra Server API includes the following structures:

Message
Represents a message.

Recipient
Represents the address of the recipient of a message.

Address
Represents the address of a recipient.


Message

Represents a message.

Syntax
#include <plugin.h>
struct message;
typedef struct Message Message;
Description
This structure stores all attributes that define a single message. This includes all envelope information, such as envelope sender, envelope recipients, sender and per-recipient extensions, and so on, as well as RFC-822 attributes such as pointers to the RFC-822 headers and RFC-822 body.

See Also
FreeMessage, GetBodyFile, GetFirstRecipient, GetHeaderFile, GetNextRecipient, NewMessage, NewRecipient, PostArticle, RemoveRecipient

[Top] [Structures]


Recipient

Represents the address of the recipient of a message.

Syntax
#include <plugin.h>
struct address;
typedef struct address Recipient;
Description
The Recipient structure is a type of Address that represents the address of the recipient of a message. An address can be an RFC821-compliant address or a newsgroup name string, for example: "devgroup@startup.com" or "alt.server.ideateam."

See Also
Address, AddRecipient, GetFirstRecipient, GetNextRecipient, GetRecipientAddress, RemoveRecipient

[Top] [Structures]


Address

Represents the address of a recipient.

Syntax
#include <plugin.h>
struct address;
typedef struct address Address;
Description
This structure represents an address, which can be an RFC821-compliant address or a newsgroup name string, for example: "devgroup@startup.com" or "alt.server.ideateam."

See Also
Recipient, NewRecipient

[Top] [Structures]


[Contents] [Previous] [Next] [Index]

Last Updated: 10/01/97 14:00:56


Copyright © 1997 Netscape Communications Corporation

Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use