Microsoft Chat Server Development Guide

SessionMonitor.h

// SessionMonitor.h : Declaration of the CSessionMonitor

#ifndef __SESSIONMONITOR_H_
#define __SESSIONMONITOR_H_

#include "resource.h"       // main symbols
#include "time.h"

// Use the STD template library, in the current namespace
#include "map"
#include "string"
using namespace std;

// hide the 'identifier names are too long' warning
#pragma warning(disable:4786)


/////////////////////////////////////////////////////////////////////////////
// CSessionMonitor
class ATL_NO_VTABLE CSessionMonitor : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CSessionMonitor, &CLSID_SessionMonitor>,
    public IDispatchImpl<IChatExtensionCallBack, &IID_IChatExtensionCallBack, &LIBID_CHATSVCLib>,
    public IDispatchImpl<IChatServerCallBack, &IID_IChatServerCallBack, &LIBID_CHATSVCLib>    
{
public:
    CSessionMonitor() {
        m_pRegistrar = NULL;
    }
    

    DECLARE_REGISTRY_RESOURCEID(IDR_SESSIONMONITOR)
    DECLARE_NOT_AGGREGATABLE(CSessionMonitor)

    BEGIN_COM_MAP(CSessionMonitor)
        COM_INTERFACE_ENTRY(IChatExtensionCallBack)
        COM_INTERFACE_ENTRY(IChatServerCallBack)
    END_COM_MAP()


public:
    //IChatExtensionCallback methods
    STDMETHOD(OnInstall)(void)
        { return E_NOTIMPL; }
    STDMETHOD(OnUninstall)(void)
        { return E_NOTIMPL; }
    STDMETHOD(OnConfigureExtension)(IChatUser *pUser,BSTR bstrCommand)
        { return E_NOTIMPL; }
    STDMETHOD(OnGetPropertyPageClass)(PPAGE Class, BSTR *pbstrCLSID)
        { return E_NOTIMPL; }
    STDMETHOD(get_Name)(BSTR *pbstrName);
        // This extension implements this method 
    STDMETHOD(Init)(IChatServer *pServer, IChatRegistrar* pRegistrar, long *Result);
        // This extension implements this method 
    STDMETHOD(Term)(long *Result)
        { return E_NOTIMPL; }


    //IChatServerCallback methods
    STDMETHOD(OnNewUser)(IChatUser *pUser, VARIANT_BOOL varbPostUpdate, long *pfCancel);
        // This extension implements this method 
    STDMETHOD(OnCloseUser)(IChatUser *pUser);
        // This extension implements this method 
    STDMETHOD(OnNewChannel)(IChatChannel *pChannel, VARIANT_BOOL PostUpdate, long *pfCancel)
        { return E_NOTIMPL; }
    STDMETHOD(OnCloseChannel)(IChatChannel *pChannel)
        { return E_NOTIMPL; }
    STDMETHOD(OnAddAccess)(IChatServer *pServer, IChatAccessEntry *paeNewEntry, VARIANT_BOOL varbPostUpdate, long *plCancel)
        { return E_NOTIMPL; }
    STDMETHOD(OnRemoveAccess)(IChatServer *pServer, IChatAccessEntry *paeRemovedEntry)
        { return E_NOTIMPL; }


private:
    CComPtr<IChatRegistrar> m_pRegistrar;

    map<string, time_t> m_LoginTimes;
};

#endif //__SESSIONMONITOR_H_

© 1998 Microsoft Corporation. All rights reserved.