So now inside the pawsChatWindow::OnKeyDown, it handles the CSKEY_ENTER as well and calls a member function: SendChatLine() which in turn calls cmdsource->Publish(textToSend).
Looking at the pawsChatWindow header I can see that it inherits from psCmdBase which has the CmdHandler cmdsource. So it's basically publishing this command to the CommandHandler to send out to its various subscribers.
So the question becomes now where does this command handler get created? By looking around a bit I can see that the psClient engine creates one main command handler.
\PlaneShift\PS\src\client\psnetmanager.cpp
psNetManager::Initialize() is the actual place where it does
cmdhandler = csPtr<CmdHandler> (new CmdHandler(object_reg));
This CmdHandler is then passed around to the various components on the client like the ChatWindow. For example when the pawsChatWindow is doing it's PostSetup it gets the CmdHandler from the psengine itself.
...
bool pawsChatWindow::PostSetup()
{
if ( !psCmdBase::Setup( psengine->GetMsgHandler(), psengine->GetCmdHandler()) )
return false;
...
So there is one global command handler that we publish stuff to.
Adding in a hacked together class diagram to get an idea of how the classes relate to each other.