IceWarp Server API Classes
==========================


General
-------

The IceWarp Server API is an application programming interface for developers who wish to maintain basic 
tasks with the mail server objects. These tasks can be maintaining domains, accounts, server
settings or even send emails or analyzing licenses. The API brings you the best way to maintain 
your IceWarp server from any programming language such as C++, Visual Studio, Delphi, FreePascal, PHP, ASP, 
Visual Basic or any other.

You can use the RPC (Remote Procedure Call) to access the server remotely, core icewarp_apiobjectcall 
API function or COM object. Both RPC and COM can be used right after the mail server installation has been finished.

For using icewarp_apiobjectcall you need to link IceWarp api.dll into your project 
(if you run PHP scripts under IceWarp HTTP server, it is available automatically).

There are multiple objects you can use to maintain the server. The class names are:

Server API:

IceWarpServer.APIObject
IceWarpServer.DomainObject
IceWarpServer.AccountObject
IceWarpServer.RemoteAccountObject
IceWarpServer.ScheduleObject
IceWarpServer.StatisticsObject
IceWarpServer.TokenObject


Tools API:

IceWarpServer.Mailer
IceWarpServer.IMMessage
IceWarpServer.IDP
IceWarpServer.IceWarpLicense
IceWarpServer.Groupware
IceWarpServer.ChallengeResponse


Comments:

The APIObject is the root of the whole server API. It offers the basic
functions like Backup, Restore, Global settings maintenance and Domain access.

When accessed a domain the DomainObject is returned. This object lets you maintain
your domains, edit, delete, settings, and account access. The object can be created
without even creating the APIObject.

When accessing an account the AccountObject is returned which offers you complete
account managment features, edit, delete, settings, browse all users and much more.
You can also create this object without any prior object creation.


Please note that API interacts with the settings of the server and hence needs access rights to the directories 
used by the server for storing mails, logs, settings... This is specially needed when API is called 
from services that are not running as administrator (e.g. IIS server).


Also you might want to take a look at sources and examples in the API folders.

./c - Example for calling API from C
./php - PHP COM examples
./delphi - Delphi sources, command line tool


See ./delphi/apiconst.pas file for variables and constants used in GetProperty/SetProperty methods.
It contains all constants required to use the API functions. Study the constant names carefully. 
They also contain comments that might be useful for you.


IceWarpServer.APIObject
-----------------------

  IAPIObjectDisp = dispinterface
    ['{BFD83E1B-6F4A-4E06-B0DE-0427C73753C0}']
    procedure Done; dispid 201;
    function Init(const Path: WideString): WordBool; dispid 202;
    procedure UpdateConfiguration; dispid 203;
    procedure ReloadServices; dispid 204;
    function BackupConfig(const Path: WideString): WordBool; dispid 205;
    function RestoreConfig(const Path: WideString; const Password: WideString): WordBool; dispid 206;
    function SpamIndexNow(const Email: WideString): WordBool; dispid 207;
    function GetDomainCount: Integer; dispid 208;
    function Save: WordBool; dispid 209;
    function DeleteDomain(const Domain: WideString): WordBool; dispid 210;
    function RenameDomain(const OldDomain: WideString; const NewDomain: WideString): WordBool; dispid 211;
    function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; dispid 212;
    property LastErr: Integer readonly dispid 217;
    function GetDomainList: WideString; dispid 213;
    function GetDomain(Index: Integer): WideString; dispid 214;
    function OpenDomain(const Domain: WideString): OleVariant; dispid 215;
    function NewDomain(const Domain: WideString): OleVariant; dispid 216;
    function GetProperty(Command: OleVariant): OleVariant; dispid 218;
    function GetDomainIndex(const Domain: WideString): Integer; dispid 219;
    function GetSchedule(Command: OleVariant): OleVariant; dispid 220;
    function SetSchedule(Command: OleVariant; Schedule: OleVariant): WordBool; dispid 221;
    function GetUserStatistics(const From: WideString; const To_: WideString; 
                               const Filter: WideString): WideString; dispid 222;
    function GetUserStatisticsDays(const From: WideString; const To_: WideString; 
                                   const Filter: WideString): WideString; dispid 223;
    function CreateTables(Service: Integer; const Connection: WideString): WordBool; dispid 224;
    function DropTables(Service: Integer): WordBool; dispid 225;
    function ChallengeResponseList(const Recipient: WideString; const Flags: WideString): WideString; dispid 226;
    function ChallengeResponseAdd(const Recipient: WideString; const Email: WideString; 
                                  const State: WideString): WordBool; dispid 227;
    function ChallengeResponseDelete(const Recipient: WideString; const Email: WideString; 
                                     const Folder: WideString): WordBool; dispid 228;
    function ChallengeResponseAuthorize(const Folder: WideString): WordBool; dispid 229;
    function ChallengeResponsePath(const Folder: WideString): WideString; dispid 230;
    procedure AntiVirusUpdate; dispid 231;
    procedure AntiSpamUpdate; dispid 232;
    procedure SpamCompactDB; dispid 233;
    procedure ConnectNow; dispid 234;
    procedure RemoteServerWatchdogNow; dispid 235;
    procedure TaskEventNow(Index: Integer); dispid 236;
    procedure RemoteAccountNow(Index: Integer); dispid 237;
    procedure FTPSyncNow(Item: Integer); dispid 238;
    procedure ETRNNow(Index: Integer); dispid 239;
    function CheckDBConnection(const Connection: WideString): WordBool; dispid 240;
    function CheckDNSServer(const DNS: WideString): WordBool; dispid 241;
    function Migration_MigrateMessages(Single: WordBool; const User: WideString; 
                                       const Pass: WideString; const Domain: WideString; 
                                       const BulkBuffer: WideString): WordBool; dispid 242;
    function Migration_MigrateMessagesAccounts(Single: WordBool; const User: WideString; 
                                               const Pass: WideString; const BulkBuffer: WideString): WordBool; dispid 243;
    function Migration_Finish: Integer; dispid 244;
    function ProcessUpgradeTasks(const PreviousVersion: WideString): WordBool; dispid 245;
    function IDNToUTF8(const IDN: WideString): WideString; dispid 246;
    function UTF8ToIDN(const UTF8: WideString): WideString; dispid 247;
    function GetLocalIPs: WideString; dispid 248;
    property TokenHandle: Integer dispid 249;
    function LocateString(const String_: WideString): WideString; dispid 250;
    function QuarantineAuthorize(const Folder: WideString): WordBool; dispid 251;
    function QuarantineDelete(const Owner: WideString; const Sender: WideString; 
                              const Folder: WideString): WordBool; dispid 252;
    function QuarantineList(const Owner: WideString; const Flags: WideString; Count: Integer; Offset: Integer): WideString; dispid 253;
    function SIPReferCall(const Owner: WideString; const Number: WideString; const Address: WideString): WordBool; dispid 226;
    function GLList(const Email: WideString; const Flags: WideString; Count: Integer; Offset: Integer): WideString; dispid 227;
    function QuarantineAdd(const Recipient: WideString; const Email: WideString; const State: WideString): WordBool; dispid 228;
    function QuarantineSet(const Recipient: WideString; const Email: WideString; const State: WideString): WordBool; dispid 229;
    function GLSet(const Value: WideString; const Email: WideString; const Status: WideString): WordBool; dispid 230;
    function GLAdd(const Value: WideString; const Email: WideString; const Status: WideString): WordBool; dispid 254;
    function GLDelete(const Value: WideString; const Email: WideString; const Status: WideString): WordBool; dispid 255;
    function GetFolderList(const Folder: WideString; Rec: WordBool): WideString; dispid 256;
    function DeleteFiles(const Folder: WideString; const Files: WideString; Rec: WordBool; Older: Integer): WordBool; dispid 257;
    procedure PostServiceMessage(Service: Integer; Msg: Integer; WParam: Integer; LParam: Integer); dispid 258;
    function MakePrimaryDomain(const Domain: WideString): WordBool; dispid 259;
    function MigrateDatabase(const SourceDSN: WideString; const DestDSN: WideString; const LogFile: WideString; DBIndex: Integer): WordBool; safecall; dispid 260;
    function ConvertStorage(ToDB: WordBool): WordBool; dispid 261;
    function GetFileList(const Folder: WideString; Rec: WordBool): WideString; dispid 262;
    function GetMessageContent(const FileName: WideString; const Type_: WideString; MaxSize: Integer; MaxLines: Integer): WideString; dispid 263;
    function Base64FileEncode(const Source: WideString; const Dest: WideString): WordBool; dispid 264;
    function SMSHTTP(const HTTP: WideString; BypassAuth: WordBool): WordBool; dispid 265;
    function SyncPush(const Param1: WideString; const Param2: WideString; const Param3: WideString; const Param4: WideString): WideString; dispid 266;
    function CryptData(const Alg: WideString; const Key: WideString; const Data: WideString; Encode: WordBool): WideString; dispid 267;
    function GetProperties(const Mask: WideString): WideString; dispid 268;
    function SmartAttach(const FileName: WideString; const Account: WideString; Expiration: Integer; Anonymous: WordBool; const Params: WideString): WordBool; dispid 269;
    function DoLog(ThreadId: Integer; LogType: Integer; const Who: WideString; const Value: WideString; const OtherParams: WideString): WordBool; dispid 270;
    function MoveFileWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; dispid 271;
    function CopyFileWithUpdate(const FileName: WideString; const DestName: WideString; fFailIfExists: WordBool): WordBool; dispid 272;
    function DeleteFileWithUpdate(const FileName: WideString): WordBool; dispid 273;
    function CacheFileWithUpdate(const FileName: WideString): WordBool; dispid 274;
    function MoveDirWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; dispid 275;
    function CopyDirRecWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; dispid 276;
    function DeleteDirRecWithUpdate(const FileName: WideString): WordBool; dispid 277;
    function CacheDirWithUpdate(const FileName: WideString): WordBool; dispid 278;
    function SOCKSCall(const Command: WideString; const Hash: WideString; const Param1: WideString; const Param2: WideString): WideString; dispid 279;
    function GetLogRecords(LogType: Integer; UnixDate: Integer; const Filter: WideString; FDelete: WordBool): WideString; dispid 280;
    function ManageConfig(const Selector: WideString; const MethodName: WideString; const Params: WideString): WideString; dispid 281;
    function SMSIncoming(const URI: WideString): WordBool; dispid 282;
    function AVScanFile(const FileName: WideString; Ext: WordBool; Timeout: Integer): WideString; dispid 283;
    function GetDeliveryReport(const Email: WideString; const MsgID: WideString; UnixTime: Integer): WideString; dispid 284;
    function RenameDefaultFolders(const URI: WideString): WordBool; dispid 285;
    function SetACL(const Mailbox: WideString; const Auth: WideString; const ACLOwnerEmail: WideString; const ACLFile: WideString; const Rights: WideString): WordBool; dispid 286;

  end;


function Init(const Path: WideString): WordBool

The Init function is automatically called by any object created. You should not call the function. 
The path can be empty and in such case the COM object locates the mail server configuration files 
automatically or it can be the full path to the mail server directory. It loads all the settings and 
information the COM object might need.


procedure Done

The Done function closes the COM object and frees the allocated data. It also saves the changed settings if any.
The function is called automatically when the COM object is freed.


procedure UpdateConfiguration

Notifies all of the running services of any new changes to the settings. This is required for global settings changed.
In such case the services need to be notified to reload their configuration files.


procedure ReloadServices

The ReloadServices stops and restarts all mail server services.


function BackupConfig(const Path: WideString): WordBool 
function RestoreConfig(const Path: WideString; const Password: WideString): WordBool

The Backup and Restore functions are identical to the the mail server administration interface backup and restore features.
They let you backup and restore the mail server settings. The Path parameter specifies the complete file name of the
destination backup file.


function SpamIndexNow(const Email: WideString): WordBool

This function takes care of indexing the spam and genuine messages. The Email is the account email address to be indexed.
If empty the global spam and genuine messages will be indexed.


function Save: WordBool
function SetProperty(Command: OleVariant; Value: OleVariant): WordBool
function GetProperty(Command: OleVariant): OleVariant

These three functions make it all easy. You can set or read any global setting value. The command specifies the variable ID
and the value the variable content. When set all properties you shave call the Save function.

Example:

$com->GetProperty("c_name");
$com->SetProperty("c_name", "mail.domain.com");
$com->Save();


function GetDomainCount: LongWord

Returns the number of all domains on the mail server.


function GetDomainList: WideString

Returns the whole list of domains separated with semicolon.


function DeleteDomain(const Domain: WideString): WordBool

Deletes an existing domain with all its accounts.


function RenameDomain(const OldDomain: WideString; const NewDomain: WideString): WordBool

Renames an old domain to the new domain name.


function GetDomain(Index: LongWord): WideString

Returns the name of the domain specified by the Index position from the domain list.


function OpenDomain(const Domain: WideString): OleVariant
function NewDomain(const Domain: WideString): OleVariant

Both of these functions return an instance to the IceWarpAPI.DomainObject. The Domain parameter
specifies the name of the domain to be opened or created. Once the instance returned
use the DomainObject functions and properties. 

Use the OpenDomain function to edit an existing domain. You can change the properties or accounts of the domain.
The NewDomain lets you add a new domain.

Example:

$domain = $com->NewDomain("test.com");


function GetDomainIndex(const Domain: WideString): Integer

Returns the position of the domain in the list. If not found a negative number will be returned.


property LastErr: Integer

The LastErr property specifies the numeric value of the last function result. See the result description in the Introduction.


function GetSchedule(Command: OleVariant): OleVariant;

Returns the schedule object for the specified variable.


function SetSchedule(Command: OleVariant; Schedule: OleVariant): WordBool;

Sets the schedule data from the schedule object for the given variable.


function GetUserStatistics(const From: WideString; const To_: WideString; const Filter: WideString): WideString; 
function GetUserStatisticsDays(const From: WideString; const To_: WideString; const Filter: WideString): WideString; 

Retrieves the user statistics. From and To are date indicators, filter can contain email patterns.


function DoLog(ThreadId: Integer; LogType: Integer; const Who: WideString; const Value: WideString; const OtherParams: WideString): WordBool; safecall;

Call Server built-in logging function with given params
e.g.:
Who          [ThreadId] 08:25:59 What


ThreadId: logged thread number

LogType: which log should be written to 

0  - SMTP 
1  - POP3
2  - IMAP
3  - Control
4  - AV
5  - IM
6  - IMArchive
7  - Calendar
8  - FTP
9  - AS
10 - SIP
11 - Maintenance
12 - Error
13 - SpamReport
14 - Webmail
15 - SyncML
16 - IMPresence
17 - CalDAV
18 - None
19 - Other
20 - MailQueue
21 - SMS
22 - LDAP
23 - PHPError
24 - SyncPush
25 - ActiveSync
26 - LogAnalyzer
27 - SIPCalls
28 - API
29 - DNS
30 - Purple
31 - Minger
32 - Performance
33 - SQL
34 - ADSync

Who,Value 
Forms main part of the log line

OtherParams - Additional parameters joined to one string
OtherParams =  Type "|" Flags

FType - Integer- type of logging required   (Default = 1)

0 - ltNo
1 - ltDebug
2 - ltSummary
3 - ltDebugSummary


Flags - Integer - bitwise constucted flags
Log_F_Whole = 0x01
Log_F_Flush = 0x02

function GetLogRecords(LogType: Integer; UnixDate: Integer; const Filter: WideString; FDelete: WordBool): WideString; 

Retrieves the logs from given service with given filter applied

LogType: which log should be retrieved - for list of possible parameters see the description of the DoLog function

UnixDate: Unix datestamp of the day we want the logs from (number of seconds from 1.1.1970)

Filter: filter condition in the form: timecond;othercond
  
  timecond: starth:startm-endh:endm   (e.g.  10:15-17:5)
  
  othercond: ip;thread;starttime      (e.g. 147.32.96.40;[0FC2];13:25:37)  each element is mandatory, (e.g.: ;[0FC];)

FDelete: If set to true, nothing is retrieved and the logs from specified date are deleted


function ManageConfig(const Selector: WideString; const MethodName: WideString; const Params: WideString): WideString;

This function can get/set/call several server settings/methods

Selector - Area of the config we are working with
	   Supported values: ('system/certificates/server certificates')

MethodName - Name of the method to call
             Supported values: ('list','add','edit','del')

Params - string composed using url notification containing parameters
	Supported values: depends on MethodName 

Return value : '0','1', or several lines - each line contains string composed using url notification with listed items


Selector = 'system/certificates/server certificates'

  - 'list' - 
	Params: empty
	Return value parts:  id,ip,cert,cn,issuer,expiration,subject,bits,fingerprint

  - 'add' -
       Params: ip,cert
       return value: '0' or '1'

 - 'edit' -
       Params: id,ip,cert
       return value: '0' or '1'

 - 'del' -
       Params: id
       return value: '0' or '1'


Selector = 'system/certificates/ca certificates'

  - 'list' - 
	Params: empty
	Return value parts:  id,orgunit,org,subject,expiration,country


  - 'add' -
       Params: cert
       return value: '0' or '1'


 - 'del' -
       Params: id
       return value: '0' or '1'

Selector = 'management/domain/dkim'

  - 'getselector'- 
        Params: pkey
	Return value :  '0' or resulting selector


function AVScanFile(const FileName: WideString; Ext: WordBool; Timeout: Integer): WideString; 

FileName - full path to file to scan

Ext - enables extended result

Timeout - number of miliseconds

Return value:
If Ext is set to false - returns empty string or virus name
If Ext is set to true  - returns CODE:POOLTIME:VirusName

CODE :
  AV_R_CLEAN = 0;
  AV_R_INFECTED    = AV_R_CLEAN + 1;
  AV_R_DISINFECTED = AV_R_INFECTED +1;
  AV_R_SUSPICIOUS  = AV_R_DISINFECTED +1;
  AV_R_NONSCANNED  = AV_R_SUSPICIOUS +1;
  AV_R_CORRUPTED   = AV_R_NONSCANNED +1;
  AV_R_ACCESSDENIED= AV_R_CORRUPTED +1;
  AV_R_CANCELED    = AV_R_ACCESSDENIED +1;
  AV_R_FAILURE     = AV_R_CANCELED +1;
  AV_R_SKIPPED     = AV_R_FAILURE +1;
  AV_R_PASSWORD_PROTECTED = AV_R_SKIPPED +1;
  
  AVR_R_POOL_TIMEOUT = 99

VirusName -  can be empty


function RenameDefaultFolders(const URI: WideString): WordBool;

Renames default folders, accepts URL-encoded, UTF-8 list of form:

 where=value1&events=value2&contacts=value3&tasks=value4&notes=value5&journals=value6&files=value7&drafts=value8&trash=value9&sent=value10

* can be used for where option as a wildcard for all domains

e.g.

RenameDefaultFolders('where=*&sent=Odeslan');  renames default sent folders for all users

RenameDefaultFolders('where=%5bdomain.com%5d&events=Evento&notes=Noty');  renames default events and notes folders for for all users from domain.com


function SetACL(const Mailbox: WideString; const Auth: WideString; const ACLOwnerEmail: WideString; const ACLFile: WideString; const Rights: WideString): WordBool;

Sets item in given acl file
Mailbox - IMAPUTF7 encoded relative path to the mailbox,  e.g: INBOX  
Auth - primary email of the person for which we wan to set acl
ACLOwnerEmail - primary email of acount whuch owns this folder
ACLFile - full path to the acl file, e.g. c:\merak\mail\testdom.cz\karl\acl.dat
Rights - IMAP rights string.  e.g. lrips  (see IMAP rfc  for explanation of particular letters)

function MoveFileWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; 
function CopyFileWithUpdate(const FileName: WideString; const DestName: WideString; fFailIfExists: WordBool): WordBool;
function DeleteFileWithUpdate(const FileName: WideString): WordBool; 

function MoveDirWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; 
function CopyDirRecWithUpdate(const FileName: WideString; const DestName: WideString): WordBool; 
function DeleteDirRecWithUpdate(const FileName: WideString): WordBool;

Classical filesystem operations with "on the fly" updating of cache of directory sizes (size.dat)

function CacheFileWithUpdate(const FileName: WideString): WordBool;
function CacheDirWithUpdate(const FileName: WideString): WordBool; 

If new file or directory is created, this functions should be called to update the chache


function CreateTables(Service: Integer; const Connection: WideString): WordBool; 
function DropTables(Service: Integer): WordBool; 
function CheckDBConnection(const Connection: WideString): WordBool; 

Creates and destroys tables of specific services. Connection is the new connecting string

Service values:
0 - Storage
1 - Logs
2 - GroupWare
3 - Challenge Response


function ChallengeResponseList(const Recipient: WideString; const Flags: WideString): WideString; 
function ChallengeResponseAdd(const Recipient: WideString; const Email: WideString; const State: WideString): WordBool; 
function ChallengeResponseDelete(const Recipient: WideString; const Email: WideString; const Folder: WideString): WordBool; 
function ChallengeResponseAuthorize(const Folder: WideString): WordBool; 
function ChallengeResponsePath(const Folder: WideString): WideString; 

Challenge response management functions.




IceWarpServer.DomainObject
--------------------------

  IDomainObjectDisp = dispinterface
    ['{92E93C97-041B-47CB-A565-387C44BCB9A7}']
    property LastErr: Integer readonly dispid 201;
    property Name: WideString dispid 202;
    property IPAddress: WideString dispid 203;
    function Open(const Domain: WideString): WordBool; dispid 204;
    function Save: WordBool; dispid 205;
    function New(const Domain: WideString): WordBool; dispid 206;
    function GetAccountCount: Integer; dispid 207;
    function GetTotalAccounts(Type: Integer): LongWord

    function GetAccountList: WideString; dispid 208;
    function GetAccount(Index: Integer): WideString; dispid 209;
    function DeleteAccount(const Email: WideString): WordBool; dispid 210;
    function DeleteAccountID(ID: Integer): WordBool; dispid 219;
    function Delete: WordBool; dispid 211;
    function GetProperty(Command: OleVariant): OleVariant; dispid 212;
    function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; dispid 213;
    function OpenAccount(const Email: WideString): OleVariant; dispid 214;
    function NewAccount(const Email: WideString): OleVariant; dispid 215;
    function GetAccountIndexByAlias(const Email: WideString): Integer; dispid 216;
    property TokenHandle: Integer dispid 218;
    function ApplyTemplate(const Name: WideString): WordBool; dispid 217;
    function DeleteAccountID(ID: Integer): WordBool; dispid 219;
    function GetProperties(const Mask: WideString): WideString; dispid 220;
  end;


property Name: WideString

The Name property lets you read or set the Name of the domain you want to create or save. Usually you do not need to set 
this at all. Use the Open and New functions instead.


function Open(const Domain: WideString): WordBool
function New(const Domain: WideString): WordBool

The Open new New functions let you open an existing domain or create a new domain. It loads the settings and initializes
the variables. When accessed the domain from APIObject you do not need to use these functions. Use them only if creating
a new object.


function Delete: WordBool

When editing an existing domain you can delete it by calling this function. The domain must be properly loaded.


function GetProperty(Command: OleVariant): OleVariant
function SetProperty(Command: OleVariant; Value: OleVariant): WordBool
property IPAddress: WideString 
function Save: WordBool

You can edit or read the properties of the domain using these functions. The IPAddress property lets you specify 
all virtual IP addresses of the domain. The Save function is required to be called when finished editing. 
When creating a new domain you also need to call the Save function once finished setting the properties.
You can then call the Save function again and the domain will be only updated and not added again. 

Example:

$domain->SetProperty("d_postmaster", "postmaster;webmaster;admin");
$domain->SetProperty("d_description", "Demo Domain");
$domain->IPAddress = "192.168.0.1;192.168.0.2";
$domain->Save();


function GetAccountCount: LongWord

Returns the number of all accounts in the domain.

function GetTotalAccounts(Type: Integer): LongWord

Returns the number of accounts of specific type in the domain


function GetAccountList: WideString

Returns the whole domain list of all account aliases separated with semicolon.


function DeleteAccount(const Email: WideString): WordBool
function DeleteAccountID(ID: Integer): WordBool

Deletes an existing account. The Email parameter can be either a complete email address or just an alias.


function GetAccount(Index: LongWord): WideString

Return the account's alias specified by the Index in the account list.


function OpenAccount(const Email: WideString): OleVariant
function NewAccount(const Email: WideString): OleVariant

Both of these functions return an instance to the IceWarpAPI.AccountObject. The Email parameter
can be either an alias or a complete domain name. Once the instance returned use the AccountObject
functions and properties. 

Use the OpenAccount function to edit an existing account. The NewAccount lets you add a new account.

Example:

$account = $domain->NewAccount("test");


function GetAccountIndexByAlias(const Email: WideString): Integer

Tries to find the alias in the domain. If found the index will be returned. If not a negative number will be returned.
The Email parameter can contain only the alias and in that case the domain name of the object will be used or it can 
contain the full email address.


property LastErr: Integer

The LastErr property specifies the numeric value of the last function result. See the result description in the Introduction.



IceWarpServer.AccountObject
---------------------------

  IAccountObjectDisp = dispinterface
    ['{F0816647-788E-4520-8685-BCDDAEBECCEF}']
    property LastErr: Integer readonly dispid 201;
    property Domain: WideString readonly dispid 202;
    function New(const Email: WideString): WordBool; dispid 203;
    function Open(const Email: WideString): WordBool; dispid 204;
    function Save: WordBool; dispid 205;
    function Delete: WordBool; dispid 206;
    function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; dispid 207;
    function GetProperty(Command: OleVariant): OleVariant; dispid 208;
    function AuthenticateUser(const Username: WideString; const Password: WideString; 
                              const IP: WideString): WordBool; dispid 211;
    function FindInit(const Domain: WideString): WordBool; dispid 212;
    function FindNext: WordBool; dispid 213;
    procedure FindDone; dispid 214;
    function CanCreateMailbox(const Alias: WideString; const Mailbox: WideString; 
                              const Password: WideString; const Domain: WideString): WordBool; dispid 209;
    function FindInitQuery(const Domain: WideString; const Query: WideString): WordBool; dispid 216;
    property EmailAddress: WideString readonly dispid 217;
    function AuthenticateUserHash(const Username: WideString; const Hash: WideString; 
                                  const IP: WideString; const Method: WideString; 
                                  Flags: Unsigned Integer): WordBool; safecall; dispid 218;
    function AuthenticateUserSSO(const Token: WideString; const VHost: WideString; const Protocol: WideString): WideString; safecall;

    function ValidateUser(Service: Integer): WordBool; dispid 219;
    function GetUserGroups(const User: WideString): WideString; dispid 215;
    property TokenHandle: Integer dispid 220;
    function ApplyTemplate(const Name: WideString): WordBool; dispid 210;
    function ValidateData(const Type_: WideString): WordBool; dispid 221;
    function GetProperties(const Mask: WideString): WideString; dispid 222;
  end;


property Domain: WideString readonly

The Domain property returns the name of the domain the account resides in.


property EmailAddress: WideString readonly

The email address of the current user.


function New(const Email: WideString): WordBool
function Open(const Email: WideString): WordBool

The Open new New functions let you open an existing account or create a new one. It loads the settings and initializes
the variables. When accessed the account from APIDomain you do not need to use these functions. Use them only if creating
a new object.


function Delete: WordBool

You can delete an existing account you are editing by calling the Delete function.


function SetProperty(Command: OleVariant; Value: OleVariant): WordBool
function GetProperty(Command: OleVariant): OleVariant
function Save: WordBool

The same logics is applied as to other Property functions. When finished editing call the Save function. When adding a new user 
you are required to call the Save function which will add and save the user. You can then call the Save function 
again and the user will be only updated and not added again. 

Example: 

$account->SetProperty("u_name", "My Name");
$account->SetProperty("u_password", "pass01");
$account->Save();


function AuthenticateUser(const Username: WideString; const Password: WideString; const IP: WideString): WordBool
function AuthenticateUserHash(const Username: WideString; const Hash: WideString; const IP: WideString; const Method: WideString; Flags: Unsigned Integer): WordBool; safecall;
function ValidateUser(Service: Integer): WordBool; 

The AuthenticateUser function lets you check and load the user specified by the Username, Password and IP address.
If successful the user is loaded and you can edit it. The IP address is not required. Methods supported can be:
CRAM-MD5
DIGEST-MD5
SHA1
MD5

The flags parameter is interpreted as a bit mask. Bit 0: EmailLogin,  Bit 1: Support migration  (if login is not successfull and migration is running, migration session is initiated).


The ValidateUser function checks whether the successfully authenticated user can access his mailbox. Basically the validation
function makes sure the user is not expired, has the right to login and other user restrictions. 

The possible Service values are: 
0  - SMTP
1  - POP3
2  - IMAP
3  - IM
4  - WebMail
5  - GW
6  - Control
7  - FTP
8  - SIP
9  - Other
10 - SyncML
11 - AV
12 - ActiveSync
13 - WebDAV
14 - SMS

function AuthenticateUserSSO(const Token: WideString; const VHost: WideString; const Protocol: WideString): WideString;

Similar as AuthenticateUserHash, but authentication is performed against SSO security token.

Token - base64 encoded security token
VHost - virtual host used for access, if empty, all domains are searched
Protocol - protocol value ("HTTP", "IMAP" ... etc)

Result:  otoken&pass
otoken - base64 encoded output token
pass - base64 encoded password of this user - this password can be used to future auth again IW services

function FindInit(const Domain: WideString): WordBool
function FindNext: WordBool
procedure FindDone
function FindInitQuery(const Domain: WideString; const Query: WideString): WordBool; 

These functions let you loop thru all accounts in the domain. It is not recommended to use the GetDomainCount and loop thru
each account based on the Index. That would be too slow. Use these functions instead. You can even loop thru all users on the mail
server. In such case the Domain must be empty. All accounts of the server will be returned then.

The FindInit function initializes the buffer and opens the database. If returned False there are no accounts and you must not call
the other functions. If returned True call then the FindNext function in a loop until False returned. For each
successful call you can use the object properties to query and update the account. Call the FindDone when finished to free
the resources.

Example:

if ($account->FindInit("test.com"))
{
  While ($account->FindNext()) {
  
    echo $account-GetProperty("u_alias");
  
  }
  $account->FindDone();
}

FintInitQuery function does the same job as the FindInit function except it accepts a Query parameter which lets you to loop
thru accounts meeting the criteria. The query uses SQL syntax and is supported for file system accounts too. Numeric parameters should be treated like
strings. Always use grouping brackets. The LIKE operator is also supported in the file system accounts mode.

Example:

$account->FindInitQuery("test.com", "(u_alias like '%john%') or (u_admin = '1')");


function CanCreateMailbox(const Alias: WideString; const Mailbox: WideString; const Password: WideString; const Domain: WideString): WordBool

Returns True if an account with the given details can be created. You can call Save() instead to see if a false result will be returned
but this function makes sure you know the state before.


function MailboxConvertMessages(const MailboxPath: WideString; FromIMAP: WordBool): WordBool; 

Converts all messages in the mailbox path of the account IMAP to POP3 and POP3 to IMAP.


property LastErr: Integer 

The LastErr property specifies the numeric value of the last function result. See the result description in the Introduction.



  IRemoteAccountObjectDisp = dispinterface
    ['{7C845AFF-8FB4-4C67-AC29-7B47D11B6001}']
    property LastErr: Integer readonly dispid 201;
    function New: WordBool; dispid 203;
    function Open(Index: Integer): WordBool; dispid 204;
    function Save: WordBool; dispid 205;
    function Delete: WordBool; dispid 206;
    function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; dispid 207;
    function GetProperty(Command: OleVariant): OleVariant; dispid 208;
    function DeleteIndex(Index: Integer): WordBool; dispid 209;
    function Count: Integer; dispid 210;
    function GetSchedule(Command: OleVariant): OleVariant; dispid 211;
    function SetSchedule(Command: OleVariant; Schedule: OleVariant): WordBool; dispid 212;
    property TokenHandle: Integer dispid 213;
    function ApplyTemplate(const Name: WideString): WordBool; dispid 202;
    function GetProperties(const Mask: WideString): WideString; dispid 214;
  end;


property LastErr: Integer 

The LastErr property specifies the numeric value of the last function result. See the result description in the Introduction.


function Count: Integer;

Returns the total number of all system remote accounts on the server.


function New: WordBool;

Resets all settings and inner variables to create a new remote account.


function Open(Index: Integer): WordBool;

Lets you load an existing remote account. You can then perform any actions on the loaded remote account.


function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; 
function GetProperty(Command: OleVariant): OleVariant; 
function Save: WordBool;

When finished editing call the Save function. When adding a new remmote account you are required to call the Save 
function which will add and save the accountr. You can then call the Save function again and the account will be only 
updated and not added again.


function Delete: WordBool;
function DeleteIndex(Index: Integer): WordBool;

The Delete function lets you delete the currently open remote account. The DeleteIndex lets you delete an account without
even opening it knowing the Index of the account.


function GetSchedule(Command: OleVariant): OleVariant;

Returns the schedule object for the specified variable.


function SetSchedule(Command: OleVariant; Schedule: OleVariant): WordBool;

Sets the schedule data from the schedule object for the given variable.


Example:

$ra->SetProperty("ra_name", "Remote Name");
$ra->SetProperty("ra_domainstring", "domain.com");
$ra->SetProperty("ra_pop3server", "server.isphost.com");
$ra->SetProperty("ra_username", "userlogin");
$ra->SetProperty("ra_password", "password");
$ra->SetProperty("ra_forwardto", "john@domain.com");
$ra->Save();



IceWarpServer.ScheduleObject
----------------------------

  IScheduleObjectDisp = dispinterface
    ['{3411CE71-91A5-42D1-93F3-A0A38EF541D0}']
    property LastErr: Integer readonly dispid 201;
    function Add: WordBool; dispid 203;
    function Delete(Index: Integer): WordBool; dispid 204;
    function Select(Index: Integer): WordBool; dispid 205;
    function GetProperty(Command: OleVariant): OleVariant; dispid 207;
    function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; dispid 208;
    property Count: Integer dispid 206;
    property TokenHandle: Integer dispid 209;
    property Data: Integer readonly dispid 202;
    function GetProperties(const Mask: WideString): WideString; dispid 209;
  end;


The schedule object makes it possible to edit and read any schedule structure of different mail server settings.


property LastErr: Integer 

The LastErr property specifies the numeric value of the last function result. See the result description in the Introduction.


property Count: Integer

Lets you change and read the total number of all schedule items


function Add: WordBool;

Adds a new schedule item to the structure and sets the active position to it.


function Delete(Index: Integer): WordBool;

Deletes a schedule item from the structure.


function Select(Index: Integer): WordBool;

Selets a schedule item so all property changes and reads will be done to that schedule item.


function SetProperty(Command: OleVariant; Value: OleVariant): WordBool; 
function GetProperty(Command: OleVariant): OleVariant; 

Functions to manipulate the properties of the whole schedule structure.


Example:

$ra->Open(0); // Opens the first remote account
$schedule = $ra->GetSchedule('ra_schedule'); // Retrieve the schedule for the object

$schedule->Count = 1; // Sets 1 schedule item

$schedule->SetProperty("s_weekdays_su", true);
$schedule->SetProperty("s_weekdays_mo", true);
$schedule->SetProperty("s_weekdays_tu", true);
$schedule->SetProperty("s_weekdays_we", true);
$schedule->SetProperty("s_weekdays_th", true);
$schedule->SetProperty("s_weekdays_fr", true);
$schedule->SetProperty("s_weekdays_sa", true);
$schedule->SetProperty("s_scheduletype", 0); // Every x minutes type
$schedule->SetProperty("s_every", 1200); // Sets 20 minutes
$schedule->SetProperty("s_wholeday", true); // Do not use day interval but rather the whole day

$ra->SetSchedule('ra_schedule', $schedule); // Sets the changed schedule structure back to the remote account
$ra->Save(); // Save the changed remote account



IceWarpServer.StatisticsObject
------------------------------

  IStatisticsObjectDisp = dispinterface
    ['{A17B4801-6473-475E-89C9-20E246D1B4A6}']
    function IsRunning(const Service: WideString): WordBool; dispid 201;
    function Reset(const Service: WideString): WordBool; dispid 202;
    function Poll(const Service: WideString): WordBool; dispid 203;
    function GetProperty(Command: OleVariant): OleVariant; dispid 204;
    function Start(const Service: WideString): WordBool; dispid 205;
    function Stop(const Service: WideString): WordBool; dispid 206;
    function GetSessions(const Service: WideString; History: WordBool): WideString; dispid 207;
    property TokenHandle: Integer dispid 208;
    function GetProperties(const Mask: WideString): WideString; dispid 209;
  end;

The statistics object lets you poll different services of the mail server and read the statistics such as
running time, server connections, data sent received and much more.

Service variable can contain these values:
SMTP
POP3
IMAP
IM
GW
FTP
Control
SIP
LDAP


function IsRunning(const Service: WideString): WordBool; dispid 201;

Returns True if the service is running.


function Reset(const Service: WideString): WordBool; dispid 202;

Resets the counters for the specified service. Only the datetime will be preserved.


function Poll(const Service: WideString): WordBool; dispid 203;

Reads the statistics from the service. Call this function once a time and then use the GetProperty
method to retrieve the counters.


function GetProperty(Command: OleVariant): OleVariant; dispid 204;

Once used the Poll method use this method to retrieve the particular counters. All variables/commands
can be found in the APIConst.pas file.


function Start(Service: OleVariant): WordBool; 
function Stop(Service: OleVariant): WordBool; 

Starts and stops services.


Example:

$stat = new COM("IceWarpServer.StatisticsObject");
$stat->Poll("SMTP");

echo $stat->GetProperty("st_serverconns"); // Total number of server connections
echo $stat->GetProperty("st_server"); // Number of concurrent connections to the server
echo $stat->GetProperty("st_smtp_messagesout"); // Number of sent messages


IceWarpServer.TokenObject
-------------------------

  ITokenObjectDisp = dispinterface
    ['{4BF40970-D018-430C-A7B4-6D141F14102F}']
    property URL: WideString dispid 201;
    property TokenHandle: Integer readonly dispid 202;
    property Counter: Integer readonly dispid 203;
  end;

The token object lets you run API using RPC (Remote Procedure Calls) and connect to any
remote server over the internet and use the API.

Before using any other class create the token object and set the URL to format:

administrator ":" password "@" server

Then retrieve the TokenHandle.

Each class of the API has also the TokenHandle. Set the retrieved TokenHandle to any API class so it will use
the RPC. It is easy as that.


Example:

$token = new COM("IceWarpServer.TokenObject");
$token->URL = "admin:password@remote.server.com";

$api = new new COM("IceWarpServer.APIObject");
$api->TokenHandle = $token->TokenHandle;

$api->GetProperty("c_version");


The example above connects to remote.server.com and retrieves the c_version API variable.


RPC
---

If you are a developer and do not wish to use the COM you can use the RPC calls directly without any
libraries from IceWarp. All you need to know is the RPC usage. Read about RPC at http://www.xmlrpc.com/
The API resides at http://server[:32000]/rpc/ and that is the URL you need to direct the RPC calls to.

There is a special way how to handle API classes over the RPC. See example below:


// The request below creates a new instance of the APIObject on the remote server
// The output will be the instance id of the handle you need to use for subsequent class calls

<?xml version="1.0"?>
<methodCall>
   <methodName>0->Create</methodName>
   <params>
      <param>
         <value>IceWarpServer.APIObject</value>
         </param>
      </params>
   </methodCall>


// The call below assumes we already have the class instance which is 123456 from the server and thus
// need to specify it. We call the GetProperty method of the API class and request the c_version property.

<?xml version="1.0"?>
<methodCall>
   <methodName>123456->GetProperty</methodName>
   <params>
      <param>
         <value>c_version</value>
         </param>
      </params>
   </methodCall>



Examples
--------

You can find some simple example scripts in the ./php directory. They demonstrate the basic functionality
of the COM object. Adapting it to any other programming language is very easy. 

Other examples can be found in this documentation below.

Creating a new domain:

if ($com = new COM("IceWarpServer.APIObject"))
{
  $domain = $com->NewDomain("test.com");
  $domain->SetProperty("d_description", "Description");
  $domain->SetProperty("d_adminemail", "postmaster@test.com");
  $domain->Save();
}

Creating a new user:

if ($account = new COM("IceWarpServer.AccountObject"))
{
  $account->New("postmaster@test.com");
  $account->SetProperty("u_name", "Test Account");
  $account->SetProperty("u_password", "Pass1");
  $account->SetProperty("u_mailbox", "postmaster");
  $account->Save();
}

Deleting a user:

if ($account = new COM("IceWarpServer.AccountObject"))
{
  $account->Open("postmaster@test.com");
  $account->Delete();
}

Creating a new user trough icewarp_apiobjectcall:

if ($account = icewarp_apiobjectcall(0, "", "IceWarpServer.AccountObject");
{
  icewarp_apiobjectcall($account, "New", "postmaster@test.com");
  icewarp_apiobjectcall($account, "SetProperty", "u_name", "Test Account");
  icewarp_apiobjectcall($account, "SetProperty", "u_password", "Pass1");
  icewarp_apiobjectcall($account, "SetProperty", "u_mailbox", "postmaster");
  icewarp_apiobjectcall($account, "Save");
  icewarp_apiobjectcall($account); // destruct object
}


IceWarpCOM.Mailer
-----------------

The IceWarpCOM.Mailer object can send email to any mail server not only IceWarp. 
It is compatible with the syntax of the ASPEmail component.

  IMailerDisp = dispinterface
    ['{AFE68541-8496-11D7-BE4E-00055DDED8D2}']
    property RemoteHost: WideString dispid 201;
    property FromAddress: WideString dispid 202;
    property FromName: WideString dispid 203;
    property BodyText: WideString dispid 204;
    property Subject: WideString dispid 205;
    property Recipients: WideString dispid 206;
    property MailFrom: WideString dispid 207;
    property ContentTransferEncoding: WideString dispid 208;
    property Charset: WideString dispid 209;
    property IsHTML: WordBool dispid 210;
    property Result: Integer readonly dispid 211;
    property Response: WideString readonly dispid 212;
    procedure Reset; dispid 213;
    property Helo: WideString dispid 214;
    procedure AddRecipient(const Email: WideString; const Name: WideString); dispid 215;
    procedure AddCc(const Email: WideString; const Name: WideString); dispid 216;
    procedure AddBcc(const Email: WideString; const Name: WideString); dispid 217;
    function SendMail: WordBool; dispid 218;
    procedure AddCustomHeader(const HeaderValue: WideString); dispid 219;
    procedure AddAddress(const Email: WideString; const Name: WideString); dispid 220;
    procedure AddReplyTo(const Email: WideString; const Name: WideString); dispid 221;
    procedure AddAttachment(const Attachment: WideString); dispid 222;
    function EncodeHeader(const Header: WideString): WideString; dispid 223;
    procedure AddEmbeddedImage(const FileName: WideString; const CID: WideString); dispid 224;
    procedure AppendBodyFromFile(const FileName: WideString); dispid 225;
    procedure ResetRecipients; dispid 226;
    property UserName: WideString dispid 227;
    property Password: WideString dispid 228;
  end;


SMTP Session related

    property RemoteHost: WideString 

	Domain name or IP address of the smtp server to connect to. Optionally, port 
	can be specified, e.g.  $com->RemoteHost="smtp.somedomain.com:655".
	By default, localhost on port 25 will be used.


    property Helo: WideString
	
	Text, which will be sent to the SMTP server as a parameter to the HELO command.
	By default, "localhost" is used


    property UserName: WideString
    property Password: WideString

	Username and password for SMTP authentication. If username is specified, 
	ESMTP session is opened instead of basic SMTP. CRAM-MD5 authentication mechanism is used.
	Default value of password is an empty string.


    property MailFrom: WideString

	Senders email used as a parameter for the MAIL FROM command. 
	By default, MAIL From:<> will be used.


    property Recipients: WideString
	
	List of recipients of the email. Its elements will will be used as parameters of RCPT TO commands.
	The list has the form: "<user@icewarpdemo.com>;<admin@icewarpdemo.com>".
	It is not recomended to modify this property directly, because it is automatically filled by the 
	AddRecipient and AddAddress procedures.


    procedure Reset

	Resets all properties except remotehost,username and password to the default state.	


MIME header related

    property FromAddress: WideString
    property FromName: WideString

	Senders email address and name, which will be included in the "TO" header field.


    procedure AddRecipient(const Email: WideString; const Name: WideString);
    procedure AddAddress(const Email: WideString; const Name: WideString); 

	Adds given email address and name to the TO header. It also adds email address to the
	list of recipients (property Recipients). Both procedures does exactly the same.


    procedure AddCc(const Email: WideString; const Name: WideString)

	Adds given email address and name to the Cc header. It also adds email address to the
	list of recipients (property Recipients).


    procedure AddBcc(const Email: WideString; const Name: WideString)

	Adds given email address to the	list of recipients (property Recipients). The Second parameter
	is ignored.


    procedure AddReplyTo(const Email: WideString; const Name: WideString);

	Adds given email address and name to the Reply-To header.

    procedure AddCustomHeader(const HeaderValue: WideString)

	Adds the given parameter to the header part of the message. E.g.:AddCustomHeader("Message-ID: 2352345234");	


    procedure ResetRecipients

	Reset the lists of recipients (property Recipients) and the lists created using
	the AddBCc,AddCc,AddRecipient and AddAddress procedures.


    property ContentTransferEncoding: WideString

	Value of Content-Transfer-Encoding (CTE), which will be included in the header. 
	Setting this property does not trigger any processing of the mail body. 
	It is responsibility of the user to properly format the message body. 
	This property does not influence the CTE used for encoding of the attachement.
	By default, CTE is not included into the message header.
	
    property Charset: WideString;

	Value of Charset, which will be included in the header. 
	Setting this property does not trigger any processing of the mail body. 
	It is responsibility of the user to properly format the message body. 
	By default, charset is not included into the message header.

    property IsHTML: WordBool
	
	If set to true, Content-Type of the message is set to text/html,
	otherwise it is set to text/plain.
   

    function EncodeHeader(const Header: WideString): WideString

	Encodes given parameter according to according to the RFC 1522.
	It takes the "charset" property into account. 
	It is important when you need to have non ASCII characters in header fields of the email.


    property Subject: WideString
    property BodyText: WideString

	Subject and body of the message. It is responsibility of the user to properly
	format the message body so that it corresponds with information in the header.
	(ContentTransferEncoding, Charset, Content-Type)


    procedure AppendBodyFromFile(const FileName: WideString)

	Appends contents of given file to the message body.


    procedure AddAttachment(const Attachment: WideString)

	Attaches specified file to the message. 
	Message is reformated to MULTIPART MIME 1.0 message.
	Can be called multiple times to add more attachements.
	
    procedure AddEmbeddedImage(const FileName: WideString; const CID: WideString)

	Embeds the spedified image into the message. The image can be then
	displayed in HTML mail body. CID is used  within the <img> tag to identify
	the embedded image.

  

    function SendMail: WordBool

	Sends the e-mail message using the specified properties.
	Returns true if the mail was successfuly sent.


    property Result: Integer readonly

	After call to the "SendMail" function, this property contains "error code".
	Value 1 means that mail was successfuly sent.

 
    property Response: WideString readonly;

	After unsuccessfull call to the "SendMail" function, this property contains 
	textual response from the remote server.





IceWarpCOM.IMMessage
--------------------

  IIMMessageDisp = dispinterface
    ['{A28A1D42-848B-11D7-BE4E-00055DDED8D2}']
    property MessageBody: WideString dispid 201;
    property MessageFrom: WideString dispid 202;
    property MessageSubject: WideString dispid 203;
    property MessageTo: WideString dispid 204;
    property MessageType: WideString dispid 205;
    property MessageTag: WideString dispid 206;
    procedure Reset; dispid 207;
    function SendMessage: WordBool; dispid 208;
    procedure AddAttribute(const Attribute: WideString; const Value: WideString); dispid 209;
    procedure AddTag(const Tag: WideString); dispid 210;
    function IsOnline(const Email: WideString): WordBool; dispid 211;
    function GetPresence(const Email: WideString): WideString; dispid 212;
  end;


IceWarpCOM.IDP
--------------

  IIDPDisp = dispinterface
    ['{AEE4E6B2-CE55-4838-A591-056E56553AC0}']
    function AddFiles(const PackageFile: WideString; const Directory: WideString): WordBool; dispid 201;
    procedure RestoreFiles(const PackageFile: WideString; const Directory: WideString; 
                           var Result: WordBool); dispid 202;
    function ListFiles(const PackageFile: WideString): WideString; dispid 203;
    function RestoreFilesEx(const PackageFile: WideString; const Directory: WideString; 
                            const FilesList: WideString; const Password: WideString): WordBool; dispid 205;
    function AddFilesEx(const PackageFile: WideString; const Directory: WideString; 
                        const Password: WideString): WordBool; dispid 204;
  end;


IceWarpCOM.IceWarpLicense
-------------------------

  IIceWarpLicenseDisp = dispinterface
    ['{E0D781D9-47A0-425A-A02D-C537441B3CF2}']
    property LicenseDemo: WordBool readonly dispid 201;
    property LicenseAppID: Integer readonly dispid 202;
    property LicenseDomains: Integer readonly dispid 203;
    property LicenseUsers: Integer readonly dispid 204;
    property LicenseProductID: Integer readonly dispid 205;
    property LicenseExpiresAfter: Integer readonly dispid 206;
    property LicenseValid: WordBool readonly dispid 207;
    function ValidateLicense(const LicenseKey: WideString): WordBool; dispid 208;
    function ValidateLicenseWithReferenceKey(const LicenseKey: WideString; 
                                             const ReferenceKey: WideString): WordBool; dispid 209;
    property LicenseCreationDate: Integer readonly dispid 210;
    property LicenseValidFor: Integer readonly dispid 211;
    property LicenseCount: Integer readonly dispid 212;
    function SelectLicense(Index: Integer): WordBool; dispid 213;
    property LicenseXML: WideString readonly dispid 214;
    property LicenseVersion: Integer readonly dispid 215;
    property LicenseFraud: Integer readonly dispid 216;
    function RetrieveOnlineLicense(const OrderID: WideString; const ReferenceKey: WideString): WideString; dispid 217;
  end;


IceWarpCOM.Groupware
--------------------

  IGroupWare = interface(IDispatch)
    ['{6C999005-6566-47EC-852F-57AAC2B7BBE4}']
    function FunctionCall(const FuncName: WideString; const Param1: WideString; const Param2: WideString; const Param3: WideString; const Param4: WideString): WideString; safecall;
    function Connect(const Server: WideString; SSL: WordBool): WordBool; safecall;
    function Disconnect: WordBool; safecall;
  end;


IceWarpCOM.ChallengeResponse
----------------------------

  IChallengeResponse = interface(IDispatch)
    ['{52A61EE2-1539-4669-B934-482470ACFCE6}']
    function FunctionCall(const FuncName: WideString; const Param1: WideString; const Param2: WideString; const Param3: WideString): WideString; safecall;
  end;
