www.pudn.com > ChatUseIOCP.rar > ChatServerClient.h


#pragma once 
#include "ChatProtocol.h" 
#include "ChatServerSocket.h" 
 
class CChatServerClient : 
	public ChatProtocol 
{ 
	friend class CChatServerSocket; 
 
 
	std::string			m_strUserName; 
	bool				m_bLoggedIn; 
 
	/// Let's override the Disconnect transaction. And push userlist to all users when someone disconnect. 
	virtual void OnDisconnect(); 
 
public: 
	CChatServerClient(void); 
 
	/// Handles all incomming packets. 
	void HandlePacket(ChatProtocol::Packet* pPacket); 
 
	/// Let the user lgin 
	void Login(Packet &InPacket, Packet &OutPacket); 
 
	/// List all users that currently are logged in. 
	void ListUsers(Packet &InPacket, Packet &OutPacket); 
 
	/// Sends a message to a user (incomming) 
	void SendMessage(Packet &InPacket, Packet &OutPacket); 
 
	/// Sends a message to the user (outgoing) 
	void SendMessage(const char* pszFrom, const char* pszTo, const char* pszMessage); 
 
	const std::string& GetUserName() const; 
 
	~CChatServerClient(void); 
};