// \file SendmailIntegrate.hpp
//
// Copyright (C) 2012 ARM Research Labs, LLC.
// See www.armresearch.com for the copyright terms.
//
// This file defines the SendmailIntegrate interface.
//
// $Id$
//
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef SendmailIntegratehpp_included
#define SendmailIntegratehpp_included

#include <vector>

#include "MtaIntegrate.hpp"

/// Class to manage the SNFServer integration with sendmail.
//
// This class implements the MtaIntegrate interface for sendmail.
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
class SendmailIntegrate : public MtaIntegrate {

public:

    virtual void SetOperatingSystem(std::string OperatingSystemType);

    virtual void Integrate(FileBackup *SaveFile);

    virtual void Unintegrate(FileBackup *SaveFile);

private:

    virtual bool MtaIsRunningDetected();

    virtual bool ReloadMta();

    virtual bool IsIntegrated();

    bool MtaConfigurationHasProcmailForLda();

    /// Directory containing the snfSniffer script.
    std::string SnfSnifferDirName;

    /// snfSniffer script file name, including the directory.
    std::string SnfSnifferFileName;

    /// Sample snfSniffer script file name, including the directory.
    std::string SnfSnifferSampleFileName;

    /// procmail system configuration file name.
    std::string ProcmailRcFileName;

    /// Integration lines for procmail configuration file.
    std::string ProcmailRcSnifferIntegration;

    /// Sendmail sendmail.mc file path.
    std::string SendmailSendmailMcPath;

    /// Sendmail sendmail.cf file path.
    std::string SendmailSendmailCfPath;

    /// Command to build and install the sendmail.cf file.
    std::string BuildInstallSendmailCfFile;

    /// Command to reload the MTA.
    std::string ReloadMtaCommand;

    /// True if integration is supported on this platform.
    bool IntegrationIsSupported;

    /// typedef for container of filenames to backup up before integrating or unintegrating.
    typedef std::vector<std::string> FileToBackupType;

    /// Files to back up before integrating or unintegrating.
    FileToBackupType FileToBackup;

};

#endif
