www.pudn.com > ChatSystem_src.zip > ChatServerDoc.h
// ChatServerDoc.h : interface of the CChatServerDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHATSERVERDOC_H__E8E2AD0C_509F_11D6_9693_AF0E159D6826__INCLUDED_)
#define AFX_CHATSERVERDOC_H__E8E2AD0C_509F_11D6_9693_AF0E159D6826__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "lstnsock.h"
#include "clntsock.h"
class CMsg;
class CChatServerSrvrItem;
class CChatServerDoc : public COleServerDoc
{
protected: // create from serialization only
CChatServerDoc();
DECLARE_DYNCREATE(CChatServerDoc)
// Attributes
public:
CChatServerSrvrItem* GetEmbeddedItem()
{ return (CChatServerSrvrItem*)COleServerDoc::GetEmbeddedItem(); }
CListeningSocket* m_pSocket;
CStringList m_msgList;
CStringList m_chattersList;
CPtrList m_connectionList;
BOOL bIsNewChatter;
// Operations
public:
void UpdateClients();
void ProcessPendingAccept();
void ProcessPendingRead(CClientSocket* pSocket);
CMsg* AssembleMsg(CClientSocket* pSocket);
CMsg* ReadMsg(CClientSocket* pSocket);
void SendMsg(CClientSocket* pSocket, CMsg* pMsg);
void CloseSocket(CClientSocket* pSocket);
void Message(LPCTSTR lpszMessage);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChatServerDoc)
protected:
virtual COleServerItem* OnGetEmbeddedItem();
public:
virtual BOOL OnNewDocument();
virtual void DeleteContents();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
void UpdateMessages();
void UpdateConnections();
void SendUpdatedList(CMsg* pMsg);
void DeleteChatter(CString sNickName, CMsg* pMsg);
void UpdateChattersList(CString sName);
virtual ~CChatServerDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CChatServerDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHATSERVERDOC_H__E8E2AD0C_509F_11D6_9693_AF0E159D6826__INCLUDED_)