Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

pawsChatWindow Class Reference

Main Chat window for PlaneShift. More...

#include <chatwindow.h>

List of all members.

Public Member Functions

void AddAutoCompleteName (const char *name)
void AutoReply (void)
void BadWordsFilter (csString &s)
 Remove bad words from the output string.
void ChatOutput (const char *data, int colour=-1, int type=CHAT_SYSTEM, bool flashEnabled=true, bool hasCharName=false, int hotkeyChannel=0)
 Function that handles output of various tabbed windows.
void Clear (int mode=-2)
 Clear history.
csString GetBracket (int type)
 Generates a bracket like [tell] starting from the msgtype.
char const * GetFontName ()
 return the name of the font
pawsIgnoreWindowGetIgnoredList ()
pawsEditTextBoxgetInputTextBox ()
ChatSettingsGetSettings ()
const char * HandleCommand (const char *cmd)
 For the iCommandSubscriber interface.
void HandleMessage (MsgEntry *message)
 For the iNetSubsciber interface.
bool InputActive ()
 Check to see if the text input box is active.
void JoinChannel (csString name)
 Joins the channel and adds the hotkey when the server accepts the join.
bool LeaveChannel (int hotkeyChannel)
 Leaves the channel and removes the hotkey association.
void LoadChatSettings ()
bool LoadSetting ()
 load the settings stored by pawsConfigChatFont
int mixColours (int colour1, int colour2)
 mixes two colours and returns their mixed colour
virtual bool OnButtonPressed (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is pressed.
bool OnChildMouseEnter (pawsWidget *widget)
 Called when mouse enters a child widget.
bool OnChildMouseExit (pawsWidget *widget)
 Called when a mouse exits a child widget.
bool OnDoubleClick (int button, int modifiers, int x, int y)
 Handle double click events.
bool OnKeyDown (utf32_char keyCode, utf32_char key, int modifiers)
 Process keydown messages.
virtual void OnLostFocus ()
 Sets hasFocus false and notifys parent.
bool OnMenuAction (pawsWidget *widget, const pawsMenuAction &action)
 Called whenever a menu action occurs.
bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes.
 pawsChatWindow ()
void PerformAction (const char *action)
 Does an action based on this string.
bool PostSetup ()
 This is called after the widget and all of it's children have been created.
void RefreshCommandList ()
void ReloadChatWindow ()
 Reload Chat Window.
void RemoveAutoCompleteName (const char *name)
void SaveChatSettings ()
void SelectChatTab (int tab)
void SetAway (const char *text)
 Sets the away message.
void SetChatWindowFont (const char *FontName, int FontSize)
 change the font on only the windows that display the chat text
virtual void Show ()
 When the window is opened let the controller window know about it.
void SwitchChannel (const csString &name, pawsWidget *widget=NULL)
void writeChatHistory ()
virtual ~pawsChatWindow ()

Protected Member Functions

void CreateSettingNode (iDocumentNode *mNode, int color, const char *name)
void DetermineChatTabAndSelect (int chattype)
void FormatMessage (csString &sText, csString &sPerson, csString prependingText, csString &buff, bool &hasCharName)
 Takes as input a message and formats it with colours, /me and /my support.
void HandleSystemMessage (MsgEntry *message)
void LogMessage (const char *message, int type=CHAT_SAY)
 Logs a message coming from the chat.
void ReplayMessages (unsigned int reqLines)
 Replay recent message history on load.
void SendChatLine (csString &inputText)
 Sends the contents of the input text to the server.
void SubscribeCommands ()
 Subscribe the player commands.
void TabCompleteCommand (const char *cmd)
 Tab completion.
void TabCompleteName (const char *cmd)

Protected Attributes

csArray< csArray< csString > * > autoCompleteLists
 Contains pointers to all the autocompletion lists (excluding command lists)
csArray< csString > autoCompleteNames
 list of names to auto-complete
csString awayText
csHashReversible< uint32_t,
csString > 
channelIDs
 Subscribed channel name to server channel ID reversible mapping.
csArray< uint16_t > channels
 Hotkeys for server channel IDs.
pawsChatHistorychatHistory
 Chat history.
csArray< csString > chatTriggers
csRedBlackTree< psStringcommandList
 list of last commands
csString currLine
 Current line, stored for when scrolling back in the chat history.
bool havePlayerName
 Decides if we have a player name.
pawsIgnoreWindowIgnoredList
pawsEditTextBoxinputText
 Input box for quick access.
bool isInChannel
 Is already in default channel?
csRef< iFile > logFile [CHAT_END]
 Stores the references to the actually used files for each chat type.
csString noCasePlayerForename
csString noCasePlayerName
 Player name, with no upercase.
csHash< csRef< iFile >, uint > openLogFiles
 Stores a reference to all opened log files for easy search.
int replyCount
csString replyList [4]
ChatSettings settings
 Stores the settings for the chat.
csArray< csString > systemTriggers
pawsTabWindowtabs

Detailed Description

Main Chat window for PlaneShift.

This class will handle most of the communication that goes on between players and system messages from the server. This class also tracks the ignore list on the client.

Definition at line 133 of file chatwindow.h.


Constructor & Destructor Documentation

pawsChatWindow::pawsChatWindow ( )
virtual pawsChatWindow::~pawsChatWindow ( ) [virtual]

Member Function Documentation

void pawsChatWindow::AddAutoCompleteName ( const char *  name)
void pawsChatWindow::AutoReply ( void  )
void pawsChatWindow::BadWordsFilter ( csString &  s)

Remove bad words from the output string.

void pawsChatWindow::ChatOutput ( const char *  data,
int  colour = -1,
int  type = CHAT_SYSTEM,
bool  flashEnabled = true,
bool  hasCharName = false,
int  hotkeyChannel = 0 
)

Function that handles output of various tabbed windows.

void pawsChatWindow::Clear ( int  mode = -2)

Clear history.

void pawsChatWindow::CreateSettingNode ( iDocumentNode *  mNode,
int  color,
const char *  name 
) [protected]
void pawsChatWindow::DetermineChatTabAndSelect ( int  chattype) [protected]
void pawsChatWindow::FormatMessage ( csString &  sText,
csString &  sPerson,
csString  prependingText,
csString &  buff,
bool &  hasCharName 
) [protected]

Takes as input a message and formats it with colours, /me and /my support.

Parameters:
sText,:The message main text.
sPerson,:The message sender.
prependingText,:the text which will be prepended before the message. This will get translated.
buff,:where the formatted message will be stored.
hasCharName,:Tells if the player character name is inside the message.
csString pawsChatWindow::GetBracket ( int  type)

Generates a bracket like [tell] starting from the msgtype.

char const* pawsChatWindow::GetFontName ( ) [inline]

return the name of the font

Definition at line 232 of file chatwindow.h.

pawsIgnoreWindow* pawsChatWindow::GetIgnoredList ( ) [inline]

Definition at line 206 of file chatwindow.h.

pawsEditTextBox* pawsChatWindow::getInputTextBox ( ) [inline]

Definition at line 222 of file chatwindow.h.

ChatSettings& pawsChatWindow::GetSettings ( ) [inline]

Definition at line 199 of file chatwindow.h.

const char* pawsChatWindow::HandleCommand ( const char *  cmd) [virtual]

For the iCommandSubscriber interface.

Implements psCmdBase.

void pawsChatWindow::HandleMessage ( MsgEntry message) [virtual]

For the iNetSubsciber interface.

Implements psCmdBase.

void pawsChatWindow::HandleSystemMessage ( MsgEntry message) [protected]
bool pawsChatWindow::InputActive ( )

Check to see if the text input box is active.

Returns:
true if the text box is active.
void pawsChatWindow::JoinChannel ( csString  name)

Joins the channel and adds the hotkey when the server accepts the join.

bool pawsChatWindow::LeaveChannel ( int  hotkeyChannel)

Leaves the channel and removes the hotkey association.

void pawsChatWindow::LoadChatSettings ( )
bool pawsChatWindow::LoadSetting ( )

load the settings stored by pawsConfigChatFont

void pawsChatWindow::LogMessage ( const char *  message,
int  type = CHAT_SAY 
) [protected]

Logs a message coming from the chat.

It handles the book keeping of the log files, opens and closes them on need, Formats the log files by adding headings when opening a new one and adds brackets to them.

Parameters:
messageThe message to log.
typeThe chat type of this message to log.
int pawsChatWindow::mixColours ( int  colour1,
int  colour2 
)

mixes two colours and returns their mixed colour

virtual bool pawsChatWindow::OnButtonPressed ( int  button,
int  keyModifier,
pawsWidget widget 
) [virtual]

Called whenever a button is pressed.

Parameters:
buttonThe button pressed.
keyModifierModifier key in effect.
widgetThe widget the button belongs to.
Returns:
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

bool pawsChatWindow::OnChildMouseEnter ( pawsWidget child) [virtual]

Called when mouse enters a child widget.

If child wants to inform parent.

Parameters:
childThe child widget.
Returns:
true

Reimplemented from pawsWidget.

bool pawsChatWindow::OnChildMouseExit ( pawsWidget child) [virtual]

Called when a mouse exits a child widget.

If child wants to inform parent.

Parameters:
childThe child widget.
Returns:
bool Parent's result or TRUE if no parent.

Reimplemented from pawsWidget.

bool pawsChatWindow::OnDoubleClick ( int  button,
int  modifiers,
int  x,
int  y 
) [inline, virtual]

Handle double click events.

We handle double mouse click like mouse down events. As we don't need to handle them particularly and we don't want to pass events to the widgets.

Parameters:
buttonThe button being pressed.
modifiersThe modifiers being actually held.
xThe x position of the mouse.
yThe y position of the mouse.

Reimplemented from pawsWidget.

Definition at line 165 of file chatwindow.h.

bool pawsChatWindow::OnKeyDown ( utf32_char  keyCode,
utf32_char  keyChar,
int  modifiers 
) [virtual]

Process keydown messages.

Parameters:
keyCodeThe code for the pressed key.
keyCharThe key pressed.
modifiersUsed to modify tab behavior.
Returns:
bool TRUE for success FALSE if no action.
Remarks:
If you override this, be sure to also override GetFocusOverridesControls() as returning true

Reimplemented from pawsWidget.

virtual void pawsChatWindow::OnLostFocus ( ) [virtual]

Sets hasFocus false and notifys parent.

Reimplemented from pawsWidget.

bool pawsChatWindow::OnMenuAction ( pawsWidget widget,
const pawsMenuAction action 
) [virtual]

Called whenever a menu action occurs.

Parameters:
widgetThe widget acted upon.
actionThe action to take.
Returns:
TRUE on menu destroy and FALSE on configure

Reimplemented from pawsWidget.

bool pawsChatWindow::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse down event to test for and apply window changes.

Parameters:
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns:
bool TRUE if movable or resizable.
Remarks:
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

void pawsChatWindow::PerformAction ( const char *  action) [virtual]

Does an action based on this string.

Parameters:
actionThe action to perform.

Reimplemented from pawsWidget.

bool pawsChatWindow::PostSetup ( ) [virtual]

This is called after the widget and all of it's children have been created.

Remarks:
This can be useful for widgets that want to get pointers to some of it's children for quick access.

Reimplemented from pawsWidget.

void pawsChatWindow::RefreshCommandList ( )
void pawsChatWindow::ReloadChatWindow ( )

Reload Chat Window.

void pawsChatWindow::RemoveAutoCompleteName ( const char *  name)
void pawsChatWindow::ReplayMessages ( unsigned int  reqLines) [protected]

Replay recent message history on load.

Parameters:
reqLinesThe amount of lines to load from the log starting from the bottom.
void pawsChatWindow::SaveChatSettings ( )
void pawsChatWindow::SelectChatTab ( int  tab)
void pawsChatWindow::SendChatLine ( csString &  inputText) [protected]

Sends the contents of the input text to the server.

void pawsChatWindow::SetAway ( const char *  text)

Sets the away message.

void pawsChatWindow::SetChatWindowFont ( const char *  FontName,
int  FontSize 
)

change the font on only the windows that display the chat text

virtual void pawsChatWindow::Show ( void  ) [virtual]

When the window is opened let the controller window know about it.

Reimplemented from pawsControlledWindow.

void pawsChatWindow::SubscribeCommands ( ) [protected]

Subscribe the player commands.

void pawsChatWindow::SwitchChannel ( const csString &  name,
pawsWidget widget = NULL 
)
void pawsChatWindow::TabCompleteCommand ( const char *  cmd) [protected]

Tab completion.

void pawsChatWindow::TabCompleteName ( const char *  cmd) [protected]
void pawsChatWindow::writeChatHistory ( )

Member Data Documentation

Contains pointers to all the autocompletion lists (excluding command lists)

Definition at line 284 of file chatwindow.h.

list of names to auto-complete

Definition at line 282 of file chatwindow.h.

csString pawsChatWindow::awayText [protected]

Definition at line 279 of file chatwindow.h.

csHashReversible<uint32_t, csString> pawsChatWindow::channelIDs [protected]

Subscribed channel name to server channel ID reversible mapping.

Definition at line 336 of file chatwindow.h.

csArray<uint16_t> pawsChatWindow::channels [protected]

Hotkeys for server channel IDs.

Definition at line 338 of file chatwindow.h.

Chat history.

Definition at line 304 of file chatwindow.h.

csArray<csString> pawsChatWindow::chatTriggers [protected]

Definition at line 289 of file chatwindow.h.

csRedBlackTree<psString> pawsChatWindow::commandList [protected]

list of last commands

Definition at line 287 of file chatwindow.h.

csString pawsChatWindow::currLine [protected]

Current line, stored for when scrolling back in the chat history.

Definition at line 307 of file chatwindow.h.

Decides if we have a player name.

Definition at line 297 of file chatwindow.h.

Definition at line 275 of file chatwindow.h.

Input box for quick access.

Definition at line 292 of file chatwindow.h.

bool pawsChatWindow::isInChannel [protected]

Is already in default channel?

Definition at line 318 of file chatwindow.h.

csRef<iFile> pawsChatWindow::logFile[CHAT_END] [protected]

Stores the references to the actually used files for each chat type.

Definition at line 313 of file chatwindow.h.

Definition at line 301 of file chatwindow.h.

csString pawsChatWindow::noCasePlayerName [protected]

Player name, with no upercase.

Definition at line 300 of file chatwindow.h.

csHash<csRef<iFile>, uint> pawsChatWindow::openLogFiles [protected]

Stores a reference to all opened log files for easy search.

Definition at line 315 of file chatwindow.h.

Definition at line 277 of file chatwindow.h.

csString pawsChatWindow::replyList[4] [protected]

Definition at line 276 of file chatwindow.h.

Stores the settings for the chat.

Definition at line 310 of file chatwindow.h.

csArray<csString> pawsChatWindow::systemTriggers [protected]

Definition at line 288 of file chatwindow.h.

Definition at line 294 of file chatwindow.h.


The documentation for this class was generated from the following file: