From 9ab87f39d7fc37e52d742d38b191eed9128d4b5b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 7 Feb 2008 19:01:12 +0000 Subject: Wowee, I think all this new stuff works, Conduit I don't need now, so it's not done yet. The Client class now supports a function called getLink() which returns a ClientLink object. This object may then be passed off to any other class and called to send messages to that client object. It is threadsafe if ItoServer is being used, and not for Server. Sending a message via a ClientLink calls the onMessage function on the assosiated protocol. Note that sending messages from within protocol event handlers or functions they call, while safe, may be slow and it's reccomended that you avoid this. --- src/client.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/client.h') diff --git a/src/client.h b/src/client.h index 3764375..20eb8b8 100644 --- a/src/client.h +++ b/src/client.h @@ -16,6 +16,7 @@ namespace Bu { class Protocol; class Socket; + class ClientLinkFactory; /** *@author Mike Buland @@ -24,7 +25,7 @@ namespace Bu class Client { public: - Client( Bu::Socket *pSocket ); + Client( Bu::Socket *pSocket, Bu::ClientLinkFactory *pfLink ); virtual ~Client(); void processInput(); @@ -59,6 +60,10 @@ namespace Bu void disconnect(); bool wantsDisconnect(); + class ClientLink *getLink(); + + void onMessage( const Bu::FString &sMsg ); + private: Bu::Socket *pSocket; Bu::Protocol *pProto; @@ -66,6 +71,7 @@ namespace Bu int nRBOffset; Bu::FString sWriteBuf; bool bWantsDisconnect; + class Bu::ClientLinkFactory *pfLink; }; } -- cgit v1.2.3