ManaPlus
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends

#include <chatwindow.h>

Inheritance diagram for ChatWindow:
Window ActionListener KeyListener ConfigListener AttributeListener DebugMessageListener BasicContainer2 MouseListener WidgetListener BasicContainer Widget WidgetDeathListener Widget2

Public Member Functions

 ChatWindow (const std::string &name)
 
 ~ChatWindow ()
 
ChatTabgetFocused () const
 
void clearTab () const
 
void prevTab ()
 
void nextTab ()
 
void closeTab () const
 
void defaultTab ()
 
void action (const ActionEvent &event)
 
bool requestChatFocus ()
 
bool isInputFocused () const
 
void chatInput (const std::string &msg) const
 
void localChatInput (const std::string &msg) const
 
void keyPressed (KeyEvent &event)
 
void setInputText (const std::string &text)
 
void addInputText (const std::string &text, const bool space)
 
void addItemText (const std::string &item)
 
void setVisible (Visible visible)
 
void mouseDragged (MouseEvent &event)
 
void mousePressed (MouseEvent &event)
 
void scroll (const int amount) const
 
void setRecordingFile (const std::string &msg)
 
bool getReturnTogglesChat () const
 
void setReturnTogglesChat (const bool toggles)
 
void doPresent () const
 
void addWhisper (const std::string &nick, const std::string &mes, const ChatMsgTypeT own)
 
WhisperTabaddWhisperTab (const std::string &caption, const std::string &nick, const bool switchTo)
 
WhisperTabgetWhisperTab (const std::string &nick) const
 
ChatTabaddChannelTab (const std::string &name, const bool switchTo)
 
ChatTabaddSpecialChannelTab (const std::string &name, const bool switchTo)
 
ChatTabaddChatTab (const std::string &name, const bool switchTo, const bool join)
 
void joinRoom (const bool isJoin)
 
void removeAllWhispers ()
 
void removeAllChannels ()
 
void ignoreAllWhispers ()
 
bool resortChatLog (std::string line, ChatMsgTypeT own, const std::string &channel, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
 
void channelChatLog (const std::string &channel, const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
 
void updateOnline (const std::set< std::string > &onlinePlayers) const
 
void loadState ()
 
void saveState () const
 
bool saveTab (const int num, const ChatTab *const tab) const
 
void loadCustomList ()
 
void loadGMCommands ()
 
void adjustTabSize ()
 
void addToAwayLog (const std::string &line)
 
void displayAwayLog () const
 
void clearAwayLog ()
 
void parseHighlights ()
 
void parseGlobalsFilter ()
 
bool findHighlight (const std::string &str)
 
void copyToClipboard (const int x, const int y) const
 
void optionChanged (const std::string &name)
 
void mouseEntered (MouseEvent &event)
 
void mouseMoved (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void updateVisibility ()
 
void unHideWindow ()
 
void widgetResized (const Event &event)
 
void addGlobalMessage (const std::string &line)
 
void postInit ()
 
bool isTabPresent (const ChatTab *const tab) const
 
void selectTabByType (const ChatTabTypeT &type)
 
void attributeChanged (const AttributesT id, const int64_t oldVal, const int64_t newVal)
 
void postConnection ()
 
void showGMTab ()
 
void debugMessage (const std::string &msg)
 
void scheduleDelete ()
 
- Public Member Functions inherited from Window
 Window (const std::string &caption, const Modal modal, Window *const parent, std::string skin)
 
 ~Window ()
 
void setContentSize (int width, int height)
 
void setLocationRelativeTo (const Widget *const widget)
 
void setLocationHorisontallyRelativeTo (const Widget *const widget)
 
void setLocationRelativeTo (const ImagePosition::Type &position, int offsetX, int offsetY)
 
void setResizable (const bool resize)
 
void redraw ()
 
void widgetMoved (const Event &event)
 
void widgetHidden (const Event &event)
 
void setCloseButton (const bool flag)
 
bool getCloseButton () const
 
void setAllowClose (const bool b)
 
bool getAlowClose () const
 
bool isResizable () const
 
void setMinWidth (const int width)
 
int getMinWidth () const
 
void setMinHeight (const int height)
 
int getMinHeight () const
 
void setMaxWidth (const int width)
 
int getMaxWidth () const
 
void setMaxHeight (const int height)
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 
void setStickyButton (const bool flag)
 
void setSticky (const bool sticky)
 
bool isSticky () const
 
void setStickyButtonLock (const bool sticky)
 
bool isStickyButtonLock () const
 
void setVisible (const Visible visible, const bool forceSticky)
 
bool isDefaultVisible () const
 
void setDefaultVisible (const bool save)
 
bool willSaveVisible () const
 
void setSaveVisible (const bool save)
 
WindowgetParentWindow () const
 
void mouseReleased (MouseEvent &event)
 
void updateResizeHandler (MouseEvent &event)
 
void setWindowName (const std::string &name)
 
const std::string & getWindowName () const
 
void loadWindowState ()
 
void saveWindowState ()
 
void setDefaultSize (const int defaultX, const int defaultY, int defaultWidth, int defaultHeight)
 
void setDefaultSize ()
 
void setDefaultSize (const int defaultWidth, const int defaultHeight, const ImagePosition::Type &position, const int offsetx, const int offsetY)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w, int h)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w, const int h)
 
ContainerPlacer getPlacer (const int x, const int y)
 
void center ()
 
void centerHorisontally ()
 
virtual void close ()
 
void setModal (const Modal modal)
 
Rect getWindowArea () const
 
bool isResizeAllowed (const MouseEvent &event) const
 
void setCaptionFont (Font *font)
 
void enableVisibleSound (bool b)
 
bool isWindowVisible () const
 
void setPadding (int padding)
 
int getPadding () const
 
void setTitleBarHeight (unsigned int height)
 
unsigned int getTitleBarHeight () const
 
void setCaption (const std::string &caption)
 
const std::string & getCaption () const
 
void setAlignment (Graphics::Alignment alignment)
 
Graphics::Alignment getAlignment () const
 
void setMovable (Move movable)
 
bool isMovable () const
 
Rect getChildrenArea ()
 
virtual void resizeToContent ()
 
- Public Member Functions inherited from BasicContainer2
 BasicContainer2 (const Widget2 *const widget)
 
 ~BasicContainer2 ()
 
void setOpaque (Opaque opaque)
 
bool isOpaque () const
 
virtual void add (Widget *const widget)
 
void addXY (Widget *const widget, const int x, const int y)
 
- Public Member Functions inherited from BasicContainer
 BasicContainer (const Widget2 *const widget)
 
 ~BasicContainer ()
 
void showWidgetPart (Widget *const widget, const Rect &area)
 
void moveToTop (Widget *const widget)
 
void moveToBottom (Widget *const widget)
 
void focusNext ()
 
void focusPrevious ()
 
void logic ()
 
void setFocusHandler (FocusHandler *const focusHandler)
 
void setInternalFocusHandler (FocusHandler *const focusHandler)
 
WidgetgetWidgetAt (int x, int y)
 
void death (const Event &event)
 
WidgetfindFirstWidget (const std::set< Widget *> &list)
 
void add (Widget *const widget)
 
virtual void remove (Widget *const widget)
 
virtual void clear ()
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
 ~Widget ()
 
virtual void drawFrame (Graphics *graphics)
 
virtual void safeDrawFrame (Graphics *graphics)
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
virtual void setParent (Widget *parent)
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 
- Public Member Functions inherited from WidgetDeathListener
virtual ~WidgetDeathListener ()
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetShown (const Event &event)
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 
- Public Member Functions inherited from KeyListener
virtual ~KeyListener ()
 
virtual void keyReleased (KeyEvent &event)
 
- Public Member Functions inherited from ConfigListener
 ConfigListener ()
 
virtual ~ConfigListener ()
 
- Public Member Functions inherited from AttributeListener
 AttributeListener ()
 
virtual ~ AttributeListener ()
 
- Public Member Functions inherited from DebugMessageListener
 DebugMessageListener ()
 
virtual ~ DebugMessageListener ()
 

Static Public Member Functions

static void clearTab (ChatTab *const tab)
 
static void battleChatLog (const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
 
static std::string doReplace (const std::string &msg)
 
- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *const windowContainer)
 
- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Static Public Member Functions inherited from AttributeListener
static void distributeEvent (const AttributesT id, const int64_t oldVal, const int64_t newVal)
 
static void addListener (AttributeListener *const listener)
 
static void removeListener (const AttributeListener *const listener)
 
- Static Public Member Functions inherited from DebugMessageListener
static void distributeEvent (const std::string &msg)
 
static void addListener (DebugMessageListener *const listener)
 
static void removeListener (const DebugMessageListener *const listener)
 

Protected Types

typedef std::list< std::string > History
 
- Protected Types inherited from BasicContainer
typedef std::vector< Widget * > WidgetList
 
typedef WidgetList::iterator WidgetListIterator
 
typedef WidgetList::const_iterator WidgetListConstIterator
 
typedef WidgetList::reverse_iterator WidgetListReverseIterator
 
typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 

Protected Member Functions

void removeTab (ChatTab *const tab)
 
void addTab (ChatTab *const tab)
 
void removeWhisper (const std::string &nick)
 
void removeChannel (const std::string &nick)
 
void autoComplete ()
 
std::string addColors (std::string &msg)
 
std::string autoCompleteHistory (const std::string &partName) const
 
std::string autoComplete (const std::string &partName, const History *const words) const
 
void initTradeFilter ()
 
void toggleChatFocus ()
 
- Protected Member Functions inherited from Window
bool canMove () const
 
int getOption (const std::string &name, const int def) const
 
bool getOptionBool (const std::string &name, const bool def) const
 
void setTitlePadding (const int p)
 
int getTitlePadding () const
 
- Protected Member Functions inherited from BasicContainer
virtual void drawChildren (Graphics *const graphics)
 
virtual void safeDrawChildren (Graphics *const graphics)
 
virtual void logicChildren ()
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from WidgetDeathListener
 WidgetDeathListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- Protected Member Functions inherited from ActionListener
 ActionListener ()
 
- Protected Member Functions inherited from KeyListener
 KeyListener ()
 

Static Protected Member Functions

static std::string autoComplete (const StringVect &names, std::string partName)
 

Protected Attributes

ItemLinkHandlermItemLinkHandler
 
TabbedAreamChatTabs
 
ChatInputmChatInput
 
unsigned int mRainbowColor
 
- Protected Attributes inherited from Window
std::string mCaption
 
Graphics::Alignment mAlignment
 
int mPadding
 
unsigned int mTitleBarHeight
 
Move mMovable
 
int mDragOffsetX
 
int mDragOffsetY
 
bool mMoved
 
SkinmSkin
 
int mDefaultX
 
int mDefaultY
 
int mDefaultWidth
 
int mDefaultHeight
 
int mCaptionOffsetX
 
int mCaptionOffsetY
 
bool mShowTitle
 
bool mLastRedraw
 
- Protected Attributes inherited from BasicContainer2
Opaque mOpaque
 
- Protected Attributes inherited from BasicContainer
WidgetList mWidgets
 
WidgetList mLogicWidgets
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 

Private Types

typedef std::map< const std::string, WhisperTab * > TabMap
 
typedef std::map< const std::string, ChannelTab * > ChannelMap
 
typedef History::iterator HistoryIterator
 
typedef std::list< std::string > ChatCommands
 
typedef ChatCommands::iterator ChatCommandsIterator
 

Private Member Functions

void fillCommands ()
 
void loadCommandsFile (const std::string &name)
 
void updateTabsMargin ()
 
bool addCurrentToHistory ()
 

Private Attributes

TabMap mWhispers
 
ChannelMap mChannels
 
History mHistory
 
HistoryIterator mCurHist
 
History mCommands
 
History mCustomWords
 
StringVect mTradeFilter
 
ColorListModelmColorListModel
 
DropDownmColorPicker
 
ButtonmChatButton
 
std::list< std::string > mAwayLog
 
StringVect mHighlights
 
StringVect mGlobalsFilter
 
int mChatColor
 
int mEmoteButtonSpacing
 
int mEmoteButtonY
 
unsigned int mChatHistoryIndex
 
bool mReturnToggles
 
bool mGMLoaded
 
bool mHaveMouse
 
bool mAutoHide
 
bool mShowBattleEvents
 
bool mShowAllLang
 
bool mEnableTradeFilter
 
bool mTmpVisible
 

Friends

class ChannelTab
 
class ChatTab
 
class WhisperTab
 
class PopupMenu
 

Additional Inherited Members

- Data Fields inherited from Widget
Visible mVisible
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

The chat window.

Definition at line 54 of file chatwindow.h.

Member Typedef Documentation

◆ ChannelMap

typedef std::map<const std::string, ChannelTab*> ChatWindow::ChannelMap
private

Definition at line 364 of file chatwindow.h.

◆ ChatCommands

typedef std::list<std::string> ChatWindow::ChatCommands
private

Definition at line 374 of file chatwindow.h.

◆ ChatCommandsIterator

typedef ChatCommands::iterator ChatWindow::ChatCommandsIterator
private

Definition at line 375 of file chatwindow.h.

◆ History

typedef std::list<std::string> ChatWindow::History
protected

Definition at line 315 of file chatwindow.h.

◆ HistoryIterator

typedef History::iterator ChatWindow::HistoryIterator
private

Definition at line 370 of file chatwindow.h.

◆ TabMap

typedef std::map<const std::string, WhisperTab*> ChatWindow::TabMap
private

Definition at line 363 of file chatwindow.h.

Constructor & Destructor Documentation

◆ ChatWindow()

ChatWindow::ChatWindow ( const std::string &  name)
explicit

Constructor.

Definition at line 93 of file chatwindow.cpp.

References ACTION_COLOR_PICKER, Widget::addActionListener(), Widget::addKeyListener(), Configuration::addListener(), EmoteWindow::addListeners(), Button::adjustSize(), config, emoteWindow, TabbedArea::enableScrollButtons(), Window::enableVisibleSound(), fillCommands(), fromBool, Configuration::getBoolValue(), Graphics::getHeight(), Window::getPadding(), Window::getTitlePadding(), Widget::getWidth(), Graphics::getWidth(), initTradeFilter(), Being::isGM(), loadCustomList(), loadGMCommands(), Window::loadWindowState(), localPlayer, ImagePosition::LOWER_LEFT, mainGraphics, mChatButton, mChatColor, mChatInput, mChatTabs, mColorPicker, mCurHist, mHistory, mItemLinkHandler, Window::mPadding, parseGlobalsFilter(), parseHighlights(), SetupWindow::registerWindowForReset(), Widget::setActionEventId(), ItemLinkHandler::setAllowCommands(), TextField::setAllowSpecialActions(), Window::setDefaultSize(), Window::setDefaultVisible(), TabbedArea::setFollowDownScroll(), Window::setMinHeight(), Window::setMinWidth(), Widget::setPosition(), Window::setResizable(), TabbedArea::setResizeHeight(), Window::setSaveVisible(), DropDown::setSelected(), Window::setShowTitle(), Window::setStickyButtonLock(), Window::setTitleBarHeight(), setupWindow, Widget::setVisible(), Window::setWindowName(), updateTabsMargin(), and ImagePosition::UPPER_LEFT.

93  :
94  // TRANSLATORS: chat window name
95  Window(_("Chat"), Modal_false, nullptr, "chat.xml"),
97  KeyListener(),
101  mChatInput(new ChatInput(this)),
102  mRainbowColor(0U),
103  mWhispers(),
104  mChannels(),
105  mHistory(),
106  mCurHist(),
107  mCommands(),
108  mCustomWords(),
109  mTradeFilter(),
112  false, Modal_false, nullptr, std::string())),
113  mChatButton(new Button(this, ":)", "openemote", BUTTON_SKIN, this)),
114  mAwayLog(),
115  mHighlights(),
116  mGlobalsFilter(),
117  mChatColor(config.getIntValue("chatColor")),
118  mEmoteButtonSpacing(mSkin != nullptr ?
119  mSkin->getOption("emoteButtonSpacing", 2) : 2),
120  mEmoteButtonY(mSkin != nullptr ?
121  mSkin->getOption("emoteButtonY", -2) : -2),
123  mReturnToggles(config.getBoolValue("ReturnToggles")),
124  mGMLoaded(false),
125  mHaveMouse(false),
126  mAutoHide(config.getBoolValue("autohideChat")),
127  mShowBattleEvents(config.getBoolValue("showBattleEvents")),
128  mShowAllLang(serverConfig.getValue("showAllLang", 0) != 0),
129  mEnableTradeFilter(config.getBoolValue("enableTradeFilter")),
130  mTmpVisible(false)
131 {
132  setWindowName(name);
133 
134  if (setupWindow != nullptr)
136 
137  setShowTitle(false);
138  setResizable(true);
139  setDefaultVisible(true);
140  setSaveVisible(true);
141  setStickyButtonLock(true);
142 
143  int w = 600;
144 #ifdef ANDROID
145  if (mainGraphics->getWidth() < 710)
146  w = mainGraphics->getWidth() - 110;
147  if (w < 100)
148  w = 100;
149  if (mainGraphics->getHeight() < 480)
150  setDefaultSize(w, 90, ImagePosition::UPPER_LEFT, -110, -35);
151  else
152  setDefaultSize(w, 123, ImagePosition::UPPER_LEFT, -110, -35);
153 #else // ANDROID
154 
155  if (mainGraphics->getWidth() < 600)
156  w = mainGraphics->getWidth() - 10;
157  if (w < 100)
158  w = 100;
160 #endif // ANDROID
161 
162  setMinWidth(150);
163  setMinHeight(90);
164 
166 
167  if (emoteWindow != nullptr)
168  emoteWindow->addListeners(this);
169 
171 
174  mChatTabs->setResizeHeight(false);
175 
176  mChatInput->setActionEventId("chatinput");
179 
183 
185 
186  loadWindowState();
187 
189  - 2 * mPadding - 8 - 16, mPadding);
190 
191  // Add key listener to chat input to be able to respond to up/down
192  mChatInput->addKeyListener(this);
193  mCurHist = mHistory.end();
195  "showChatColorsList"), Visible));
197 
198  fillCommands();
199  if ((localPlayer != nullptr) && localPlayer->isGM())
200  loadGMCommands();
201  initTradeFilter();
202  loadCustomList();
203  parseHighlights();
205 
206  config.addListener("autohideChat", this);
207  config.addListener("showBattleEvents", this);
208  config.addListener("globalsFilter", this);
209  config.addListener("enableTradeFilter", this);
210 
211  enableVisibleSound(true);
212 }
void setDefaultSize()
Definition: window.cpp:1193
#define _(s)
Definition: gettext.h:34
unsigned int mRainbowColor
Definition: chatwindow.h:352
void setDefaultVisible(const bool save)
Definition: window.h:287
int getWidth() const
Definition: widget.h:220
Skin * mSkin
Definition: window.h:648
int mPadding
Definition: window.h:617
void loadGMCommands()
Definition: chatwindow.cpp:259
void loadWindowState()
Definition: window.cpp:1082
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
int mEmoteButtonSpacing
Definition: chatwindow.h:388
StringVect mGlobalsFilter
Definition: chatwindow.h:386
void setVisible(Visible visible)
Definition: widget.cpp:224
Button * mChatButton
Definition: chatwindow.h:383
DropDown * mColorPicker
Definition: chatwindow.h:382
void setMinWidth(const int width)
Definition: window.cpp:586
Definition: button.h:96
History mCustomWords
Definition: chatwindow.h:377
void setShowTitle(bool flag)
Definition: window.h:234
Configuration config
void loadCustomList()
int getIntValue(const std::string &key) const
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
Configuration serverConfig
void fillCommands()
Definition: chatwindow.cpp:253
bool mShowBattleEvents
Definition: chatwindow.h:396
int getWidth() const
Definition: graphics.cpp:642
void addListener(const std::string &key, ConfigListener *const listener)
void enableScrollButtons(const bool enable)
Definition: tabbedarea.cpp:149
int getOption(const std::string &name) const
Definition: skin.h:105
void registerWindowForReset(Window *const window)
void adjustSize()
Definition: button.cpp:798
StringVect mTradeFilter
Definition: chatwindow.h:379
void addListeners(ActionListener *const listener)
void parseGlobalsFilter()
TabbedArea * mChatTabs
Definition: chatwindow.h:343
int getTitlePadding() const
Definition: window.h:601
bool getBoolValue(const std::string &key) const
void updateTabsMargin()
Definition: chatwindow.cpp:268
bool mReturnToggles
Definition: chatwindow.h:391
const std::string BUTTON_SKIN
Definition: button.h:88
StringVect mHighlights
Definition: chatwindow.h:385
EmoteWindow * emoteWindow
Definition: emotewindow.cpp:48
#define fromBool(val, name)
Definition: booldefines.h:48
LocalPlayer * localPlayer
int getHeight() const
Definition: graphics.cpp:647
bool mAutoHide
Definition: chatwindow.h:395
Graphics * mainGraphics
Definition: graphics.cpp:108
int mEmoteButtonY
Definition: chatwindow.h:389
std::list< std::string > mAwayLog
Definition: chatwindow.h:384
void initTradeFilter()
void setPosition(const int x, const int y)
Definition: widget.cpp:160
void addKeyListener(KeyListener *const keyListener)
Definition: widget.cpp:271
void enableVisibleSound(bool b)
Definition: window.h:480
void setMinHeight(const int height)
Definition: window.cpp:599
ChannelMap mChannels
Definition: chatwindow.h:368
void setSaveVisible(const bool save)
Definition: window.h:299
std::string getValue(const std::string &key, const std::string &deflt) const
void setFollowDownScroll(const bool n)
Definition: tabbedarea.h:210
bool Visible
Definition: visible.h:29
HistoryIterator mCurHist
Definition: chatwindow.h:372
void parseHighlights()
void setAllowSpecialActions(const bool b)
Definition: textfield.h:203
History mCommands
Definition: chatwindow.h:376
ItemLinkHandler * mItemLinkHandler
Definition: chatwindow.h:340
void setAllowCommands(const bool b)
bool mHaveMouse
Definition: chatwindow.h:394
History mHistory
Definition: chatwindow.h:371
bool mEnableTradeFilter
Definition: chatwindow.h:398
void setResizable(const bool resize)
Definition: window.cpp:622
bool mTmpVisible
Definition: chatwindow.h:399
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:767
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
ColorListModel * mColorListModel
Definition: chatwindow.h:381
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void setTitleBarHeight(unsigned int height)
Definition: window.h:512
int mChatColor
Definition: chatwindow.h:387
bool mShowAllLang
Definition: chatwindow.h:397
bool mGMLoaded
Definition: chatwindow.h:393
void setSelected(int selected)
Definition: dropdown.cpp:514
Window(const std::string &caption, const Modal modal, Window *const parent, std::string skin)
Definition: window.cpp:108
ChatInput * mChatInput
Definition: chatwindow.h:346
unsigned int mChatHistoryIndex
Definition: chatwindow.h:390
int getPadding() const
Definition: window.h:503
bool isGM() const
Definition: being.h:658
static const char *const ACTION_COLOR_PICKER
Definition: chatwindow.cpp:91
void setResizeHeight(bool b)
Definition: tabbedarea.h:231
void setWindowName(const std::string &name)
Definition: window.h:354
TabMap mWhispers
Definition: chatwindow.h:367

◆ ~ChatWindow()

ChatWindow::~ChatWindow ( )

Destructor: used to write back values to the config file

Definition at line 214 of file chatwindow.cpp.

References CHECKLISTENERS, config, delete2, mColorListModel, mColorPicker, mItemLinkHandler, mReturnToggles, removeAllChannels(), removeAllWhispers(), Configuration::removeListeners(), saveState(), and Configuration::setValue().

215 {
216  config.removeListeners(this);
218  saveState();
219  config.setValue("ReturnToggles", mReturnToggles);
225 }
DropDown * mColorPicker
Definition: chatwindow.h:382
Configuration config
#define delete2(var)
Definition: delete2.h:24
bool mReturnToggles
Definition: chatwindow.h:391
void saveState() const
void removeListeners(ConfigListener *const listener)
void removeAllChannels()
Definition: chatwindow.cpp:624
ItemLinkHandler * mItemLinkHandler
Definition: chatwindow.h:340
void removeAllWhispers()
Definition: chatwindow.cpp:608
#define CHECKLISTENERS
Definition: localconsts.h:268
ColorListModel * mColorListModel
Definition: chatwindow.h:381
void setValue(const std::string &key, const std::string &value)

Member Function Documentation

◆ action()

void ChatWindow::action ( const ActionEvent event)
virtual

Performs action.

Implements ActionListener.

Definition at line 434 of file chatwindow.cpp.

References ACTION_COLOR_PICKER, addColors(), addInputText(), chatInput(), EmoteWindow::clearColor(), EmoteWindow::clearEmote(), EmoteWindow::clearFont(), EmoteWindow::clearText(), config, emoteWindow, FocusHandler::focusNone(), fromBool, Configuration::getBoolValue(), TextDb::getByIndex(), DropDown::getSelected(), EmoteWindow::getSelectedColor(), EmoteWindow::getSelectedEmote(), EmoteWindow::getSelectedFont(), EmoteWindow::getSelectedTextIndex(), PoDict::getStr(), TextField::getText(), EmoteWindow::hide(), mChatColor, mChatInput, mColorPicker, mCurHist, Widget::mFocusHandler, mHistory, mReturnToggles, mTmpVisible, Widget::mVisible, reverseDictionary, TextField::setText(), Configuration::setValue(), setVisible(), Widget::setVisible(), EmoteWindow::show(), ServerCommandType::str, ChatInput::unprotectFocus(), Visible_false, and Visible_true.

435 {
436  const std::string &eventId = event.getId();
437  if (eventId == "chatinput")
438  {
439  std::string message = mChatInput->getText();
440 
441  if (!message.empty())
442  {
443  // If message different from previous, put it in the history
444  if (mHistory.empty() || message != mHistory.back())
445  mHistory.push_back(message);
446 
447  // Reset history iterator
448  mCurHist = mHistory.end();
449 
450  // Send the message to the server
451  chatInput(addColors(message));
452 
453  // Clear the text from the chat input
454  mChatInput->setText("");
455  }
456 
457  if (message.empty() || !mReturnToggles)
458  {
459  // Remove focus and hide input
461  if (mFocusHandler != nullptr)
463 
464  // If the chatWindow is shown up because you want to send a message
465  // It should hide now
466  if (mTmpVisible)
468  }
469  }
470  else if (eventId == "emote")
471  {
472  if (emoteWindow != nullptr)
473  {
474  const std::string str = emoteWindow->getSelectedEmote();
475  if (!str.empty())
476  {
477  addInputText(str, false);
479  }
480  }
481  }
482  else if (eventId == "openemote")
483  {
484  if (emoteWindow != nullptr)
485  {
487  emoteWindow->hide();
488  else
489  emoteWindow->show();
490  }
491  }
492  else if (eventId == "color")
493  {
494  if (emoteWindow != nullptr)
495  {
496  const std::string str = emoteWindow->getSelectedColor();
497  if (!str.empty())
498  {
499  addInputText(str, false);
501  }
502  }
503  }
504  else if (eventId == "font")
505  {
506  if (emoteWindow != nullptr)
507  {
508  const std::string str = emoteWindow->getSelectedFont();
509  if (!str.empty())
510  {
511  addInputText(str, false);
513  }
514  }
515  }
516  else if (eventId == "text")
517  {
518  if ((emoteWindow != nullptr) && (reverseDictionary != nullptr))
519  {
520  const int idx = emoteWindow->getSelectedTextIndex();
521  if (idx >= 0)
522  {
523  const std::string str = TextDb::getByIndex(idx);
524  const std::string enStr = reverseDictionary->getStr(str);
525  addInputText(enStr, false);
526  }
528  }
529  }
530  else if (eventId == ACTION_COLOR_PICKER)
531  {
532  if (mColorPicker != nullptr)
533  {
535  config.setValue("chatColor", mChatColor);
536  }
537  }
538 
539  if (mColorPicker != nullptr)
540  {
541  const Visible vis = fromBool(config.getBoolValue(
542  "showChatColorsList"), Visible);
543  if (mColorPicker->mVisible != vis)
544  mColorPicker->setVisible(vis);
545  }
546 }
void clearText()
void setVisible(Visible visible)
void clearColor()
void unprotectFocus()
Definition: chatinput.h:93
const bool Visible_true
Definition: visible.h:29
void setVisible(Visible visible)
Definition: widget.cpp:224
DropDown * mColorPicker
Definition: chatwindow.h:382
Configuration config
FocusHandler * mFocusHandler
Definition: widget.h:1115
void setText(const std::string &text)
Definition: textfield.cpp:802
void chatInput(const std::string &msg) const
Definition: chatwindow.cpp:660
Visible mVisible
Definition: widget.h:962
void clearFont()
bool getBoolValue(const std::string &key) const
bool mReturnToggles
Definition: chatwindow.h:391
PoDict * reverseDictionary
Definition: podict.cpp:29
void clearEmote()
const bool Visible_false
Definition: visible.h:29
EmoteWindow * emoteWindow
Definition: emotewindow.cpp:48
#define fromBool(val, name)
Definition: booldefines.h:48
std::string getSelectedEmote() const
std::string addColors(std::string &msg)
std::string getSelectedFont() const
bool Visible
Definition: visible.h:29
HistoryIterator mCurHist
Definition: chatwindow.h:372
std::string getByIndex(const int index)
Definition: textdb.cpp:96
History mHistory
Definition: chatwindow.h:371
bool mTmpVisible
Definition: chatwindow.h:399
int getSelectedTextIndex() const
int mChatColor
Definition: chatwindow.h:387
const std::string getStr(const std::string &str)
Definition: podict.cpp:44
void setValue(const std::string &key, const std::string &value)
ChatInput * mChatInput
Definition: chatwindow.h:346
const std::string & getText() const
Definition: textfield.h:223
int getSelected() const
Definition: dropdown.cpp:509
static const char *const ACTION_COLOR_PICKER
Definition: chatwindow.cpp:91
void addInputText(const std::string &text, const bool space)
std::string getSelectedColor() const

◆ addChannelTab()

ChatTab * ChatWindow::addChannelTab ( const std::string &  name,
const bool  switchTo 
)

Definition at line 1298 of file chatwindow.cpp.

References addSpecialChannelTab(), ChannelTab, config, Configuration::getBoolValue(), ChatTab::loadFromLogFile(), mChannels, mChatTabs, ChatTab::setAllowHighlight(), TabbedArea::setSelectedTab(), and Catch::toLower().

Referenced by addChatTab(), channelChatLog(), EAthena::ChatRecv::processColorChat(), EAthena::ChatRecv::processJoinChannel(), and setReturnTogglesChat().

1300 {
1301  std::string tempName = name;
1302  toLower(tempName);
1303 
1304  ChatTab *const tab = addSpecialChannelTab(name, switchTo);
1305  if (tab != nullptr)
1306  return tab;
1307 
1308  const ChannelMap::const_iterator i = mChannels.find(tempName);
1309  ChannelTab *ret = nullptr;
1310 
1311  if (i != mChannels.end())
1312  {
1313  ret = i->second;
1314  }
1315  else
1316  {
1317  ret = new ChannelTab(this, name);
1318  mChannels[tempName] = ret;
1319  ret->setAllowHighlight(false);
1320  if (config.getBoolValue("showChatHistory"))
1321  ret->loadFromLogFile(name);
1322  }
1323 
1324  if (switchTo)
1325  mChatTabs->setSelectedTab(ret);
1326 
1327  return ret;
1328 }
Configuration config
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:406
friend class ChannelTab
Definition: chatwindow.h:310
void loadFromLogFile(const std::string &name)
Definition: chattab.cpp:509
TabbedArea * mChatTabs
Definition: chatwindow.h:343
bool getBoolValue(const std::string &key) const
ChatTab * addSpecialChannelTab(const std::string &name, const bool switchTo)
std::string toLower(std::string const &s)
ChannelMap mChannels
Definition: chatwindow.h:368
void setAllowHighlight(const bool n)
Definition: chattab.h:160

◆ addChatTab()

ChatTab * ChatWindow::addChatTab ( const std::string &  name,
const bool  switchTo,
const bool  join 
)

Definition at line 1330 of file chatwindow.cpp.

References addChannelTab(), addWhisperTab(), chatHandler, Net::getNetworkType(), Net::ChatHandler::joinChannel(), and ServerType::TMWATHENA.

Referenced by loadState(), setReturnTogglesChat(), and Actions::splitWhisper().

1333 {
1335  name.size() > 1 &&
1336  name[0] == '#')
1337  {
1338  ChatTab *const tab = addChannelTab(name, switchTo);
1339  if ((tab != nullptr) && join)
1340  chatHandler->joinChannel(name);
1341  return tab;
1342  }
1343  return addWhisperTab(name, name, switchTo);
1344 }
ChatTab * addChannelTab(const std::string &name, const bool switchTo)
WhisperTab * addWhisperTab(const std::string &caption, const std::string &nick, const bool switchTo)
ServerTypeT getNetworkType()
Definition: net.cpp:182
Net::ChatHandler * chatHandler
Definition: net.cpp:82
virtual void joinChannel(const std::string &channel) const =0

◆ addColors()

std::string ChatWindow::addColors ( std::string &  msg)
protected

Definition at line 1391 of file chatwindow.cpp.

References changeColor, mChatColor, mRainbowColor, Actions::msg(), and Catch::toString().

Referenced by action().

1392 {
1393  // default color or chat command
1394  if (mChatColor == 0 || msg.length() == 0 || msg.at(0) == '#'
1395  || msg.at(0) == '/' || msg.at(0) == '@' || msg.at(0) == '!')
1396  {
1397  return msg;
1398  }
1399 
1400  std::string newMsg;
1401  const int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8};
1402 
1403  // rainbow
1404  switch (mChatColor)
1405  {
1406  case 11:
1408  return newMsg;
1409  case 12:
1410  changeColor(cMap[mRainbowColor++])
1411  return newMsg;
1412  case 13:
1413  changeColor(cMap[9-mRainbowColor++])
1414  return newMsg;
1415  default:
1416  break;
1417  }
1418 
1419  // simple colors
1420  return std::string("##").append(toString(mChatColor - 1)).append(msg);
1421 }
unsigned int mRainbowColor
Definition: chatwindow.h:352
bool msg(InputEvent &event)
Definition: chat.cpp:38
#define changeColor(fun)
int mChatColor
Definition: chatwindow.h:387

◆ addCurrentToHistory()

bool ChatWindow::addCurrentToHistory ( )
private

Definition at line 993 of file chatwindow.cpp.

References FOR_EACH, TextField::getText(), mChatInput, mHistory, and ServerCommandType::str.

Referenced by keyPressed().

994 {
995  const std::string &str = mChatInput->getText();
996  if (str.empty())
997  return false;
999  {
1000  if (*it == str)
1001  return false;
1002  }
1003  mHistory.push_back(str);
1004  return true;
1005 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
History::iterator HistoryIterator
Definition: chatwindow.h:370
History mHistory
Definition: chatwindow.h:371
ChatInput * mChatInput
Definition: chatwindow.h:346
const std::string & getText() const
Definition: textfield.h:223

◆ addGlobalMessage()

void ChatWindow::addGlobalMessage ( const std::string &  line)

Definition at line 2141 of file chatwindow.cpp.

References ChatMsgType::BY_GM, ChatMsgType::BY_OTHER, ChatTab::chatLog(), debugChatTab, findI(), IgnoreRecord_false, localChatTab, mGlobalsFilter, and TryRemoveColors_true.

Referenced by clearAwayLog(), TmwAthena::ChatRecv::processGmChat(), EAthena::ChatRecv::processGmChat(), and EAthena::ChatRecv::processGmChat2().

2142 {
2143  if (debugChatTab != nullptr &&
2144  findI(line, mGlobalsFilter) != std::string::npos)
2145  {
2146  debugChatTab->chatLog(line,
2150  }
2151  else
2152  {
2153  localChatTab->chatLog(line,
2157  }
2158 }
ChatTab * localChatTab
Definition: chattab.cpp:61
StringVect mGlobalsFilter
Definition: chatwindow.h:386
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
ChatTab * debugChatTab
Definition: chattab.cpp:62
size_t findI(std::string str, std::string subStr)

◆ addInputText()

void ChatWindow::addInputText ( const std::string &  text,
const bool  space 
)

Add the given text to the chat input.

Definition at line 1067 of file chatwindow.cpp.

References CAST_S32, TextField::getCaretPosition(), TextField::getText(), mChatInput, requestChatFocus(), TextField::setCaretPosition(), and TextField::setText().

Referenced by StatusWindow::action(), action(), addItemText(), Actions::changeRelation(), Actions::doSit(), WhoIsOnline::handleLink(), keyPressed(), and Actions::splitWhisper().

1069 {
1070  const int caretPos = mChatInput->getCaretPosition();
1071  const std::string &inputText = mChatInput->getText();
1072 
1073  std::ostringstream ss;
1074  ss << inputText.substr(0, caretPos) << text;
1075  if (space)
1076  ss << " ";
1077 
1078  ss << inputText.substr(caretPos);
1079  mChatInput->setText(ss.str());
1080  mChatInput->setCaretPosition(caretPos + CAST_S32(
1081  text.length()) + CAST_S32(space));
1082  requestChatFocus();
1083 }
void setCaretPosition(unsigned int position)
Definition: textfield.cpp:751
void setText(const std::string &text)
Definition: textfield.cpp:802
#define CAST_S32
Definition: cast.h:29
bool requestChatFocus()
Definition: chatwindow.cpp:548
unsigned int getCaretPosition() const
Definition: textfield.h:233
ChatInput * mChatInput
Definition: chatwindow.h:346
const std::string & getText() const
Definition: textfield.h:223

◆ addItemText()

void ChatWindow::addItemText ( const std::string &  item)

Called to add item to chat

Definition at line 1085 of file chatwindow.cpp.

References addInputText().

Referenced by Actions::changeRelation(), and ItemContainer::mousePressed().

1086 {
1087  std::ostringstream text;
1088  text << "[" << item << "]";
1089  addInputText(text.str(),
1090  true);
1091 }
void addInputText(const std::string &text, const bool space)

◆ addSpecialChannelTab()

ChatTab * ChatWindow::addSpecialChannelTab ( const std::string &  name,
const bool  switchTo 
)

Definition at line 1269 of file chatwindow.cpp.

References chatHandler, ChatTab::getChannelName(), GM_CHANNEL, gmChatTab, Net::ChatHandler::joinChannel(), mChatTabs, ChatTab::setAllowHighlight(), TabbedArea::setSelectedTab(), TRADE_CHANNEL, and tradeChatTab.

Referenced by addChannelTab(), createGuiWindows(), setReturnTogglesChat(), and showGMTab().

1271 {
1272  ChatTab *ret = nullptr;
1273  if (name == TRADE_CHANNEL)
1274  {
1275  if (tradeChatTab == nullptr)
1276  {
1280  }
1281  ret = tradeChatTab;
1282  }
1283  else if (name == GM_CHANNEL)
1284  {
1285  if (gmChatTab == nullptr)
1286  {
1287  gmChatTab = new GmTab(chatWindow);
1289  }
1290  ret = gmChatTab;
1291  }
1292  if (switchTo)
1293  mChatTabs->setSelectedTab(ret);
1294 
1295  return ret;
1296 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:89
TradeTab * tradeChatTab
Definition: tradetab.cpp:35
const std::string & getChannelName() const
Definition: chattab.h:182
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:406
TabbedArea * mChatTabs
Definition: chatwindow.h:343
const std::string GM_CHANNEL
Definition: chat.h:29
Definition: gmtab.h:29
GmTab * gmChatTab
Definition: gmtab.cpp:33
Net::ChatHandler * chatHandler
Definition: net.cpp:82
const std::string TRADE_CHANNEL
Definition: chat.h:30
void setAllowHighlight(const bool n)
Definition: chattab.h:160
virtual void joinChannel(const std::string &channel) const =0

◆ addTab()

void ChatWindow::addTab ( ChatTab *const  tab)
protected

Add the tab to the window

Definition at line 584 of file chatwindow.cpp.

References TabbedArea::addTab(), BasicContainer::logic(), mChatTabs, and ChatTab::mScrollArea.

Referenced by ChatTab::ChatTab().

585 {
586  if (tab == nullptr)
587  return;
588 
589  mChatTabs->addTab(tab, tab->mScrollArea);
590  logic();
591 }
ScrollArea * mScrollArea
Definition: chattab.h:207
TabbedArea * mChatTabs
Definition: chatwindow.h:343
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:237

◆ addToAwayLog()

void ChatWindow::addToAwayLog ( const std::string &  line)

Definition at line 1980 of file chatwindow.cpp.

References Settings::awayMode, findI(), mAwayLog, mHighlights, and settings.

Referenced by ChatTab::chatLog(), and setReturnTogglesChat().

1981 {
1982  if (!settings.awayMode)
1983  return;
1984 
1985  if (mAwayLog.size() > 20)
1986  mAwayLog.pop_front();
1987 
1988  if (findI(line, mHighlights) != std::string::npos)
1989  mAwayLog.push_back("##aaway:" + line);
1990 }
Settings settings
Definition: settings.cpp:31
StringVect mHighlights
Definition: chatwindow.h:385
std::list< std::string > mAwayLog
Definition: chatwindow.h:384
bool awayMode
Definition: settings.h:155
size_t findI(std::string str, std::string subStr)

◆ addWhisper()

void ChatWindow::addWhisper ( const std::string &  nick,
const std::string &  mes,
const ChatMsgTypeT  own 
)

Definition at line 1104 of file chatwindow.cpp.

References _, ChatMsgType::ACT_WHISPER, addWhisperTab(), LocalPlayer::afkRespond(), ChatMsgType::BY_PLAYER, ChatMsgType::BY_SERVER, chatHandler, ChatTab::chatInput(), ChatTab::chatLog(), config, Configuration::getBoolValue(), Being::getName(), ChatTab::getRemoveNames(), IgnoreRecord_false, localChatTab, localPlayer, Actions::msg(), mWhispers, Net::ChatHandler::privateMessage(), removeColors(), saveState(), strprintf(), Catch::toLower(), Catch::trim(), and TryRemoveColors_true.

Referenced by TmwAthena::ChatRecv::processWhisperContinue(), EAthena::ChatRecv::processWhisperContinue(), Ea::ChatRecv::processWhisperResponseContinue(), TmwAthena::BuySellHandler::requestBuyList(), TmwAthena::BuySellHandler::requestSellList(), TmwAthena::BuySellHandler::sendBuyRequest(), ShopWindow::sendMessage(), TmwAthena::BuySellHandler::sendSellRequest(), and setReturnTogglesChat().

1107 {
1108  if (mes.empty() || (localPlayer == nullptr))
1109  return;
1110 
1111  std::string playerName = localPlayer->getName();
1112  std::string tempNick = nick;
1113 
1114  toLower(playerName);
1115  toLower(tempNick);
1116 
1117  if (tempNick == playerName)
1118  return;
1119 
1120  WhisperTab *tab = nullptr;
1121  const TabMap::const_iterator i = mWhispers.find(tempNick);
1122 
1123  if (i != mWhispers.end())
1124  {
1125  tab = i->second;
1126  }
1127  else if (config.getBoolValue("whispertab"))
1128  {
1129  tab = addWhisperTab(nick, nick, false);
1130  if (tab != nullptr)
1131  saveState();
1132  }
1133 
1134  if (tab != nullptr)
1135  {
1136  if (own == ChatMsgType::BY_PLAYER)
1137  {
1138  tab->chatInput(mes);
1139  }
1140  else if (own == ChatMsgType::BY_SERVER)
1141  {
1142  tab->chatLog(mes,
1146  }
1147  else
1148  {
1149  if (tab->getRemoveNames())
1150  {
1151  std::string msg = mes;
1152  const size_t idx = mes.find(':');
1153  if (idx != std::string::npos && idx > 0)
1154  {
1155  std::string nick2 = msg.substr(0, idx);
1156  msg = msg.substr(idx + 1);
1157  nick2 = removeColors(nick2);
1158  nick2 = trim(nick2);
1159  if (config.getBoolValue("removeColors"))
1160  msg = removeColors(msg);
1161  msg = trim(msg);
1162  tab->chatLog(nick2, msg);
1163  }
1164  else
1165  {
1166  if (config.getBoolValue("removeColors"))
1167  msg = removeColors(msg);
1168  tab->chatLog(msg,
1172  }
1173  }
1174  else
1175  {
1176  tab->chatLog(nick, mes);
1177  }
1178  localPlayer->afkRespond(tab, nick);
1179  }
1180  }
1181  else if (localChatTab != nullptr)
1182  {
1183  if (own == ChatMsgType::BY_PLAYER)
1184  {
1185  chatHandler->privateMessage(nick, mes);
1186 
1187  // TRANSLATORS: chat message
1188  localChatTab->chatLog(strprintf(_("Whispering to %s: %s"),
1189  nick.c_str(), mes.c_str()),
1193  }
1194  else
1195  {
1196  localChatTab->chatLog(std::string(nick).append(
1197  " : ").append(mes),
1201  if (localPlayer != nullptr)
1202  localPlayer->afkRespond(nullptr, nick);
1203  }
1204  }
1205 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
Configuration config
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
bool msg(InputEvent &event)
Definition: chat.cpp:38
std::string removeColors(std::string msg)
void chatInput(const std::string &msg)
Definition: chattab.cpp:381
bool getBoolValue(const std::string &key) const
virtual void privateMessage(const std::string &recipient, const std::string &text) const =0
void afkRespond(ChatTab *const tab, const std::string &nick)
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void saveState() const
LocalPlayer * localPlayer
std::string trim(std::string const &str)
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
std::string toLower(std::string const &s)
bool getRemoveNames() const
Definition: chattab.h:163
WhisperTab * addWhisperTab(const std::string &caption, const std::string &nick, const bool switchTo)
const std::string & getName() const
Definition: being.h:231
Net::ChatHandler * chatHandler
Definition: net.cpp:82
TabMap mWhispers
Definition: chatwindow.h:367

◆ addWhisperTab()

WhisperTab * ChatWindow::addWhisperTab ( const std::string &  caption,
const std::string &  nick,
const bool  switchTo 
)

Definition at line 1207 of file chatwindow.cpp.

References config, Configuration::getBoolValue(), Being::getName(), Gui::getSecureFont(), gui, PlayerRelationsManager::isGoodName(), ChatTab::loadFromLogFile(), localPlayer, mChatTabs, mWhispers, playerRelations, Tab::setLabelFont(), TabbedArea::setSelectedTab(), Catch::toLower(), and WhisperTab.

Referenced by addChatTab(), addWhisper(), AvatarListBox::mousePressed(), and setReturnTogglesChat().

1210 {
1211  if (localPlayer == nullptr)
1212  return nullptr;
1213 
1214  std::string playerName = localPlayer->getName();
1215  std::string tempNick = nick;
1216 
1217  toLower(playerName);
1218  toLower(tempNick);
1219 
1220  const TabMap::const_iterator i = mWhispers.find(tempNick);
1221  WhisperTab *ret = nullptr;
1222 
1223  if (tempNick == playerName)
1224  return nullptr;
1225 
1226  if (i != mWhispers.end())
1227  {
1228  ret = i->second;
1229  }
1230  else
1231  {
1232  ret = new WhisperTab(this, caption, nick);
1233  if ((gui != nullptr) && !playerRelations.isGoodName(nick))
1234  ret->setLabelFont(gui->getSecureFont());
1235  mWhispers[tempNick] = ret;
1236  if (config.getBoolValue("showChatHistory"))
1237  ret->loadFromLogFile(nick);
1238  }
1239 
1240  if (switchTo)
1241  mChatTabs->setSelectedTab(ret);
1242 
1243  return ret;
1244 }
friend class WhisperTab
Definition: chatwindow.h:312
Gui * gui
Definition: gui.cpp:110
Configuration config
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:406
void loadFromLogFile(const std::string &name)
Definition: chattab.cpp:509
bool isGoodName(Being *const being) const
TabbedArea * mChatTabs
Definition: chatwindow.h:343
bool getBoolValue(const std::string &key) const
LocalPlayer * localPlayer
std::string toLower(std::string const &s)
const std::string & getName() const
Definition: being.h:231
void setLabelFont(Font *const font)
Definition: tab.cpp:413
Font * getSecureFont() const
Definition: gui.h:171
PlayerRelationsManager playerRelations
TabMap mWhispers
Definition: chatwindow.h:367

◆ adjustTabSize()

void ChatWindow::adjustTabSize ( )

Definition at line 276 of file chatwindow.cpp.

References TabbedArea::adjustSize(), config, Configuration::getBoolValue(), Window::getChildrenArea(), TabbedArea::getContainerHeight(), getFocused(), Widget::getFrameSize(), Widget::getHeight(), Widget::getWidth(), Rect::height, Widget::logic(), mChatButton, mChatInput, mChatTabs, mColorPicker, mEmoteButtonSpacing, mEmoteButtonY, Window::mPadding, ChatTab::mScrollArea, Widget::mVisible, TabbedArea::setHeight(), Widget::setPosition(), Widget::setSize(), Widget::setVisible(), Widget::setWidth(), TabbedArea::setWidth(), updateTabsMargin(), Visible_false, Visible_true, Rect::width, x, and y.

Referenced by Setup_Chat::apply(), ChatInput::processVisible(), setReturnTogglesChat(), and widgetResized().

277 {
278  const Rect area = getChildrenArea();
279 
280  const int aw = area.width;
281  const int ah = area.height;
282  const int frame = mChatInput->getFrameSize();
283  const int inputHeight = mChatInput->getHeight();
284  const bool showEmotes = config.getBoolValue("showEmotesButton");
285  int maxHeight = inputHeight;
286  if (showEmotes)
287  {
288  const int buttonHeight = mChatButton->getHeight();
289  if (buttonHeight > maxHeight)
290  maxHeight = buttonHeight;
291  }
292  const int frame2 = 2 * frame;
293  const int awFrame2 = aw - frame2;
294  int y = ah - maxHeight - frame;
295  mChatInput->setPosition(frame, y);
296  mChatTabs->setWidth(awFrame2);
297  const int height = ah - frame2 - (maxHeight + frame2);
298  if (mChatInput->mVisible == Visible_true ||
299  !config.getBoolValue("hideChatInput"))
300  {
301  mChatTabs->setHeight(height);
302  }
303  else
304  {
305  mChatTabs->setHeight(height + maxHeight);
306  }
308 
309  if (showEmotes)
310  {
311  const int chatButtonSize = mChatButton->getWidth();
312  int w = awFrame2 - chatButtonSize;
313  const int x = aw - frame - chatButtonSize;
314  w -= mEmoteButtonSpacing;
315  y += mEmoteButtonY;
316  mChatInput->setWidth(w);
318  mChatButton->setPosition(x, y);
319  }
320  else
321  {
322  mChatInput->setWidth(awFrame2);
324  }
325 
326  const ChatTab *const tab = getFocused();
327  if (tab != nullptr)
328  {
329  Widget *const content = tab->mScrollArea;
330  if (content != nullptr)
331  {
332  const int contentFrame2 = 2 * content->getFrameSize();
333  content->setSize(mChatTabs->getWidth() - contentFrame2,
334  mChatTabs->getContainerHeight() - contentFrame2);
335  content->logic();
336  }
337  }
338 
340  - 2 * mPadding - 8 - 16, mPadding);
341 
343 }
void setSize(const int width, const int height)
Definition: widget.cpp:366
void setHeight(int height)
Definition: tabbedarea.cpp:754
int getContainerHeight() const
Definition: tabbedarea.h:163
int width
Definition: rect.h:218
int getWidth() const
Definition: widget.h:220
ScrollArea * mScrollArea
Definition: chattab.h:207
void setWidth(const int width)
Definition: widget.cpp:132
int mPadding
Definition: window.h:617
const bool Visible_true
Definition: visible.h:29
int mEmoteButtonSpacing
Definition: chatwindow.h:388
Rect getChildrenArea()
Definition: window.cpp:1468
void setVisible(Visible visible)
Definition: widget.cpp:224
Button * mChatButton
Definition: chatwindow.h:383
DropDown * mColorPicker
Definition: chatwindow.h:382
Definition: rect.h:72
Configuration config
unsigned int getFrameSize() const
Definition: widget.h:183
Visible mVisible
Definition: widget.h:962
TabbedArea * mChatTabs
Definition: chatwindow.h:343
bool getBoolValue(const std::string &key) const
void updateTabsMargin()
Definition: chatwindow.cpp:268
const bool Visible_false
Definition: visible.h:29
void setWidth(int width)
Definition: tabbedarea.cpp:747
virtual void logic()
Definition: widget.h:192
int mEmoteButtonY
Definition: chatwindow.h:389
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int height
Definition: rect.h:223
void adjustSize()
Definition: tabbedarea.cpp:567
Definition: widget.h:97
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
int getHeight() const
Definition: widget.h:239
ChatInput * mChatInput
Definition: chatwindow.h:346

◆ attributeChanged()

void ChatWindow::attributeChanged ( const AttributesT  id,
const int64_t  oldVal,
const int64_t  newVal 
)
virtual

Implements AttributeListener.

Definition at line 1007 of file chatwindow.cpp.

References battleChatLog(), ChatMsgType::BY_SERVER, CAST_S32, CAST_U64, config, PlayerInfo::getAttribute(), Configuration::getBoolValue(), IgnoreRecord_false, mShowBattleEvents, Attributes::PLAYER_BASE_LEVEL, Attributes::PLAYER_EXP, Attributes::PLAYER_JOB_EXP, Attributes::PLAYER_JOB_EXP_NEEDED, PRAGMA45(), Catch::toString(), and TryRemoveColors_true.

Referenced by clearAwayLog().

1010 {
1011  if (!mShowBattleEvents)
1012  return;
1013  PRAGMA45(GCC diagnostic push)
1014  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
1015  switch (id)
1016  {
1018  {
1019  if (oldVal > newVal)
1020  break;
1021  const int64_t change = newVal - oldVal;
1022  if (change != 0)
1023  {
1024  battleChatLog(std::string("+").append(toString(
1025  CAST_U64(change))).append(" xp"),
1029  }
1030  break;
1031  }
1033  battleChatLog(std::string(
1034  "Level: ").append(toString(CAST_S32(
1035  newVal))),
1039  break;
1041  {
1042  if (!config.getBoolValue("showJobExp"))
1043  return;
1044  if (oldVal > newVal ||
1047  {
1048  return;
1049  }
1050  const int64_t change = newVal - oldVal;
1051  if (change != 0)
1052  {
1053  battleChatLog(std::string("+").append(toString(CAST_U64(
1054  change))).append(" job"),
1058  }
1059  break;
1060  }
1061  default:
1062  break;
1063  };
1064  PRAGMA45(GCC diagnostic pop)
1065 }
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
#define CAST_U64
Definition: cast.h:32
Configuration config
const bool TryRemoveColors_true
bool mShowBattleEvents
Definition: chatwindow.h:396
bool getBoolValue(const std::string &key) const
#define CAST_S32
Definition: cast.h:29
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
static void battleChatLog(const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100

◆ autoComplete() [1/3]

void ChatWindow::autoComplete ( )
protected

Definition at line 1425 of file chatwindow.cpp.

References actorManager, SpellManager::autoComplete(), autoCompleteHistory(), CAST_S32, ChatTab::getAutoCompleteCommands(), ChatTab::getAutoCompleteList(), TextField::getCaretPosition(), ActorManager::getMobNames(), WhoIsOnline::getPlayerNames(), ActorManager::getPlayerNames(), TabbedArea::getSelectedTab(), TextField::getText(), isWordSeparator(), mChatInput, mChatTabs, mCommands, mCustomWords, NpcNames_true, secureChatCommand(), TextField::setCaretPosition(), TextField::setText(), spellManager, and whoIsOnline.

Referenced by autoComplete(), autoCompleteHistory(), and keyPressed().

1426 {
1427  const int caretPos = mChatInput->getCaretPosition();
1428  int startName = 0;
1429  const std::string &inputText = mChatInput->getText();
1430  std::string name = inputText.substr(0, caretPos);
1431 
1432  for (int f = caretPos - 1; f > -1; f --)
1433  {
1434  if (isWordSeparator(inputText[f]))
1435  {
1436  startName = f + 1;
1437  name = inputText.substr(f + 1, caretPos - f);
1438  break;
1439  }
1440  }
1441 
1442  if (caretPos - 1 + 1 == startName)
1443  return;
1444 
1445  const ChatTab *const cTab = static_cast<ChatTab*>(
1447  StringVect nameList;
1448 
1449  if (cTab != nullptr)
1450  cTab->getAutoCompleteList(nameList);
1451  std::string newName = autoComplete(nameList, name);
1452  if (!newName.empty() && (startName == 0))
1453  secureChatCommand(newName);
1454 
1455  if ((cTab != nullptr) && newName.empty())
1456  {
1457  cTab->getAutoCompleteCommands(nameList);
1458  newName = autoComplete(nameList, name);
1459  }
1460 
1461  if (newName.empty() && (actorManager != nullptr))
1462  {
1464  newName = autoComplete(nameList, name);
1465  if (!newName.empty() && (startName == 0))
1466  secureChatCommand(newName);
1467  }
1468  if (newName.empty())
1469  newName = autoCompleteHistory(name);
1470  if (newName.empty() && (spellManager != nullptr))
1471  newName = spellManager->autoComplete(name);
1472  if (newName.empty())
1473  newName = autoComplete(name, &mCommands);
1474  if (newName.empty() && (actorManager != nullptr))
1475  {
1476  actorManager->getMobNames(nameList);
1477  newName = autoComplete(nameList, name);
1478  }
1479  if (newName.empty())
1480  newName = autoComplete(name, &mCustomWords);
1481  if (newName.empty())
1482  {
1483  whoIsOnline->getPlayerNames(nameList);
1484  newName = autoComplete(nameList, name);
1485  }
1486 
1487  if (!newName.empty())
1488  {
1489  mChatInput->setText(inputText.substr(0, startName).append(newName)
1490  .append(inputText.substr(caretPos,
1491  inputText.length() - caretPos)));
1492 
1493  const int len = caretPos - CAST_S32(name.length())
1494  + CAST_S32(newName.length());
1495 
1496  if (startName > 0)
1497  mChatInput->setCaretPosition(len + 1);
1498  else
1500  }
1501 }
virtual void getAutoCompleteList(StringVect &names) const
Definition: chattab.h:198
std::string autoCompleteHistory(const std::string &partName) const
SpellManager * spellManager
void secureChatCommand(std::string &str)
virtual void getAutoCompleteCommands(StringVect &names) const
Definition: chattab.h:201
void getMobNames(StringVect &names) const
History mCustomWords
Definition: chatwindow.h:377
void getPlayerNames(StringVect &names)
void setCaretPosition(unsigned int position)
Definition: textfield.cpp:751
void autoComplete()
WhoIsOnline * whoIsOnline
Definition: whoisonline.cpp:78
std::vector< std::string > StringVect
Definition: stringvector.h:28
const bool NpcNames_true
Definition: npcnames.h:29
void setText(const std::string &text)
Definition: textfield.cpp:802
bool isWordSeparator(const signed char chr) A_CONST
Definition: stringutils.h:141
TabbedArea * mChatTabs
Definition: chatwindow.h:343
#define CAST_S32
Definition: cast.h:29
unsigned int getCaretPosition() const
Definition: textfield.h:233
std::string autoComplete(const std::string &partName) const
History mCommands
Definition: chatwindow.h:376
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
ChatInput * mChatInput
Definition: chatwindow.h:346
const std::string & getText() const
Definition: textfield.h:223
void getPlayerNames(StringVect &names, const NpcNames npcNames) const
ActorManager * actorManager

◆ autoComplete() [2/3]

std::string ChatWindow::autoComplete ( const std::string &  partName,
const History *const  words 
) const
protected

Definition at line 1533 of file chatwindow.cpp.

References autoComplete().

1535 {
1536  if (words == nullptr)
1537  return "";
1538 
1539  ChatCommands::const_iterator i = words->begin();
1540  const ChatCommands::const_iterator i_end = words->end();
1541  StringVect nameList;
1542 
1543  while (i != i_end)
1544  {
1545  const std::string line = *i;
1546  if (line.find(partName, 0) == 0)
1547  nameList.push_back(line);
1548  ++i;
1549  }
1550  return autoComplete(nameList, partName);
1551 }
void autoComplete()
std::vector< std::string > StringVect
Definition: stringvector.h:28

◆ autoComplete() [3/3]

std::string ChatWindow::autoComplete ( const StringVect names,
std::string  partName 
)
staticprotected

Definition at line 1503 of file chatwindow.cpp.

References findSameSubstringI(), and Catch::toLower().

1505 {
1506  StringVectCIter i = names.begin();
1507  const StringVectCIter i_end = names.end();
1508  toLower(partName);
1509  std::string newName;
1510 
1511  while (i != i_end)
1512  {
1513  if (!i->empty())
1514  {
1515  std::string name = *i;
1516  toLower(name);
1517 
1518  const size_t pos = name.find(partName, 0);
1519  if (pos == 0)
1520  {
1521  if (!newName.empty())
1522  newName = findSameSubstringI(*i, newName);
1523  else
1524  newName = *i;
1525  }
1526  }
1527  ++i;
1528  }
1529 
1530  return newName;
1531 }
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
const std::string findSameSubstringI(const std::string &s1, const std::string &s2)
std::string toLower(std::string const &s)

◆ autoCompleteHistory()

std::string ChatWindow::autoCompleteHistory ( const std::string &  partName) const
protected

Definition at line 1565 of file chatwindow.cpp.

References autoComplete(), isWordSeparator(), and mHistory.

Referenced by autoComplete().

1566 {
1567  History::const_iterator i = mHistory.begin();
1568  const History::const_iterator i_end = mHistory.end();
1569  StringVect nameList;
1570 
1571  while (i != i_end)
1572  {
1573  std::string line = *i;
1574  unsigned int f = 0;
1575  while (f < line.length() && !isWordSeparator(line.at(f)))
1576  f++;
1577 
1578  line = line.substr(0, f);
1579  if (!line.empty())
1580  nameList.push_back(line);
1581 
1582  ++i;
1583  }
1584  return autoComplete(nameList, partName);
1585 }
void autoComplete()
std::vector< std::string > StringVect
Definition: stringvector.h:28
bool isWordSeparator(const signed char chr) A_CONST
Definition: stringutils.h:141
History mHistory
Definition: chatwindow.h:371

◆ battleChatLog()

void ChatWindow::battleChatLog ( const std::string &  line,
ChatMsgTypeT  own,
const IgnoreRecord  ignoreRecord,
const TryRemoveColors  tryRemoveColors 
)
static

Definition at line 1752 of file chatwindow.cpp.

References battleChatTab, ChatMsgType::BY_SERVER, ChatMsgType::BY_UNKNOWN, ChatTab::chatLog(), and debugChatTab.

Referenced by attributeChanged(), setReturnTogglesChat(), and Being::takeDamage().

1755 {
1756  if (own == ChatMsgType::BY_UNKNOWN)
1757  own = ChatMsgType::BY_SERVER;
1758  if (battleChatTab != nullptr)
1759  battleChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1760  else if (debugChatTab != nullptr)
1761  debugChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1762 }
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
BattleTab * battleChatTab
Definition: battletab.cpp:31
ChatTab * debugChatTab
Definition: chattab.cpp:62

◆ channelChatLog()

void ChatWindow::channelChatLog ( const std::string &  channel,
const std::string &  line,
ChatMsgTypeT  own,
const IgnoreRecord  ignoreRecord,
const TryRemoveColors  tryRemoveColors 
)

Definition at line 1764 of file chatwindow.cpp.

References addChannelTab(), ServerCommandType::channel, ChatTab::chatLog(), mChannels, saveState(), and Catch::toLower().

Referenced by EAthena::ChatRecv::processJoinChannel(), EAthena::ChatRecv::processWhisperResponse(), resortChatLog(), and setReturnTogglesChat().

1769 {
1770  std::string tempChannel = channel;
1771  toLower(tempChannel);
1772 
1773  ChatTab *tab = nullptr;
1774  const ChannelMap::const_iterator i = mChannels.find(tempChannel);
1775 
1776  if (i != mChannels.end())
1777  {
1778  tab = i->second;
1779  }
1780  else
1781  {
1782  tab = addChannelTab(channel, false);
1783  if (tab != nullptr)
1784  saveState();
1785  }
1786 
1787  if (tab != nullptr)
1788  tab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1789 }
ChatTab * addChannelTab(const std::string &name, const bool switchTo)
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
void saveState() const
std::string toLower(std::string const &s)
ChannelMap mChannels
Definition: chatwindow.h:368

◆ chatInput()

void ChatWindow::chatInput ( const std::string &  msg) const

Passes the text to the current tab as input

Parameters
msgThe message text which is to be sent.

Definition at line 660 of file chatwindow.cpp.

References ChatTab::chatInput(), config, Configuration::getBoolValue(), getFocused(), Game::instance(), localChatTab, Actions::msg(), Game::setValidSpeed(), and Catch::trim().

Referenced by action(), IPC::flush(), and localChatInput().

661 {
662  ChatTab *tab = nullptr;
663  std::string msg = message;
664  trim(msg);
665 
666  if (config.getBoolValue("allowCommandsInChatTabs")
667  && msg.length() > 1
668  && ((msg.at(0) == '#' && msg.at(1) != '#') || msg.at(0) == '@')
669  && (localChatTab != nullptr))
670  {
671  tab = localChatTab;
672  }
673  else
674  {
675  tab = getFocused();
676  if (tab == nullptr)
677  tab = localChatTab;
678  }
679  if (tab != nullptr)
680  tab->chatInput(msg);
681  Game *const game = Game::instance();
682  if (game != nullptr)
683  game->setValidSpeed();
684 }
ChatTab * localChatTab
Definition: chattab.cpp:61
void setValidSpeed()
Definition: game.cpp:1269
Configuration config
bool msg(InputEvent &event)
Definition: chat.cpp:38
void chatInput(const std::string &msg)
Definition: chattab.cpp:381
bool getBoolValue(const std::string &key) const
Definition: game.h:62
std::string trim(std::string const &str)
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
static Game * instance()
Definition: game.h:81

◆ clearAwayLog()

void ChatWindow::clearAwayLog ( )
inline

◆ clearTab() [1/2]

void ChatWindow::clearTab ( ChatTab *const  tab)
static

Clear the given tab.

Definition at line 357 of file chatwindow.cpp.

References ChatTab::clearText().

Referenced by Actions::splitWhisper().

358 {
359  if (tab != nullptr)
360  tab->clearText();
361 }
void clearText()
Definition: chattab.cpp:427

◆ clearTab() [2/2]

void ChatWindow::clearTab ( ) const

Clear the current tab.

Definition at line 363 of file chatwindow.cpp.

References getFocused().

364 {
365  clearTab(getFocused());
366 }
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
void clearTab() const
Definition: chatwindow.cpp:363

◆ closeTab()

void ChatWindow::closeTab ( ) const

Close current chat tab

Definition at line 414 of file chatwindow.cpp.

References ChatTabType::CHANNEL, TabbedArea::getSelectedTabIndex(), TabbedArea::getTabByIndex(), ChatTab::getType(), ChatTab::handleCommand(), mChatTabs, and ChatTabType::WHISPER.

Referenced by Actions::outString().

415 {
416  if (mChatTabs == nullptr)
417  return;
418 
419  ChatTab *const tab = dynamic_cast<ChatTab*>(mChatTabs->getTabByIndex(
421  if (tab == nullptr)
422  return;
423  const ChatTabTypeT &type = tab->getType();
424  if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
425  tab->handleCommand("close", "");
426 }
virtual bool handleCommand(const std::string &type, const std::string &args)
Definition: chattab.h:127
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:713
TabbedArea * mChatTabs
Definition: chatwindow.h:343
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:448
ChatTabTypeT getType() const
Definition: chattab.h:144
ChatTabType ::T ChatTabTypeT
Definition: chattabtype.h:48

◆ copyToClipboard()

void ChatWindow::copyToClipboard ( const int  x,
const int  y 
) const

Definition at line 2037 of file chatwindow.cpp.

References getFocused(), BrowserBox::getTextAtPos(), ChatTab::mTextOutput, sendBuffer(), and ServerCommandType::str.

Referenced by clearAwayLog(), and Actions::splitWhisper().

2038 {
2039  const ChatTab *const tab = getFocused();
2040  if (tab == nullptr)
2041  return;
2042 
2043  const BrowserBox *const text = tab->mTextOutput;
2044  if (text == nullptr)
2045  return;
2046 
2047  std::string str = text->getTextAtPos(x, y);
2048  sendBuffer(str);
2049 }
bool sendBuffer(const std::string &text)
Definition: copynpaste.cpp:517
std::string getTextAtPos(const int x, const int y) const
Definition: browserbox.cpp:869
BrowserBox * mTextOutput
Definition: chattab.h:206
ChatTab * getFocused() const
Definition: chatwindow.cpp:352

◆ debugMessage()

void ChatWindow::debugMessage ( const std::string &  msg)
virtual

Implements DebugMessageListener.

Definition at line 2165 of file chatwindow.cpp.

References ChatMsgType::BY_SERVER, ChatTab::chatLog(), debugChatTab, IgnoreRecord_false, and TryRemoveColors_true.

Referenced by clearAwayLog().

2166 {
2167  if (debugChatTab != nullptr)
2168  {
2173  }
2174 }
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
bool msg(InputEvent &event)
Definition: chat.cpp:38
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
ChatTab * debugChatTab
Definition: chattab.cpp:62

◆ defaultTab()

void ChatWindow::defaultTab ( )

Switch to the default tab

Definition at line 428 of file chatwindow.cpp.

References CAST_U32, mChatTabs, and TabbedArea::setSelectedTabByIndex().

Referenced by WhisperTab::handleCommand(), and ChannelTab::handleCommand().

429 {
430  if (mChatTabs != nullptr)
432 }
#define CAST_U32
Definition: cast.h:30
TabbedArea * mChatTabs
Definition: chatwindow.h:343
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:314

◆ displayAwayLog()

void ChatWindow::displayAwayLog ( ) const

Definition at line 1992 of file chatwindow.cpp.

References ChatTab::addNewRow(), localChatTab, mAwayLog, and ServerCommandType::str.

Referenced by GameModifiers::changeAwayMode(), and setReturnTogglesChat().

1993 {
1994  if (localChatTab == nullptr)
1995  return;
1996 
1997  std::list<std::string>::const_iterator i = mAwayLog.begin();
1998  const std::list<std::string>::const_iterator i_end = mAwayLog.end();
1999 
2000  while (i != i_end)
2001  {
2002  std::string str = *i;
2003  localChatTab->addNewRow(str);
2004  ++i;
2005  }
2006 }
void addNewRow(std::string &line)
Definition: chattab.cpp:525
ChatTab * localChatTab
Definition: chattab.cpp:61
std::list< std::string > mAwayLog
Definition: chatwindow.h:384

◆ doPresent()

void ChatWindow::doPresent ( ) const

Definition at line 694 of file chatwindow.cpp.

References _, actorManager, ChatMsgType::BY_SERVER, ChatTab::chatLog(), FOR_EACH, ActorManager::getAll(), getFocused(), IgnoreRecord_false, ActorType::Player, strprintf(), and TryRemoveColors_true.

Referenced by Actions::changeRelation(), and setReturnTogglesChat().

695 {
696  if (actorManager == nullptr)
697  return;
698 
699  const ActorSprites &actors = actorManager->getAll();
700  std::string response;
701  int playercount = 0;
702 
703  FOR_EACH (ActorSpritesIterator, it, actors)
704  {
705  if ((*it)->getType() == ActorType::Player)
706  {
707  if (!response.empty())
708  response.append(", ");
709  response.append(static_cast<Being*>(*it)->getName());
710  playercount ++;
711  }
712  }
713 
714  ChatTab *const tab = getFocused();
715  if (tab != nullptr)
716  {
717  const std::string log = strprintf(
718  // TRANSLATORS: chat message
719  _("Present: %s; %d players are present."),
720  response.c_str(), playercount);
721  tab->chatLog(log,
725  }
726 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
#define _(s)
Definition: gettext.h:34
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
const bool IgnoreRecord_false
Definition: ignorerecord.h:29
ActorSprites::iterator ActorSpritesIterator
Definition: actormanager.h:59
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
const ActorSprites & getAll() const A_CONST
ActorManager * actorManager
std::set< ActorSprite * > ActorSprites
Definition: actormanager.h:56

◆ doReplace()

std::string ChatWindow::doReplace ( const std::string &  msg)
static

◆ draw()

void ChatWindow::draw ( Graphics *const  graphics)
virtual

Draws the window.

Reimplemented from Window.

Definition at line 2081 of file chatwindow.cpp.

References BLOCK_END, BLOCK_START, Window::draw(), GLDEBUG_END, GLDEBUG_START, mAutoHide, and mHaveMouse.

Referenced by clearAwayLog().

2082 {
2083  BLOCK_START("ChatWindow::draw")
2084  if (!mAutoHide || mHaveMouse)
2085  {
2086  GLDEBUG_START("ChatWindow::draw");
2087  Window::draw(graphics);
2088  GLDEBUG_END();
2089  }
2090  BLOCK_END("ChatWindow::draw")
2091 }
#define BLOCK_START(name)
Definition: perfomance.h:78
#define GLDEBUG_START(text)
Definition: opengldebug.h:34
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
void draw(Graphics *const graphics)
Definition: window.cpp:310
bool mAutoHide
Definition: chatwindow.h:395
bool mHaveMouse
Definition: chatwindow.h:394
#define GLDEBUG_END()
Definition: opengldebug.h:35

◆ fillCommands()

void ChatWindow::fillCommands ( )
private

Definition at line 253 of file chatwindow.cpp.

References InputManager::addChatCommands(), inputManager, loadCommandsFile(), and mCommands.

Referenced by ChatWindow().

254 {
255  loadCommandsFile("chatcommands.txt");
257 }
void loadCommandsFile(const std::string &name)
Definition: chatwindow.cpp:237
void addChatCommands(std::list< std::string > &arr)
History mCommands
Definition: chatwindow.h:376
InputManager inputManager

◆ findHighlight()

bool ChatWindow::findHighlight ( const std::string &  str)

Definition at line 2032 of file chatwindow.cpp.

References findI(), and mHighlights.

Referenced by ChatTab::chatLog(), and clearAwayLog().

2033 {
2034  return findI(str, mHighlights) != std::string::npos;
2035 }
StringVect mHighlights
Definition: chatwindow.h:385
size_t findI(std::string str, std::string subStr)

◆ getFocused()

ChatTab * ChatWindow::getFocused ( ) const

Gets the focused tab.

Definition at line 352 of file chatwindow.cpp.

References TabbedArea::getSelectedTab(), and mChatTabs.

Referenced by adjustTabSize(), chatInput(), clearTab(), copyToClipboard(), doPresent(), keyPressed(), mousePressed(), and scroll().

353 {
354  return static_cast<ChatTab*>(mChatTabs->getSelectedTab());
355 }
TabbedArea * mChatTabs
Definition: chatwindow.h:343
Tab * getSelectedTab() const
Definition: tabbedarea.h:174

◆ getReturnTogglesChat()

bool ChatWindow::getReturnTogglesChat ( ) const
inline

Definition at line 183 of file chatwindow.h.

References mReturnToggles.

Referenced by Actions::splitWhisper().

184  { return mReturnToggles; }
bool mReturnToggles
Definition: chatwindow.h:391

◆ getWhisperTab()

WhisperTab * ChatWindow::getWhisperTab ( const std::string &  nick) const

Definition at line 1246 of file chatwindow.cpp.

References Being::getName(), localPlayer, mWhispers, and Catch::toLower().

Referenced by LocalPlayer::checkNewName(), and setReturnTogglesChat().

1247 {
1248  if (localPlayer == nullptr)
1249  return nullptr;
1250 
1251  std::string playerName = localPlayer->getName();
1252  std::string tempNick = nick;
1253 
1254  toLower(playerName);
1255  toLower(tempNick);
1256 
1257  const TabMap::const_iterator i = mWhispers.find(tempNick);
1258  WhisperTab *ret = nullptr;
1259 
1260  if (tempNick == playerName)
1261  return nullptr;
1262 
1263  if (i != mWhispers.end())
1264  ret = i->second;
1265 
1266  return ret;
1267 }
LocalPlayer * localPlayer
std::string toLower(std::string const &s)
const std::string & getName() const
Definition: being.h:231
TabMap mWhispers
Definition: chatwindow.h:367

◆ ignoreAllWhispers()

void ChatWindow::ignoreAllWhispers ( )

Definition at line 640 of file chatwindow.cpp.

References WhisperTab::getNick(), PlayerRelationsManager::getRelation(), WhisperTab::handleCommand(), Relation::IGNORED, mWhispers, playerRelations, and PlayerRelationsManager::setRelation().

Referenced by Actions::outString(), and setReturnTogglesChat().

641 {
642  for (TabMap::iterator iter = mWhispers.begin();
643  iter != mWhispers.end();
644  ++ iter)
645  {
646  WhisperTab *const tab = iter->second;
647  if (tab != nullptr)
648  {
651  {
654  }
655  tab->handleCommand("close", "");
656  }
657  }
658 }
bool handleCommand(const std::string &type, const std::string &args)
Definition: whispertab.cpp:92
RelationT getRelation(const std::string &name) const
const std::string & getNick() const
Definition: whispertab.h:36
PlayerRelationsManager playerRelations
void setRelation(const std::string &name, const RelationT relation)
TabMap mWhispers
Definition: chatwindow.h:367

◆ initTradeFilter()

void ChatWindow::initTradeFilter ( )
protected

Definition at line 1791 of file chatwindow.cpp.

References mTradeFilter, Settings::serverConfigDir, settings, and ServerCommandType::str.

Referenced by ChatWindow().

1792 {
1793  const std::string tradeListName = settings.serverConfigDir
1794  + "/tradefilter.txt";
1795 
1796  std::ifstream tradeFile;
1797  struct stat statbuf;
1798 
1799  if (stat(tradeListName.c_str(), &statbuf) == 0 &&
1800  S_ISREG(statbuf.st_mode))
1801  {
1802  tradeFile.open(tradeListName.c_str(), std::ios::in);
1803  if (tradeFile.is_open())
1804  {
1805  char line[100];
1806  while (tradeFile.getline(line, 100))
1807  {
1808  const std::string str = line;
1809  if (!str.empty())
1810  mTradeFilter.push_back(str);
1811  }
1812  }
1813  tradeFile.close();
1814  }
1815 }
StringVect mTradeFilter
Definition: chatwindow.h:379
Settings settings
Definition: settings.cpp:31
std::string serverConfigDir
Definition: settings.h:115

◆ isInputFocused()

bool ChatWindow::isInputFocused ( ) const

Checks whether ChatWindow is Focused or not.

Definition at line 574 of file chatwindow.cpp.

References Widget::isFocused(), and mChatInput.

Referenced by Game::handleMove(), Actions::showHelpPage(), and InputManager::updateConditionMask().

575 {
576  return mChatInput->isFocused();
577 }
virtual bool isFocused() const
Definition: widget.cpp:183
ChatInput * mChatInput
Definition: chatwindow.h:346

◆ isTabPresent()

bool ChatWindow::isTabPresent ( const ChatTab *const  tab) const

Definition at line 2160 of file chatwindow.cpp.

References TabbedArea::isTabPresent(), and mChatTabs.

Referenced by clearAwayLog(), and Actions::uploadUpdate().

2161 {
2162  return mChatTabs->isTabPresent(tab);
2163 }
TabbedArea * mChatTabs
Definition: chatwindow.h:343
bool isTabPresent(const Tab *const tab) const
Definition: tabbedarea.cpp:299

◆ joinRoom()

void ChatWindow::joinRoom ( const bool  isJoin)

Definition at line 2194 of file chatwindow.cpp.

References _, PlayerInfo::getRoomName(), TabbedArea::getTabByIndex(), mChatTabs, and Tab::setCaption().

Referenced by EAthena::ChatRecv::processChatRoomCreateAck(), EAthena::ChatRecv::processChatRoomJoinAck(), EAthena::ChatRecv::processChatRoomLeave(), EAthena::ChatRecv::processChatRoomSettings(), and setReturnTogglesChat().

2195 {
2196  Tab *const tab = mChatTabs->getTabByIndex(0);
2197  if (tab != nullptr)
2198  {
2199  std::string name;
2200  if (isJoin)
2201  {
2202  name = PlayerInfo::getRoomName();
2203  }
2204  else
2205  {
2206  // TRANSLATORS: chat tab name
2207  name = _("General");
2208  }
2209  tab->setCaption(name);
2210  }
2211 }
#define _(s)
Definition: gettext.h:34
void setCaption(const std::string &caption)
Definition: tab.cpp:457
Definition: tab.h:84
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:713
TabbedArea * mChatTabs
Definition: chatwindow.h:343
std::string getRoomName()
Definition: playerinfo.cpp:629

◆ keyPressed()

void ChatWindow::keyPressed ( KeyEvent event)
virtual

Called when key is pressed

Reimplemented from KeyListener.

Definition at line 817 of file chatwindow.cpp.

References addCurrentToHistory(), addInputText(), autoComplete(), CAST_SIZE, CAST_U32, InputAction::CHAT_NEXT_HISTORY, InputAction::CHAT_PREV_HISTORY, emoteWindow, getFocused(), ChatTab::getRows(), TextField::getText(), TextField::getTextBeforeCaret(), InputAction::GUI_B, InputAction::GUI_CANCEL, InputAction::GUI_CTRL, InputAction::GUI_DOWN, InputAction::GUI_F1, InputAction::GUI_F10, InputAction::GUI_F11, InputAction::GUI_F12, InputAction::GUI_F2, InputAction::GUI_F3, InputAction::GUI_F4, InputAction::GUI_F5, InputAction::GUI_F6, InputAction::GUI_F7, InputAction::GUI_F8, InputAction::GUI_F9, InputAction::GUI_INSERT, InputAction::GUI_TAB, InputAction::GUI_UP, ChatTab::hasRows(), EmoteWindow::hide(), ifKey, inputManager, InputManager::isActionActive(), mChatHistoryIndex, mChatInput, mCurHist, mHistory, Widget::mVisible, ChatInput::processVisible(), TextField::setCaretPosition(), TextField::setText(), EmoteWindow::show(), ServerCommandType::str, Catch::toLower(), Visible_false, and Visible_true.

818 {
819  const InputActionT actionId = event.getActionId();
820  std::string temp;
821  if (actionId == InputAction::GUI_DOWN)
822  {
823  if (mCurHist != mHistory.end())
824  {
825  // Move forward through the history
826  const HistoryIterator prevHist = mCurHist++;
828 
829  if (mCurHist != mHistory.end())
830  {
833  mChatInput->getText().length()));
834  }
835  else
836  {
837  mChatInput->setText("");
838  mCurHist = prevHist;
839  }
840  }
841  else if (!mChatInput->getText().empty())
842  {
843  if (addCurrentToHistory())
844  mCurHist = mHistory.end();
845  mChatInput->setText("");
846  }
847  }
848  else if (actionId == InputAction::GUI_UP &&
849  mCurHist != mHistory.begin() &&
850  !mHistory.empty())
851  {
852  // Move backward through the history
853  --mCurHist;
857  mChatInput->getText().length()));
858  }
859  else if (actionId == InputAction::GUI_INSERT &&
860  !mChatInput->getText().empty())
861  {
862  const std::string str = mChatInput->getText();
863  // Add the current message to the history and clear the text
864  if (mHistory.empty() || str != mHistory.back())
865  mHistory.push_back(str);
866  mCurHist = mHistory.end();
867  mChatInput->setText(std::string());
868  }
869  else if (actionId == InputAction::GUI_TAB &&
870  !mChatInput->getText().empty())
871  {
872  autoComplete();
873  return;
874  }
875  else if (actionId == InputAction::GUI_CANCEL &&
877  {
879  }
880  else if (actionId == InputAction::CHAT_PREV_HISTORY &&
882  {
883  const ChatTab *const tab = getFocused();
884  if ((tab != nullptr) && tab->hasRows())
885  {
886  if (mChatHistoryIndex == 0u)
887  {
889  tab->getRows().size());
890 
891  mChatInput->setText("");
893  return;
894  }
895 
897 
898  unsigned int f = 0;
899  const std::list<std::string> &rows = tab->getRows();
900  for (std::list<std::string>::const_iterator it = rows.begin(),
901  it_end = rows.end(); it != it_end; ++ it, f ++)
902  {
903  if (f == mChatHistoryIndex)
904  mChatInput->setText(*it);
905  }
907  mChatInput->getText().length()));
908  }
909  }
910  else if (actionId == InputAction::CHAT_NEXT_HISTORY &&
912  {
913  const ChatTab *const tab = getFocused();
914  if ((tab != nullptr) && tab->hasRows())
915  {
916  const std::list<std::string> &rows = tab->getRows();
917  const size_t &tabSize = rows.size();
918  if (CAST_SIZE(mChatHistoryIndex) + 1 < tabSize)
919  {
921  }
922  else if (CAST_SIZE(mChatHistoryIndex) < tabSize)
923  {
925  mChatInput->setText("");
927  return;
928  }
929  else
930  {
931  mChatHistoryIndex = 0;
932  }
933 
934  unsigned int f = 0;
935  for (std::list<std::string>::const_iterator
936  it = rows.begin(), it_end = rows.end();
937  it != it_end; ++it, f++)
938  {
939  if (f == mChatHistoryIndex)
940  mChatInput->setText(*it);
941  }
943  mChatInput->getText().length()));
944  }
945  }
946  else if (actionId == InputAction::GUI_F1)
947  {
948  if (emoteWindow != nullptr)
949  {
951  emoteWindow->hide();
952  else
953  emoteWindow->show();
954  }
955  }
956  ifKey(InputAction::GUI_F2, "\u2318")
957  ifKey(InputAction::GUI_F3, "\u263A")
958  ifKey(InputAction::GUI_F4, "\u2665")
959  ifKey(InputAction::GUI_F5, "\u266A")
960  ifKey(InputAction::GUI_F6, "\u266B")
961  ifKey(InputAction::GUI_F7, "\u26A0")
962  ifKey(InputAction::GUI_F8, "\u2622")
963  ifKey(InputAction::GUI_F9, "\u262E")
964  ifKey(InputAction::GUI_F10, "\u2605")
965  ifKey(InputAction::GUI_F11, "\u2618")
966  ifKey(InputAction::GUI_F12, "\u2592")
967 
968  if (inputManager.isActionActive(InputAction::GUI_CTRL))
969  {
970  if (actionId == InputAction::GUI_B)
971  {
972  std::string inputText = mChatInput->getTextBeforeCaret();
973  toLower(inputText);
974  const size_t idx = inputText.rfind("##b");
975  if (idx == std::string::npos
976  || mChatInput->getTextBeforeCaret().substr(idx, 3) == "##b")
977  {
978  temp = "##B";
979  }
980  else
981  {
982  temp = "##b";
983  }
984  }
985  }
986 
987  if (!temp.empty())
988  addInputText(temp, false);
989 }
#define CAST_U32
Definition: cast.h:30
const bool Visible_true
Definition: visible.h:29
if(!vert) return
void setCaretPosition(unsigned int position)
Definition: textfield.cpp:751
void autoComplete()
#define ifKey(key, str)
Definition: chatwindow.cpp:811
void setText(const std::string &text)
Definition: textfield.cpp:802
Visible mVisible
Definition: widget.h:962
bool hasRows() const
Definition: chattab.h:152
std::string getTextBeforeCaret() const
Definition: textfield.h:206
const bool Visible_false
Definition: visible.h:29
EmoteWindow * emoteWindow
Definition: emotewindow.cpp:48
std::string toLower(std::string const &s)
InputAction ::T InputActionT
Definition: inputaction.h:715
History::iterator HistoryIterator
Definition: chatwindow.h:370
bool addCurrentToHistory()
Definition: chatwindow.cpp:993
HistoryIterator mCurHist
Definition: chatwindow.h:372
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
History mHistory
Definition: chatwindow.h:371
#define CAST_SIZE
Definition: cast.h:33
InputManager inputManager
void processVisible(const Visible n)
Definition: chatinput.h:74
ChatInput * mChatInput
Definition: chatwindow.h:346
unsigned int mChatHistoryIndex
Definition: chatwindow.h:390
const std::string & getText() const
Definition: textfield.h:223
const std::list< std::string > & getRows() const
Definition: chattab.h:149
void addInputText(const std::string &text, const bool space)

◆ loadCommandsFile()

void ChatWindow::loadCommandsFile ( const std::string &  name)
private

Definition at line 237 of file chatwindow.cpp.

References VirtFs::loadTextFile(), mCommands, and ServerCommandType::str.

Referenced by fillCommands(), and loadGMCommands().

238 {
239  StringVect list;
240  VirtFs::loadTextFile(name, list);
241  StringVectCIter it = list.begin();
242  const StringVectCIter it_end = list.end();
243 
244  while (it != it_end)
245  {
246  const std::string str = *it;
247  if (!str.empty())
248  mCommands.push_back(str);
249  ++ it;
250  }
251 }
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
std::vector< std::string > StringVect
Definition: stringvector.h:28
History mCommands
Definition: chatwindow.h:376
bool loadTextFile(const std::string &fileName, StringVect &lines)
Definition: tools.cpp:136

◆ loadCustomList()

void ChatWindow::loadCustomList ( )

Definition at line 1955 of file chatwindow.cpp.

References mCustomWords, Settings::serverConfigDir, settings, and ServerCommandType::str.

Referenced by ChatWindow(), and setReturnTogglesChat().

1956 {
1957  std::ifstream listFile;
1958  struct stat statbuf;
1959 
1960  std::string listName = settings.serverConfigDir
1961  + "/customwords.txt";
1962 
1963  if ((stat(listName.c_str(), &statbuf) == 0) && S_ISREG(statbuf.st_mode))
1964  {
1965  listFile.open(listName.c_str(), std::ios::in);
1966  if (listFile.is_open())
1967  {
1968  char line[101];
1969  while (listFile.getline(line, 100))
1970  {
1971  std::string str = line;
1972  if (!str.empty())
1973  mCustomWords.push_back(str);
1974  }
1975  }
1976  listFile.close();
1977  }
1978 }
History mCustomWords
Definition: chatwindow.h:377
Settings settings
Definition: settings.cpp:31
std::string serverConfigDir
Definition: settings.h:115

◆ loadGMCommands()

void ChatWindow::loadGMCommands ( )

Definition at line 259 of file chatwindow.cpp.

References loadCommandsFile(), and mGMLoaded.

Referenced by ChatWindow(), LocalPlayer::setGroupId(), and setReturnTogglesChat().

260 {
261  if (mGMLoaded)
262  return;
263 
264  loadCommandsFile("gmcommands.txt");
265  mGMLoaded = true;
266 }
void loadCommandsFile(const std::string &name)
Definition: chatwindow.cpp:237
bool mGMLoaded
Definition: chatwindow.h:393

◆ loadState()

void ChatWindow::loadState ( )

Definition at line 1875 of file chatwindow.cpp.

References addChatTab(), ConfigurationObject::getValue(), serverConfig, ChatTab::setAllowHighlight(), ChatTab::setNoAway(), ChatTab::setRemoveNames(), and Catch::toString().

Referenced by createGuiWindows(), and setReturnTogglesChat().

1876 {
1877  int num = 0;
1878  while (num < 50)
1879  {
1880  const std::string nick = serverConfig.getValue(
1881  "chatWhisper" + toString(num), "");
1882 
1883  if (nick.empty())
1884  break;
1885 
1886  const int flags = serverConfig.getValue(
1887  "chatWhisperFlags" + toString(num), 1);
1888 
1889  ChatTab *const tab = addChatTab(nick, false, false);
1890  if (tab != nullptr)
1891  {
1892  tab->setAllowHighlight((flags & 1) != 0);
1893  tab->setRemoveNames(((flags & 2) / 2) != 0);
1894  tab->setNoAway(((flags & 4) / 4) != 0);
1895  }
1896  num ++;
1897  }
1898 }
Configuration serverConfig
ChatTab * addChatTab(const std::string &name, const bool switchTo, const bool join)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
std::string getValue(const std::string &key, const std::string &deflt) const
void setRemoveNames(const bool n)
Definition: chattab.h:166
void setNoAway(const bool n)
Definition: chattab.h:172
void setAllowHighlight(const bool n)
Definition: chattab.h:160

◆ localChatInput()

void ChatWindow::localChatInput ( const std::string &  msg) const

Passes the text to the local chat tab as input

Parameters
msgThe message text which is to be sent.

Definition at line 686 of file chatwindow.cpp.

References ChatTab::chatInput(), chatInput(), and localChatTab.

Referenced by WhoIsOnline::handleLink(), ActorManager::heal(), SpellManager::invokeCommand(), SpellManager::invokeSpell(), ActorManager::itenplz(), Actions::splitWhisper(), and LocalPlayer::tryMagic().

687 {
688  if (localChatTab != nullptr)
690  else
691  chatInput(msg);
692 }
ChatTab * localChatTab
Definition: chattab.cpp:61
bool msg(InputEvent &event)
Definition: chat.cpp:38
void chatInput(const std::string &msg)
Definition: chattab.cpp:381
void chatInput(const std::string &msg) const
Definition: chatwindow.cpp:660

◆ mouseDragged()

void ChatWindow::mouseDragged ( MouseEvent event)
virtual

Handles mouse when dragged.

Reimplemented from Window.

Definition at line 794 of file chatwindow.cpp.

References Window::canMove(), Widget::getHeight(), Widget::getWidth(), MouseEvent::getX(), Widget::getX(), MouseEvent::getY(), Widget::getY(), InputGuiEvent::isConsumed(), Window::isMovable(), mainGraphics, Window::mDragOffsetX, Window::mDragOffsetY, Graphics::mHeight, Window::mMoved, Window::mouseDragged(), Graphics::mWidth, and Widget::setPosition().

795 {
796  Window::mouseDragged(event);
797 
798  if (event.isConsumed())
799  return;
800 
801  if (canMove() && isMovable() && mMoved)
802  {
803  int newX = std::max(0, getX() + event.getX() - mDragOffsetX);
804  int newY = std::max(0, getY() + event.getY() - mDragOffsetY);
805  newX = std::min(mainGraphics->mWidth - getWidth(), newX);
806  newY = std::min(mainGraphics->mHeight - getHeight(), newY);
807  setPosition(newX, newY);
808  }
809 }
int getWidth() const
Definition: widget.h:220
int mDragOffsetY
Definition: window.h:641
int getY() const
Definition: widget.h:287
int mWidth
Definition: graphics.h:483
bool mMoved
Definition: window.h:646
int mDragOffsetX
Definition: window.h:634
bool isMovable() const
Definition: window.h:575
bool canMove() const
Definition: window.cpp:972
Graphics * mainGraphics
Definition: graphics.cpp:108
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int mHeight
Definition: graphics.h:484
bool isConsumed() const
int getY() const
Definition: mouseevent.h:137
int getX() const
Definition: widget.h:268
void mouseDragged(MouseEvent &event)
Definition: window.cpp:977
int getHeight() const
Definition: widget.h:239
int getX() const
Definition: mouseevent.h:126

◆ mouseEntered()

void ChatWindow::mouseEntered ( MouseEvent event)
virtual

Called when the mouse has entered into the widget area.

Parameters
eventDescribes the event.

Reimplemented from Window.

Definition at line 2069 of file chatwindow.cpp.

References mHaveMouse, and Window::mouseEntered().

Referenced by clearAwayLog().

2070 {
2071  mHaveMouse = true;
2072  Window::mouseEntered(event);
2073 }
void mouseEntered(MouseEvent &event)
Definition: window.cpp:914
bool mHaveMouse
Definition: chatwindow.h:394

◆ mouseExited()

void ChatWindow::mouseExited ( MouseEvent event)
virtual

When the mouse leaves the window this ensures that the custom cursor is restored back to it's standard image.

Reimplemented from Window.

Definition at line 2075 of file chatwindow.cpp.

References Window::mouseExited(), and updateVisibility().

Referenced by clearAwayLog().

2076 {
2077  updateVisibility();
2078  Window::mouseExited(event);
2079 }
void updateVisibility()
void mouseExited(MouseEvent &event)
Definition: window.cpp:919

◆ mouseMoved()

void ChatWindow::mouseMoved ( MouseEvent event)
virtual

Implements custom cursor image changing context, based on mouse relative position.

Reimplemented from Window.

Definition at line 2063 of file chatwindow.cpp.

References mHaveMouse, and Window::mouseMoved().

Referenced by clearAwayLog().

2064 {
2065  mHaveMouse = true;
2066  Window::mouseMoved(event);
2067 }
void mouseMoved(MouseEvent &event)
Definition: window.cpp:962
bool mHaveMouse
Definition: chatwindow.h:394

◆ mousePressed()

void ChatWindow::mousePressed ( MouseEvent event)
virtual

Handles mouse when pressed.

Reimplemented from Window.

Definition at line 738 of file chatwindow.cpp.

References InputAction::CHAT_MOD, InputAction::CLOSE_CHAT_TAB, InputManager::executeChatCommand(), MouseEvent::getButton(), getFocused(), TabbedArea::getSelectedTab(), gui, inputManager, InputManager::isActionActive(), InputGuiEvent::isConsumed(), Window::isResizeAllowed(), MouseButton::LEFT, mChatTabs, Window::mDragOffsetX, Window::mDragOffsetY, Viewport::mMouseX, Viewport::mMouseY, Window::mMoved, Window::mousePressed(), popupMenu, Gui::resetClickCount(), MouseButton::RIGHT, PopupMenu::showChatPopup(), toggleChatFocus(), and viewport.

739 {
740  if (event.isConsumed())
741  return;
742 
743  if (event.getButton() == MouseButton::RIGHT)
744  {
745  if (popupMenu != nullptr)
746  {
747  ChatTab *const cTab = dynamic_cast<ChatTab*>(
749  if (cTab != nullptr)
750  {
751  event.consume();
753  {
756  std::string(), cTab);
757  }
758  else
759  {
761  viewport->mMouseY,
762  cTab);
763  }
764  }
765  }
766  }
767 
768  Window::mousePressed(event);
769 
770  if (event.isConsumed())
771  return;
772 
773  if (event.getButton() == MouseButton::LEFT)
774  {
775  const int clicks = event.getClickCount();
776  if (clicks == 2)
777  {
778  toggleChatFocus();
779  if (gui != nullptr)
780  gui->resetClickCount();
781  }
782  else if (clicks == 1)
783  {
784  const ChatTab *const tab = getFocused();
785  if (tab != nullptr)
786  mMoved = !isResizeAllowed(event);
787  }
788  }
789 
790  mDragOffsetX = event.getX();
791  mDragOffsetY = event.getY();
792 }
void showChatPopup(const int x, const int y, ChatTab *const tab)
Definition: popupmenu.cpp:912
int mDragOffsetY
Definition: window.h:641
Gui * gui
Definition: gui.cpp:110
MouseButtonT getButton() const
Definition: mouseevent.h:115
bool mMoved
Definition: window.h:646
int mMouseX
Definition: viewport.h:153
int mDragOffsetX
Definition: window.h:634
bool isActionActive(const InputActionT index) const
TabbedArea * mChatTabs
Definition: chatwindow.h:343
void toggleChatFocus()
PopupMenu * popupMenu
Definition: popupmenu.cpp:102
void resetClickCount()
Definition: gui.cpp:978
bool isConsumed() const
int mMouseY
Definition: viewport.h:154
ChatTab * getFocused() const
Definition: chatwindow.cpp:352
bool isResizeAllowed(const MouseEvent &event) const
Definition: window.cpp:1340
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
void mousePressed(MouseEvent &event)
Definition: window.cpp:831
InputManager inputManager
bool executeChatCommand(const std::string &cmd, const std::string &args, ChatTab *const tab)
Viewport * viewport
Definition: viewport.cpp:35

◆ nextTab()

void ChatWindow::nextTab ( )

Switch to the next tab in order

Definition at line 382 of file chatwindow.cpp.

References TabbedArea::getNumberOfTabs(), TabbedArea::getSelectedTabIndex(), mChatTabs, and TabbedArea::setSelectedTabByIndex().

Referenced by Actions::outString().

383 {
384  if (mChatTabs == nullptr)
385  return;
386 
387  int tab = mChatTabs->getSelectedTabIndex();
388 
389  tab++;
390  if (tab == mChatTabs->getNumberOfTabs())
391  tab = 0;
392 
394 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:168
TabbedArea * mChatTabs
Definition: chatwindow.h:343
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:448
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:314

◆ optionChanged()

void ChatWindow::optionChanged ( const std::string &  name)
virtual

Called when an option changed. The config listener will have to be registered to the option name first.

Implements ConfigListener.

Definition at line 2051 of file chatwindow.cpp.

References config, Configuration::getBoolValue(), mAutoHide, mEnableTradeFilter, mShowBattleEvents, and parseGlobalsFilter().

Referenced by clearAwayLog().

2052 {
2053  if (name == "autohideChat")
2054  mAutoHide = config.getBoolValue("autohideChat");
2055  else if (name == "showBattleEvents")
2056  mShowBattleEvents = config.getBoolValue("showBattleEvents");
2057  else if (name == "globalsFilter")
2059  else if (name == "enableTradeFilter")
2060  mEnableTradeFilter = config.getBoolValue("enableTradeFilter");
2061 }
Configuration config
bool mShowBattleEvents
Definition: chatwindow.h:396
void parseGlobalsFilter()
bool getBoolValue(const std::string &key) const
bool mAutoHide
Definition: chatwindow.h:395
bool mEnableTradeFilter
Definition: chatwindow.h:398

◆ parseGlobalsFilter()

void ChatWindow::parseGlobalsFilter ( )

Definition at line 2020 of file chatwindow.cpp.

References config, Being::getName(), Configuration::getStringValue(), localPlayer, mGlobalsFilter, mHighlights, and splitToStringVector().

Referenced by ChatWindow(), clearAwayLog(), and optionChanged().

2021 {
2022  mGlobalsFilter.clear();
2023  if (localPlayer == nullptr)
2024  return;
2025 
2027  "globalsFilter"), ',');
2028 
2029  mHighlights.push_back(localPlayer->getName());
2030 }
std::string getStringValue(const std::string &key) const
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
StringVect mGlobalsFilter
Definition: chatwindow.h:386
Configuration config
StringVect mHighlights
Definition: chatwindow.h:385
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:231

◆ parseHighlights()

void ChatWindow::parseHighlights ( )

Definition at line 2008 of file chatwindow.cpp.

References config, Being::getName(), Configuration::getStringValue(), localPlayer, mHighlights, and splitToStringVector().

Referenced by Setup_Chat::apply(), ChatWindow(), and clearAwayLog().

2009 {
2010  mHighlights.clear();
2011  if (localPlayer == nullptr)
2012  return;
2013 
2015  "highlightWords"), ',');
2016 
2017  mHighlights.push_back(localPlayer->getName());
2018 }
std::string getStringValue(const std::string &key) const
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
Configuration config
StringVect mHighlights
Definition: chatwindow.h:385
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:231

◆ postConnection()

void ChatWindow::postConnection ( )

Definition at line 1346 of file chatwindow.cpp.

References chatHandler, FOR_EACH, ChatTab::getChannelName(), Net::ChatHandler::joinChannel(), langChatTab, and mChannels.

Referenced by clearAwayLog(), and Game::Game().

1347 {
1348  FOR_EACH (ChannelMap::const_iterator, iter, mChannels)
1349  {
1350  ChatTab *const tab = iter->second;
1351  if (tab == nullptr)
1352  return;
1354  }
1355  if (langChatTab != nullptr)
1357 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
LangTab * langChatTab
Definition: langtab.cpp:27
const std::string & getChannelName() const
Definition: chattab.h:182
ChannelMap mChannels
Definition: chatwindow.h:368
Net::ChatHandler * chatHandler
Definition: net.cpp:82
virtual void joinChannel(const std::string &channel) const =0

◆ postInit()

void ChatWindow::postInit ( )
virtual

Reimplemented from Window.

Definition at line 227 of file chatwindow.cpp.

References BasicContainer2::add(), mChatButton, mChatInput, mChatTabs, mColorPicker, Window::postInit(), and updateVisibility().

Referenced by clearAwayLog().

228 {
230  add(mChatTabs);
231  add(mChatInput);
232  add(mColorPicker);
233  add(mChatButton);
235 }
void updateVisibility()
Button * mChatButton
Definition: chatwindow.h:383
DropDown * mColorPicker
Definition: chatwindow.h:382
TabbedArea * mChatTabs
Definition: chatwindow.h:343
virtual void add(Widget *const widget)
ChatInput * mChatInput
Definition: chatwindow.h:346
void postInit()
Definition: window.cpp:248

◆ prevTab()

void ChatWindow::prevTab ( )

Switch to the previous tab in order

Definition at line 368 of file chatwindow.cpp.

References TabbedArea::getNumberOfTabs(), TabbedArea::getSelectedTabIndex(), mChatTabs, and TabbedArea::setSelectedTabByIndex().

Referenced by Actions::outString().

369 {
370  if (mChatTabs == nullptr)
371  return;
372 
373  int tab = mChatTabs->getSelectedTabIndex();
374 
375  if (tab <= 0)
376  tab = mChatTabs->getNumberOfTabs();
377  tab--;
378 
380 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:168
TabbedArea * mChatTabs
Definition: chatwindow.h:343
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:448
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:314

◆ removeAllChannels()

void ChatWindow::removeAllChannels ( )

Definition at line 624 of file chatwindow.cpp.

References FOR_EACH, and mChannels.

Referenced by setReturnTogglesChat(), and ~ChatWindow().

625 {
626  std::list<ChatTab*> tabs;
627 
628  FOR_EACH (ChannelMap::iterator, iter, mChannels)
629  tabs.push_back(iter->second);
630 
631  for (std::list<ChatTab*>::iterator it = tabs.begin();
632  it != tabs.end(); ++it)
633  {
634  delete *it;
635  }
636 
637  mChannels.clear();
638 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
ChannelMap mChannels
Definition: chatwindow.h:368

◆ removeAllWhispers()

void ChatWindow::removeAllWhispers ( )

Definition at line 608 of file chatwindow.cpp.

References FOR_EACH, and mWhispers.

Referenced by Actions::outString(), setReturnTogglesChat(), and ~ChatWindow().

609 {
610  std::list<ChatTab*> tabs;
611 
612  FOR_EACH (TabMap::iterator, iter, mWhispers)
613  tabs.push_back(iter->second);
614 
615  for (std::list<ChatTab*>::iterator it = tabs.begin();
616  it != tabs.end(); ++it)
617  {
618  delete *it;
619  }
620 
621  mWhispers.clear();
622 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
TabMap mWhispers
Definition: chatwindow.h:367

◆ removeChannel()

void ChatWindow::removeChannel ( const std::string &  nick)
protected

Definition at line 600 of file chatwindow.cpp.

References chatHandler, mChannels, Net::ChatHandler::partChannel(), and Catch::toLower().

Referenced by ChannelTab::~ChannelTab().

601 {
602  std::string tempName = name;
603  toLower(tempName);
604  mChannels.erase(tempName);
605  chatHandler->partChannel(name);
606 }
std::string toLower(std::string const &s)
ChannelMap mChannels
Definition: chatwindow.h:368
Net::ChatHandler * chatHandler
Definition: net.cpp:82
virtual void partChannel(const std::string &channel) const =0

◆ removeTab()

void ChatWindow::removeTab ( ChatTab *const  tab)
protected

Remove the given tab from the window

Definition at line 579 of file chatwindow.cpp.

References mChatTabs, and TabbedArea::removeTab().

Referenced by ChatTab::~ChatTab().

580 {
581  mChatTabs->removeTab(tab);
582 }
void removeTab(Tab *const tab)
Definition: tabbedarea.cpp:322
TabbedArea * mChatTabs
Definition: chatwindow.h:343

◆ removeWhisper()

void ChatWindow::removeWhisper ( const std::string &  nick)
protected

Definition at line 593 of file chatwindow.cpp.

References mWhispers, and Catch::toLower().

Referenced by WhisperTab::~WhisperTab().

594 {
595  std::string tempNick = nick;
596  toLower(tempNick);
597  mWhispers.erase(tempNick);
598 }
std::string toLower(std::string const &s)
TabMap mWhispers
Definition: chatwindow.h:367

◆ requestChatFocus()

bool ChatWindow::requestChatFocus ( )

Request focus for typing chat message.

Returns
true if the input was shown false otherwise

Definition at line 548 of file chatwindow.cpp.

References Widget::isFocused(), Widget::isVisible(), Window::isWindowVisible(), mChatInput, mTmpVisible, ChatInput::processVisible(), Widget::requestFocus(), setVisible(), unHideWindow(), and Visible_true.

Referenced by addInputText(), Actions::outString(), and toggleChatFocus().

549 {
550  // Make sure chatWindow is visible
551  if (!isWindowVisible())
552  {
554 
555  /*
556  * This is used to hide chatWindow after sending the message. There is
557  * a trick here, because setVisible will set mTmpVisible to false, you
558  * have to put this sentence *after* setVisible, not before it
559  */
560  mTmpVisible = true;
561  }
562 
563  // Don't do anything else if the input is already visible and has focus
565  return false;
566 
567  // Give focus to the chat input
569  unHideWindow();
571  return true;
572 }
void setVisible(Visible visible)
const bool Visible_true
Definition: visible.h:29
void unHideWindow()
virtual bool isFocused() const
Definition: widget.cpp:183
virtual void requestFocus()
Definition: widget.cpp:203
bool isWindowVisible() const
Definition: window.h:483
bool isVisible() const
Definition: widget.h:377
bool mTmpVisible
Definition: chatwindow.h:399
void processVisible(const Visible n)
Definition: chatinput.h:74
ChatInput * mChatInput
Definition: chatwindow.h:346

◆ resortChatLog()

bool ChatWindow::resortChatLog ( std::string  line,
ChatMsgTypeT  own,
const std::string &  channel,
const IgnoreRecord  ignoreRecord,
const TryRemoveColors  tryRemoveColors 
)

Definition at line 1587 of file chatwindow.cpp.

References _, ChatMsgType::BY_OTHER, ChatMsgType::BY_PLAYER, ChatMsgType::BY_SERVER, ChatMsgType::BY_UNKNOWN, ServerCommandType::channel, channelChatLog(), ChatTab::chatLog(), findI(), ChatTab::getChannelName(), Being::getName(), Net::getNetworkType(), langChatTab, localChatTab, localPlayer, mEnableTradeFilter, mShowAllLang, mTradeFilter, replaceAll(), ServerType::TMWATHENA, and tradeChatTab.

Referenced by TmwAthena::ChatRecv::processBeingChat(), EAthena::ChatRecv::processBeingChat(), TmwAthena::ChatRecv::processChatContinue(), EAthena::ChatRecv::processChatContinue(), and setReturnTogglesChat().

1592 {
1593  if (own == ChatMsgType::BY_UNKNOWN)
1594  {
1595  const size_t pos = line.find(" : ");
1596  if (pos != std::string::npos)
1597  {
1598  if (line.length() <= pos + 3)
1599  own = ChatMsgType::BY_SERVER;
1600  else if (line.substr(0, pos) == localPlayer->getName())
1601  own = ChatMsgType::BY_PLAYER;
1602  else
1603  own = ChatMsgType::BY_OTHER;
1604  }
1605  else
1606  {
1607  own = ChatMsgType::BY_SERVER;
1608  }
1609  }
1610 
1611  std::string prefix;
1612  if (!channel.empty())
1613  {
1614  prefix = std::string("##3").append(channel).append("##0");
1615  }
1616  else if (mEnableTradeFilter &&
1617  (tradeChatTab != nullptr) &&
1618  findI(line, mTradeFilter) != std::string::npos)
1619  {
1620  // TRANSLATORS: prefix for moved message to trade tab.
1621  tradeChatTab->chatLog(std::string("##S") + _("Moved: ") + line,
1622  own,
1623  ignoreRecord,
1624  tryRemoveColors);
1625  if (own == ChatMsgType::BY_PLAYER)
1626  {
1627  own = ChatMsgType::BY_SERVER;
1628  // TRANSLATORS: moved message to trade tab warning.
1629  line = _("Your message was moved to trade tab");
1630  }
1631  else
1632  {
1633  return false;
1634  }
1635  }
1636 
1637  size_t idx2 = line.find(": ");
1638  if (idx2 != std::string::npos)
1639  {
1640  std::string tmpNick = line.substr(0, idx2);
1641  if (tmpNick.find('#') != std::string::npos ||
1642  tmpNick.find(':') != std::string::npos ||
1643  tmpNick.find('%') != std::string::npos ||
1644  tmpNick.find('@') != std::string::npos ||
1645  tmpNick.size() < 5 ||
1646  tmpNick[0] == '@' ||
1647  tmpNick[0] == '/' ||
1648  tmpNick[0] == '!'
1649  )
1650  {
1651  replaceAll(tmpNick, "#", "_");
1652  replaceAll(tmpNick, "%", "_");
1653  // TRANSLATORS: error message
1654  line = _("Broken nick detected: ") + line;
1655  own = ChatMsgType::BY_SERVER;
1656  }
1657  const size_t idx = line.find(": \302\202");
1658  if (idx == idx2)
1659  {
1660  if (line.find(": \302\202\302") != std::string::npos)
1661  {
1662  if (line.find(": \302\202\302e") != std::string::npos)
1663  {
1664  // Do nothing. Before was local pet emote
1665  }
1666  else if (line.find(": \302\202\302m") != std::string::npos)
1667  {
1668  // Do nothing. Before was local pet move
1669  }
1670  else if (line.find(": \302\202\302d") != std::string::npos)
1671  {
1672  // Do nothing. Before was local pet direction
1673  }
1674  else if (line.find(": \302\202\302a") != std::string::npos)
1675  {
1676  // Do nothing. Before was local pet ai enable/disable
1677  }
1678  // ignore other special message formats.
1679  return false;
1680  }
1681 
1682  // pet talk message detected
1683  if (line.find(": \302\202\303 ") != std::string::npos)
1684  {
1685  // Do nothing. Before was local pet talk
1686  return false;
1687  }
1688  if (line.find(": \302\202\304") != std::string::npos)
1689  {
1690  replaceAll(line, ": \302\202\304", ": ");
1691  }
1692 
1693  if (tradeChatTab != nullptr)
1694  {
1695  line = line.erase(idx + 2, 2);
1696  tradeChatTab->chatLog(prefix + line,
1697  own,
1698  ignoreRecord,
1699  tryRemoveColors);
1700  }
1701  else if (localChatTab != nullptr)
1702  {
1703  line = line.erase(idx + 2, 2);
1704  localChatTab->chatLog(prefix + line,
1705  own,
1706  ignoreRecord,
1707  tryRemoveColors);
1708  }
1709  return false;
1710  }
1711  }
1712 
1713  if (!channel.empty())
1714  {
1715  if (langChatTab != nullptr)
1716  {
1718  {
1719  langChatTab->chatLog(line,
1720  own,
1721  ignoreRecord,
1722  tryRemoveColors);
1723  }
1724  else if (mShowAllLang)
1725  {
1726  langChatTab->chatLog(prefix + line,
1727  own,
1728  ignoreRecord,
1729  tryRemoveColors);
1730  }
1731  }
1733  {
1734  channelChatLog(channel, line, own, ignoreRecord, tryRemoveColors);
1735  return false;
1736  }
1737  else if (mShowAllLang)
1738  {
1739  localChatTab->chatLog(prefix + line,
1740  own,
1741  ignoreRecord,
1742  tryRemoveColors);
1743  }
1744  }
1745  else if (localChatTab != nullptr)
1746  {
1747  localChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1748  }
1749  return true;
1750 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
LangTab * langChatTab
Definition: langtab.cpp:27
TradeTab * tradeChatTab
Definition: tradetab.cpp:35
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
const std::string & getChannelName() const
Definition: chattab.h:182
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
StringVect mTradeFilter
Definition: chatwindow.h:379
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:231
ServerTypeT getNetworkType()
Definition: net.cpp:182
bool mEnableTradeFilter
Definition: chatwindow.h:398
bool mShowAllLang
Definition: chatwindow.h:397
size_t findI(std::string str, std::string subStr)
void channelChatLog(const std::string &channel, const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)

◆ safeDraw()

void ChatWindow::safeDraw ( Graphics *const  graphics)
virtual

Reimplemented from Window.

Definition at line 2093 of file chatwindow.cpp.

References BLOCK_END, BLOCK_START, GLDEBUG_END, GLDEBUG_START, mAutoHide, mHaveMouse, and Window::safeDraw().

Referenced by clearAwayLog().

2094 {
2095  BLOCK_START("ChatWindow::draw")
2096  if (!mAutoHide || mHaveMouse)
2097  {
2098  GLDEBUG_START("ChatWindow::draw");
2099  Window::safeDraw(graphics);
2100  GLDEBUG_END();
2101  }
2102  BLOCK_END("ChatWindow::draw")
2103 }
#define BLOCK_START(name)
Definition: perfomance.h:78
#define GLDEBUG_START(text)
Definition: opengldebug.h:34
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
bool mAutoHide
Definition: chatwindow.h:395
bool mHaveMouse
Definition: chatwindow.h:394
#define GLDEBUG_END()
Definition: opengldebug.h:35
void safeDraw(Graphics *const graphics)
Definition: window.cpp:422

◆ saveState()

void ChatWindow::saveState ( ) const

Definition at line 1900 of file chatwindow.cpp.

References ConfigurationObject::deleteKey(), mChannels, mWhispers, saveTab(), serverConfig, and Catch::toString().

Referenced by SetupWindow::action(), addWhisper(), Actions::changeRelation(), channelChatLog(), AvatarListBox::mousePressed(), Actions::outString(), setReturnTogglesChat(), Actions::splitWhisper(), and ~ChatWindow().

1901 {
1902  int num = 0;
1903  for (ChannelMap::const_iterator iter = mChannels.begin(),
1904  iter_end = mChannels.end(); iter != iter_end && num < 50; ++iter)
1905  {
1906  if (iter->second == nullptr)
1907  return;
1908  if (!saveTab(num, iter->second))
1909  continue;
1910  num ++;
1911  }
1912 
1913  for (TabMap::const_iterator iter = mWhispers.begin(),
1914  iter_end = mWhispers.end(); iter != iter_end && num < 50; ++iter)
1915  {
1916  if (iter->second == nullptr)
1917  return;
1918  if (!saveTab(num, iter->second))
1919  continue;
1920  num ++;
1921  }
1922 
1923  while (num < 50)
1924  {
1925  serverConfig.deleteKey("chatWhisper" + toString(num));
1926  serverConfig.deleteKey("chatWhisperFlags" + toString(num));
1927  num ++;
1928  }
1929 }
Configuration serverConfig
ChannelMap mChannels
Definition: chatwindow.h:368
bool saveTab(const int num, const ChatTab *const tab) const
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
void deleteKey(const std::string &key)
TabMap mWhispers
Definition: chatwindow.h:367

◆ saveTab()

bool ChatWindow::saveTab ( const int  num,
const ChatTab *const  tab 
) const

Definition at line 1931 of file chatwindow.cpp.

References CAST_S32, ChatTab::getAllowHighlight(), ChatTab::getChannelName(), ChatTab::getNoAway(), ChatTab::getRemoveNames(), serverConfig, Configuration::setValue(), and Catch::toString().

Referenced by saveState(), and setReturnTogglesChat().

1933 {
1934  if (tab == nullptr)
1935  return false;
1936 
1937  serverConfig.setValue("chatWhisper" + toString(num),
1938  tab->getChannelName());
1939 
1940  serverConfig.setValue("chatWhisperFlags" + toString(num),
1941  CAST_S32(tab->getAllowHighlight())
1942  + (2 * CAST_S32(tab->getRemoveNames()))
1943  + (4 * CAST_S32(tab->getNoAway())));
1944 
1945  return true;
1946 }
const std::string & getChannelName() const
Definition: chattab.h:182
Configuration serverConfig
#define CAST_S32
Definition: cast.h:29
bool getRemoveNames() const
Definition: chattab.h:163
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
bool getNoAway() const
Definition: chattab.h:169
bool getAllowHighlight() const
Definition: chattab.h:157
void setValue(const std::string &key, const std::string &value)

◆ scheduleDelete()

void ChatWindow::scheduleDelete ( )
virtual

Schedule this window for deletion. It will be deleted at the start of the next logic update.

Reimplemented from Window.

Definition at line 2213 of file chatwindow.cpp.

References DebugMessageListener::removeListener(), and Window::scheduleDelete().

Referenced by clearAwayLog(), createGuiWindows(), and WindowManager::createWindows().

2214 {
2217 }
static void removeListener(const DebugMessageListener *const listener)
virtual void scheduleDelete()
Definition: window.cpp:826

◆ scroll()

void ChatWindow::scroll ( const int  amount) const

Scrolls the chat window

Parameters
amountdirection and amount to scroll. Negative numbers scroll up, positive numbers scroll down. The absolute amount indicates the amount of 1/8ths of chat window real estate that should be scrolled.

Definition at line 728 of file chatwindow.cpp.

References getFocused(), Window::isWindowVisible(), and ChatTab::scroll().

Referenced by Actions::outString().

729 {
730  if (!isWindowVisible())
731  return;
732 
733  ChatTab *const tab = getFocused();
734  if (tab != nullptr)
735  tab->scroll(amount);
736 }
void scroll(const int amount)
Definition: chattab.cpp:418
bool isWindowVisible() const
Definition: window.h:483
ChatTab * getFocused() const
Definition: chatwindow.cpp:352

◆ selectTabByType()

void ChatWindow::selectTabByType ( const ChatTabTypeT type)

Definition at line 396 of file chatwindow.cpp.

References TabbedArea::getNumberOfTabs(), TabbedArea::getTabByIndex(), ChatTab::getType(), mChatTabs, and TabbedArea::setSelectedTab().

Referenced by clearAwayLog(), and Actions::splitWhisper().

397 {
398  if (mChatTabs == nullptr)
399  return;
400 
401  int sz = mChatTabs->getNumberOfTabs();
402  for (int f = 0; f < sz; f ++)
403  {
404  ChatTab *const tab = dynamic_cast<ChatTab*>(
406  if ((tab != nullptr) && tab->getType() == type)
407  {
409  break;
410  }
411  }
412 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:168
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:406
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:713
TabbedArea * mChatTabs
Definition: chatwindow.h:343
ChatTabTypeT getType() const
Definition: chattab.h:144

◆ setInputText()

void ChatWindow::setInputText ( const std::string &  text)

Set the chat input as the given text.

◆ setRecordingFile()

void ChatWindow::setRecordingFile ( const std::string &  msg)

Sets the file being recorded to

Parameters
msgThe file to write out to. If null, then stop recording.

◆ setReturnTogglesChat()

void ChatWindow::setReturnTogglesChat ( const bool  toggles)
inline

◆ setVisible()

void ChatWindow::setVisible ( Visible  visible)
virtual

Override to reset mTmpVisible

Reimplemented from Window.

Definition at line 1093 of file chatwindow.cpp.

References mTmpVisible, and Window::setVisible().

Referenced by action(), WindowManager::createWindows(), and requestChatFocus().

1094 {
1095  Window::setVisible(visible);
1096 
1097  /*
1098  * For whatever reason, if setVisible is called, the mTmpVisible effect
1099  * should be disabled.
1100  */
1101  mTmpVisible = false;
1102 }
virtual void setVisible(Visible visible)
Definition: window.cpp:773
bool mTmpVisible
Definition: chatwindow.h:399

◆ showGMTab()

void ChatWindow::showGMTab ( )

Definition at line 2176 of file chatwindow.cpp.

References addSpecialChannelTab(), config, Configuration::getBoolValue(), Being::getGroupId(), Configuration::getIntValue(), GM_CHANNEL, gmChatTab, localPlayer, and paths.

Referenced by clearAwayLog(), createGuiWindows(), and LocalPlayer::setGroupId().

2177 {
2178  if ((gmChatTab == nullptr) &&
2179  config.getBoolValue("enableGmTab") &&
2180  localPlayer->getGroupId() >= paths.getIntValue("gmTabMinimalLevel"))
2181  {
2183  }
2184 }
Configuration config
int getIntValue(const std::string &key) const
bool getBoolValue(const std::string &key) const
ChatTab * addSpecialChannelTab(const std::string &name, const bool switchTo)
const std::string GM_CHANNEL
Definition: chat.h:29
LocalPlayer * localPlayer
int getGroupId() const
Definition: being.h:1090
Configuration paths
GmTab * gmChatTab
Definition: gmtab.cpp:33

◆ toggleChatFocus()

void ChatWindow::toggleChatFocus ( )
protected

Definition at line 2186 of file chatwindow.cpp.

References Widget::isFocused(), Widget::isVisible(), mChatInput, ChatInput::processVisible(), requestChatFocus(), and Visible_false.

Referenced by mousePressed().

2187 {
2190  else
2191  requestChatFocus();
2192 }
virtual bool isFocused() const
Definition: widget.cpp:183
const bool Visible_false
Definition: visible.h:29
bool requestChatFocus()
Definition: chatwindow.cpp:548
bool isVisible() const
Definition: widget.h:377
void processVisible(const Visible n)
Definition: chatinput.h:74
ChatInput * mChatInput
Definition: chatwindow.h:346

◆ unHideWindow()

void ChatWindow::unHideWindow ( )

Definition at line 2127 of file chatwindow.cpp.

References BLOCK_END, BLOCK_START, BasicContainer::logicChildren(), and mHaveMouse.

Referenced by ChatTab::chatLog(), clearAwayLog(), and requestChatFocus().

2128 {
2129  mHaveMouse = true;
2130 }
bool mHaveMouse
Definition: chatwindow.h:394

◆ updateOnline()

void ChatWindow::updateOnline ( const std::set< std::string > &  onlinePlayers) const

Definition at line 1817 of file chatwindow.cpp.

References actorManager, ActorManager::findBeingByName(), FOR_EACH, Being::getGuild(), Party::getMember(), Guild::getMember(), WhisperTab::getNick(), Avatar::getOnline(), Being::getParty(), Actions::gm(), guild, localPlayer, mWhispers, party, ActorType::Player, WhisperTab::setWhisperTabColors(), and WhisperTab::setWhisperTabOfflineColors().

Referenced by WhoIsOnline::loadList(), setReturnTogglesChat(), and WhoIsOnline::slowLogic().

1818 {
1819  const Party *party = nullptr;
1820  const Guild *guild = nullptr;
1821  if (localPlayer != nullptr)
1822  {
1823  party = localPlayer->getParty();
1824  guild = localPlayer->getGuild();
1825  }
1826  FOR_EACH (TabMap::const_iterator, iter, mWhispers)
1827  {
1828  if (iter->second == nullptr)
1829  return;
1830 
1831  WhisperTab *const tab = static_cast<WhisperTab*>(iter->second);
1832  if (tab == nullptr)
1833  continue;
1834 
1835  if (onlinePlayers.find(tab->getNick()) != onlinePlayers.end())
1836  {
1837  tab->setWhisperTabColors();
1838  }
1839  else
1840  {
1841  const std::string &nick = tab->getNick();
1842  if (actorManager != nullptr)
1843  {
1844  const Being *const being = actorManager->findBeingByName(
1845  nick, ActorType::Player);
1846  if (being != nullptr)
1847  {
1848  tab->setWhisperTabColors();
1849  continue;
1850  }
1851  }
1852  if (party != nullptr)
1853  {
1854  const PartyMember *const pm = party->getMember(nick);
1855  if ((pm != nullptr) && pm->getOnline())
1856  {
1857  tab->setWhisperTabColors();
1858  continue;
1859  }
1860  }
1861  if (guild != nullptr)
1862  {
1863  const GuildMember *const gm = guild->getMember(nick);
1864  if ((gm != nullptr) && gm->getOnline())
1865  {
1866  tab->setWhisperTabColors();
1867  continue;
1868  }
1869  }
1871  }
1872  }
1873 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
bool getOnline() const
Definition: avatar.h:80
Definition: party.h:61
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1257
Party * getParty() const
Definition: being.h:329
uint32_t party
GuildMember * getMember(const BeingId id) const
Definition: guild.cpp:139
void setWhisperTabColors()
Definition: whispertab.cpp:122
const std::string & getNick() const
Definition: whispertab.h:36
LocalPlayer * localPlayer
PartyMember * getMember(const BeingId id) const
Definition: party.cpp:98
bool gm(InputEvent &event)
Definition: commands.cpp:74
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
uint32_t guild
Definition: being.h:93
void setWhisperTabOfflineColors()
Definition: whispertab.cpp:127
Definition: guild.h:68
ActorManager * actorManager
TabMap mWhispers
Definition: chatwindow.h:367

◆ updateTabsMargin()

void ChatWindow::updateTabsMargin ( )
private

Definition at line 268 of file chatwindow.cpp.

References Widget::getWidth(), mChatTabs, mColorPicker, Widget::mVisible, TabbedArea::setRightMargin(), and Visible_true.

Referenced by adjustTabSize(), and ChatWindow().

269 {
272  else
274 }
int getWidth() const
Definition: widget.h:220
const bool Visible_true
Definition: visible.h:29
DropDown * mColorPicker
Definition: chatwindow.h:382
void setRightMargin(const int n)
Definition: tabbedarea.h:204
Visible mVisible
Definition: widget.h:962
TabbedArea * mChatTabs
Definition: chatwindow.h:343

◆ updateVisibility()

void ChatWindow::updateVisibility ( )

Definition at line 2105 of file chatwindow.cpp.

References Widget::getAbsolutePosition(), Widget::getHeight(), Gui::getMouseState(), Widget::getWidth(), gui, Widget::isVisible(), mChatInput, mHaveMouse, x, and y.

Referenced by clearAwayLog(), ChatInput::focusLost(), mouseExited(), and postInit().

2106 {
2107  if (gui == nullptr)
2108  return;
2109 
2110  int mouseX = 0;
2111  int mouseY = 0;
2112  int x = 0;
2113  int y = 0;
2114  Gui::getMouseState(mouseX, mouseY);
2115  getAbsolutePosition(x, y);
2116  if (mChatInput->isVisible())
2117  {
2118  mHaveMouse = true;
2119  }
2120  else
2121  {
2122  mHaveMouse = mouseX >= x && mouseX <= x + getWidth()
2123  && mouseY >= y && mouseY <= y + getHeight();
2124  }
2125 }
int getWidth() const
Definition: widget.h:220
Gui * gui
Definition: gui.cpp:110
virtual void getAbsolutePosition(int &x, int &y) const
Definition: widget.cpp:311
static uint8_t getMouseState(int &x, int &y)
Definition: gui.cpp:1169
bool isVisible() const
Definition: widget.h:377
int getHeight() const
Definition: widget.h:239
bool mHaveMouse
Definition: chatwindow.h:394
ChatInput * mChatInput
Definition: chatwindow.h:346

◆ widgetResized()

void ChatWindow::widgetResized ( const Event event)
virtual

Called whenever the widget changes size.

Reimplemented from Window.

Definition at line 345 of file chatwindow.cpp.

References adjustTabSize(), and Window::widgetResized().

Referenced by clearAwayLog().

346 {
347  Window::widgetResized(event);
348 
349  adjustTabSize();
350 }
void adjustTabSize()
Definition: chatwindow.cpp:276
void widgetResized(const Event &event)
Definition: window.cpp:650

Friends And Related Function Documentation

◆ ChannelTab

friend class ChannelTab
friend

Definition at line 310 of file chatwindow.h.

Referenced by addChannelTab().

◆ ChatTab

friend class ChatTab
friend

Definition at line 311 of file chatwindow.h.

◆ PopupMenu

friend class PopupMenu
friend

Definition at line 313 of file chatwindow.h.

◆ WhisperTab

friend class WhisperTab
friend

Definition at line 312 of file chatwindow.h.

Referenced by addWhisperTab().

Field Documentation

◆ mAutoHide

bool ChatWindow::mAutoHide
private

Definition at line 395 of file chatwindow.h.

Referenced by draw(), optionChanged(), and safeDraw().

◆ mAwayLog

std::list<std::string> ChatWindow::mAwayLog
private

Definition at line 384 of file chatwindow.h.

Referenced by addToAwayLog(), clearAwayLog(), and displayAwayLog().

◆ mChannels

ChannelMap ChatWindow::mChannels
private

◆ mChatButton

Button* ChatWindow::mChatButton
private

Definition at line 383 of file chatwindow.h.

Referenced by adjustTabSize(), ChatWindow(), and postInit().

◆ mChatColor

int ChatWindow::mChatColor
private

Definition at line 387 of file chatwindow.h.

Referenced by action(), addColors(), and ChatWindow().

◆ mChatHistoryIndex

unsigned int ChatWindow::mChatHistoryIndex
private

Definition at line 390 of file chatwindow.h.

Referenced by keyPressed().

◆ mChatInput

ChatInput* ChatWindow::mChatInput
protected

◆ mChatTabs

TabbedArea* ChatWindow::mChatTabs
protected

◆ mColorListModel

ColorListModel* ChatWindow::mColorListModel
private

Definition at line 381 of file chatwindow.h.

Referenced by ~ChatWindow().

◆ mColorPicker

DropDown* ChatWindow::mColorPicker
private

Definition at line 382 of file chatwindow.h.

Referenced by action(), adjustTabSize(), ChatWindow(), postInit(), updateTabsMargin(), and ~ChatWindow().

◆ mCommands

History ChatWindow::mCommands
private

Command list.

Definition at line 376 of file chatwindow.h.

Referenced by autoComplete(), fillCommands(), and loadCommandsFile().

◆ mCurHist

HistoryIterator ChatWindow::mCurHist
private

History iterator.

Definition at line 372 of file chatwindow.h.

Referenced by action(), ChatWindow(), and keyPressed().

◆ mCustomWords

History ChatWindow::mCustomWords
private

Definition at line 377 of file chatwindow.h.

Referenced by autoComplete(), and loadCustomList().

◆ mEmoteButtonSpacing

int ChatWindow::mEmoteButtonSpacing
private

Definition at line 388 of file chatwindow.h.

Referenced by adjustTabSize().

◆ mEmoteButtonY

int ChatWindow::mEmoteButtonY
private

Definition at line 389 of file chatwindow.h.

Referenced by adjustTabSize().

◆ mEnableTradeFilter

bool ChatWindow::mEnableTradeFilter
private

Definition at line 398 of file chatwindow.h.

Referenced by optionChanged(), and resortChatLog().

◆ mGlobalsFilter

StringVect ChatWindow::mGlobalsFilter
private

Definition at line 386 of file chatwindow.h.

Referenced by addGlobalMessage(), and parseGlobalsFilter().

◆ mGMLoaded

bool ChatWindow::mGMLoaded
private

Definition at line 393 of file chatwindow.h.

Referenced by loadGMCommands().

◆ mHaveMouse

bool ChatWindow::mHaveMouse
private

Definition at line 394 of file chatwindow.h.

Referenced by draw(), mouseEntered(), mouseMoved(), safeDraw(), unHideWindow(), and updateVisibility().

◆ mHighlights

StringVect ChatWindow::mHighlights
private

Definition at line 385 of file chatwindow.h.

Referenced by addToAwayLog(), findHighlight(), parseGlobalsFilter(), and parseHighlights().

◆ mHistory

History ChatWindow::mHistory
private

Command history.

Definition at line 371 of file chatwindow.h.

Referenced by action(), addCurrentToHistory(), autoCompleteHistory(), ChatWindow(), and keyPressed().

◆ mItemLinkHandler

ItemLinkHandler* ChatWindow::mItemLinkHandler
protected

Used for showing item popup on clicking links

Definition at line 340 of file chatwindow.h.

Referenced by ChatTab::ChatTab(), ChatWindow(), and ~ChatWindow().

◆ mRainbowColor

unsigned int ChatWindow::mRainbowColor
protected

Definition at line 352 of file chatwindow.h.

Referenced by addColors().

◆ mReturnToggles

bool ChatWindow::mReturnToggles
private

Definition at line 391 of file chatwindow.h.

Referenced by action(), getReturnTogglesChat(), setReturnTogglesChat(), and ~ChatWindow().

◆ mShowAllLang

bool ChatWindow::mShowAllLang
private

Definition at line 397 of file chatwindow.h.

Referenced by resortChatLog().

◆ mShowBattleEvents

bool ChatWindow::mShowBattleEvents
private

Definition at line 396 of file chatwindow.h.

Referenced by attributeChanged(), and optionChanged().

◆ mTmpVisible

bool ChatWindow::mTmpVisible
private

Definition at line 399 of file chatwindow.h.

Referenced by action(), requestChatFocus(), and setVisible().

◆ mTradeFilter

StringVect ChatWindow::mTradeFilter
private

Definition at line 379 of file chatwindow.h.

Referenced by initTradeFilter(), and resortChatLog().

◆ mWhispers

TabMap ChatWindow::mWhispers
private

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