SMBAGENT.H

// --smbagent.h------------------------------------------------------------------- 
//
// SMBAGENT global definitions
//
// Copyright (C) Microsoft Corp. 1986-1996. All Rights Reserved.
// -----------------------------------------------------------------------------

#ifndef _SMBAGENT_H_
#define _SMBAGENT_H_

// -----------------------------------------------------------------------------

#define MAXSUBJLEN100 // Max.length of subject field strings
#define MAXTEXTLEN100// Max length of text strings
#defineMAXCMDLEN24// Max length of each command string

#define TPRINTF(x)_tprintf(TEXT(x))
#define TPRINTF1(x,y)_tprintf(TEXT(x),(y))
#define TPRINTF2(x,y,z)_tprintf(TEXT(x),(y),(z))

#define TOPIC_ROOT_FOLDER_NAME TEXT("List Server Topics")
#define TOPIC_ROOT_FOLDER_COMMENTTEXT("Root folder of all topic folders for the List Server.")

#define NDR_FOLDER_NAMETEXT("Undeliverable")
#define NDR_FOLDER_COMMENTTEXT("Undeliverable message folder.")

#define PROFILE_NAMETEXT("ListServer")
#define PROFILE_PASSWORD""

#define INTRO_MSG_CLASS TEXT("IPM.NOTE.SMBAGENT.INTRO")
#define SMBAGENT_MSG_CLASS TEXT("IPM.NOTE.SMBAGENT")

// -----------------------------------------------------------------------------
// The following macros and the SInitPropValue structure give the user the
// ability to easily create a property value array that is initialized with
// any property type and value.
//
// See usage example that follows.
// -----------------------------------------------------------------------------

#define MAKE_PROP_VALUE( cnt, ptr) ((LONGLONG) ((((LONGLONG) ((ULONG) (ptr))) << 32) + ((LONGLONG) ((ULONG) (cnt)))))
#define BINARY_PROP_VALUE( bin) MAKE_PROP_VALUE( sizeof( bin), &bin)
#define MULTI_VALUE_PROP( array) MAKE_PROP_VALUE( ARRAY_CNT( array), array)

typedef struct
{
ULONG ulPropTag;
ULONG dwAlignPad;
LONGLONG ll;
} SInitPropValue, *LPSInitPropValue;

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Usage example:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#ifdef _USAGE_EXAMPLE_
#ifndef _USAGE_EXAMPLE_
// Example of a binary structure that could be used by the property value array.
typedef struct
{
TCHAR ch[20];
LPTSTR lpsz;
ULONG ul;
BOOL flag;
} ExampleStruct;

// Example data that could go in the property value array.
ExampleStruct BinData = { TEXT("Binary Data"), TEXT( "A STRING"), 3752789, TRUE};
LONG LongArray[] = { 92314535, 2231223, 111, 424242312};

// The example property value array.
static SInitPropValue PropArray[] =
{
{ PT_STRING8, 0, (ULONG) TEXT("Topic Folder")},
{ PT_LONG, 0, 0},
{ PT_BOOLEAN, 0, FALSE},
{ PT_BINARY, 0, BINARY_PROP_VALUE( BinData)},
{ PT_MV_LONG, 0, MULTI_VALUE_PROP( LongArray)},
};
LPSPropValue lpProps = (LPSPropValue) PropArray;

#endif
#endif

// -----------------------------------------------------------------------------
// These defines are indexes into the lpSenderProps array. This array is filled
// by a call to HrGetSenderProps() found in MESSAGES.C
// -----------------------------------------------------------------------------

extern LPSPropValue lpSenderProps; // Pointer to array of sender properties.
extern LPADRLIST lpSenderAddr; // Pointer to sender's return address.

typedef enum
{
IDX_SENDER_NAME = 0,
IDX_SENDER_ENTRYID,
IDX_SENDER_ADDRTYPE,
IDX_SENDER_EMAIL_ADDRESS,
IDX_MESSAGE_FLAGS,
IDX_MESSAGE_CLASS,
IDX_SUBJECT,

// Leave this at the end of list.
TOTAL_SENDER_PROPS
} SenderPropsIndexes;

// Returns a pointer to the sender's entry id as a SBinary structure.
__inline LPSBinary GetSenderEntryIdPtr()
{
return( &(lpSenderProps[ IDX_SENDER_ENTRYID].Value.bin));
}


// -----------------------------------------------------------------------------
// Global variables.
// -----------------------------------------------------------------------------

extern LPMAPIFOLDER lpInFolder; // Pointer to INBOX folder
extern LPMAPIFOLDER lpNDRFolder; // Pointer to the "Undeliverable" folder
extern LPMAPIFOLDER lpTopicsFolder; // Pointer to the "TOPICS" folder
extern LPADRBOOK lpAdrBook; // Pointer to Address Book
extern HINSTANCE hInst;
extern TCHAR szSubjBuf[];
extern BOOL bPublicTopic;
extern DWORD dwACLRights;

// -----------------------------------------------------------------------------
// Handle to a subscriber list
// -----------------------------------------------------------------------------

typedef struct
{
LPMESSAGElpIntroMsg; // intro message for requested topic folder
LPMAPITABLElpSubscriberTable;// table of recipients JOINed to the folder
}HSUBSCRIBERS, FAR * LPHSUBSCRIBERS;


// -----------------------------------------------------------------------------
// In SMBAGENT.C
// -----------------------------------------------------------------------------

HRESULT HrInitTopicFolders( VOID);

// -----------------------------------------------------------------------------
// Command handling procedures defined in COMMANDS.C
// -----------------------------------------------------------------------------

HRESULT HrProcessCommand(
IN LPMESSAGElpMessage,// Ptr to the current message object
IN LPENTRYLISTlpelMsgID,// Ptr to ENTRYLIST of current message
IN BOOL *pfDeleted);// Flag if msg.is deleted upon return


// -----------------------------------------------------------------------------
// Messaging procedures defined in MESSAGES.C
// -----------------------------------------------------------------------------

HRESULT HrGetSenderProps(
INLPMESSAGElpMessage);// Ptr to the msg.to read sender prop.from

HRESULT HrSendMessage(
INLPADRLISTlpRecipList,// Recipient list of the message
INLPTSTRlpszSubject,// Message Subject string
INLPTSTRlpszText, // Message text string
INintcNAttach, // #Attachments to be included
INLPMESSAGElpAtts[]);// Array of pointers to attachments

// Properties to copy when duplicating a message.
extern LPSPropTagArray lpPropsToCopyForKeep; // Used when keeping in a folder.
extern LPSPropTagArray lpPropsToCopyForSend; // Used when sending to a subscriber.

HRESULT HrDuplicateMessage(
IN LPMESSAGE lpSrcMsg, // pointer to the source message
IN LPMAPIFOLDER lpDestFolder, // pointer to the destination folder
IN ULONG ulFlags, // Intended to set MAPI_ASSOCIATED
IN LPSPropTagArray lpPropsToCopy, // Pass in one of the above array pointers.
OUT LPMESSAGE *lppDestMsg); // Addr of var.to contain ptr.to new msg.

HRESULT HrSendErrReport(
IN LPMESSAGElpMessage,// Ptr to message included in report
IN int iErrText);// Resource Id of error string

HRESULT HrSendConfirmReport(
IN LPMESSAGElpMessage,// Ptr to the command message
IN intiCmdName,// Resource Id of command name
IN int iCnfText,// Resource Id of confirm string
IN LPMESSAGElpAttach);

// -----------------------------------------------------------------------------
// Access control list functions defined in ACL.C.
// -----------------------------------------------------------------------------

HRESULT HrModifyACL(
IN LPMAPIFOLDER lpFolder, // Folder to modify ACL for
IN LPTSTR pszUserName, // Name of user to change
IN ULONG cbUserEid, // Byte count for User's entry id.
IN LPENTRYID lpUserEid, // User's entry id.
IN BOOL fRemove, // Flag indicating whether to remove rights
IN DWORD lRights); // New rights (ignored if fRemove)

// -----------------------------------------------------------------------------
// Include topic cache code and data definitions.
// -----------------------------------------------------------------------------

#include "Topics.h"
#include "TFldrAry.h"
#include "TopCache.h"

// -----------------------------------------------------------------------------

#endif //_SMBAGENT_H_