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=true)
 
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=ChatMsgType::BY_OTHER)
 
WhisperTabaddWhisperTab (const std::string &caption, const std::string &nick, const bool switchTo=false)
 
WhisperTabgetWhisperTab (const std::string &nick) const
 
ChatTabaddChannelTab (const std::string &name, const bool switchTo=false)
 
ChatTabaddSpecialChannelTab (const std::string &name, const bool switchTo=false)
 
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="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
 
virtual ~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=0, int offsetY=0)
 
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=0, const int offsetY=0)
 
virtual void resetToDefaultSize ()
 
void adjustPositionAfterResize (const int oldScreenWidth, const int oldScreenHeight)
 
LayoutgetLayout ()
 
void clearLayout ()
 
void reflowLayout (int w=0, int h=0)
 
LayoutCellplace (const int x, const int y, Widget *const wg, const int w=1, const int h=1)
 
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)
 
virtual ~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)
 
virtual ~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)
 
virtual ~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=255U) 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=ChatMsgType::BY_UNKNOWN, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
 
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=0) const
 
bool getOptionBool (const std::string &name, const bool def=false) 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 366 of file chatwindow.h.

◆ ChatCommands

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

Definition at line 376 of file chatwindow.h.

◆ ChatCommandsIterator

typedef ChatCommands::iterator ChatWindow::ChatCommandsIterator
private

Definition at line 377 of file chatwindow.h.

◆ History

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

Definition at line 317 of file chatwindow.h.

◆ HistoryIterator

typedef History::iterator ChatWindow::HistoryIterator
private

Definition at line 372 of file chatwindow.h.

◆ TabMap

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

Definition at line 365 of file chatwindow.h.

Constructor & Destructor Documentation

◆ ChatWindow()

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

Constructor.

Definition at line 92 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.

92  :
93  // TRANSLATORS: chat window name
94  Window(_("Chat"), Modal_false, nullptr, "chat.xml"),
96  KeyListener(),
100  mChatInput(new ChatInput(this)),
101  mRainbowColor(0U),
102  mWhispers(),
103  mChannels(),
104  mHistory(),
105  mCurHist(),
106  mCommands(),
107  mCustomWords(),
108  mTradeFilter(),
111  mChatButton(new Button(this, ":)", "openemote", this)),
112  mAwayLog(),
113  mHighlights(),
114  mGlobalsFilter(),
115  mChatColor(config.getIntValue("chatColor")),
116  mEmoteButtonSpacing(mSkin != nullptr ?
117  mSkin->getOption("emoteButtonSpacing", 2) : 2),
118  mEmoteButtonY(mSkin != nullptr ?
119  mSkin->getOption("emoteButtonY", -2) : -2),
121  mReturnToggles(config.getBoolValue("ReturnToggles")),
122  mGMLoaded(false),
123  mHaveMouse(false),
124  mAutoHide(config.getBoolValue("autohideChat")),
125  mShowBattleEvents(config.getBoolValue("showBattleEvents")),
126  mShowAllLang(serverConfig.getValue("showAllLang", 0) != 0),
127  mEnableTradeFilter(config.getBoolValue("enableTradeFilter")),
128  mTmpVisible(false)
129 {
130  setWindowName(name);
131 
132  if (setupWindow != nullptr)
134 
135  setShowTitle(false);
136  setResizable(true);
137  setDefaultVisible(true);
138  setSaveVisible(true);
139  setStickyButtonLock(true);
140 
141  int w = 600;
142 #ifdef ANDROID
143  if (mainGraphics->getWidth() < 710)
144  w = mainGraphics->getWidth() - 110;
145  if (w < 100)
146  w = 100;
147  if (mainGraphics->getHeight() < 480)
148  setDefaultSize(w, 90, ImagePosition::UPPER_LEFT, -110, -35);
149  else
150  setDefaultSize(w, 123, ImagePosition::UPPER_LEFT, -110, -35);
151 #else // ANDROID
152 
153  if (mainGraphics->getWidth() < 600)
154  w = mainGraphics->getWidth() - 10;
155  if (w < 100)
156  w = 100;
158 #endif // ANDROID
159 
160  setMinWidth(150);
161  setMinHeight(90);
162 
164 
165  if (emoteWindow != nullptr)
166  emoteWindow->addListeners(this);
167 
169 
172  mChatTabs->setResizeHeight(false);
173 
174  mChatInput->setActionEventId("chatinput");
177 
181 
183 
184  loadWindowState();
185 
187  - 2 * mPadding - 8 - 16, mPadding);
188 
189  // Add key listener to chat input to be able to respond to up/down
190  mChatInput->addKeyListener(this);
191  mCurHist = mHistory.end();
193  "showChatColorsList"), Visible));
195 
196  fillCommands();
197  if ((localPlayer != nullptr) && localPlayer->isGM())
198  loadGMCommands();
199  initTradeFilter();
200  loadCustomList();
201  parseHighlights();
203 
204  config.addListener("autohideChat", this);
205  config.addListener("showBattleEvents", this);
206  config.addListener("globalsFilter", this);
207  config.addListener("enableTradeFilter", this);
208 
209  enableVisibleSound(true);
210 }
void setDefaultSize()
Definition: window.cpp:1186
#define _(s)
Definition: gettext.h:34
unsigned int mRainbowColor
Definition: chatwindow.h:354
void setDefaultVisible(const bool save)
Definition: window.h:286
int getWidth() const
Definition: widget.h:220
Skin * mSkin
Definition: window.h:641
int mPadding
Definition: window.h:610
void loadGMCommands()
Definition: chatwindow.cpp:257
void loadWindowState()
Definition: window.cpp:1075
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
int mEmoteButtonSpacing
Definition: chatwindow.h:390
StringVect mGlobalsFilter
Definition: chatwindow.h:388
void setVisible(Visible visible)
Definition: widget.cpp:224
Button * mChatButton
Definition: chatwindow.h:385
DropDown * mColorPicker
Definition: chatwindow.h:384
void setMinWidth(const int width)
Definition: window.cpp:579
Definition: button.h:94
History mCustomWords
Definition: chatwindow.h:379
void setShowTitle(bool flag)
Definition: window.h:233
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:251
bool mShowBattleEvents
Definition: chatwindow.h:398
int getWidth() const
Definition: graphics.cpp:642
void addListener(const std::string &key, ConfigListener *const listener)
void enableScrollButtons(const bool enable)
Definition: tabbedarea.cpp:141
int getOption(const std::string &name) const
Definition: skin.h:105
void registerWindowForReset(Window *const window)
void adjustSize()
Definition: button.cpp:821
StringVect mTradeFilter
Definition: chatwindow.h:381
void addListeners(ActionListener *const listener)
void parseGlobalsFilter()
TabbedArea * mChatTabs
Definition: chatwindow.h:345
int getTitlePadding() const
Definition: window.h:594
bool getBoolValue(const std::string &key) const
void updateTabsMargin()
Definition: chatwindow.cpp:266
bool mReturnToggles
Definition: chatwindow.h:393
StringVect mHighlights
Definition: chatwindow.h:387
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:397
Graphics * mainGraphics
Definition: graphics.cpp:108
int mEmoteButtonY
Definition: chatwindow.h:391
std::list< std::string > mAwayLog
Definition: chatwindow.h:386
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:473
void setMinHeight(const int height)
Definition: window.cpp:592
ChannelMap mChannels
Definition: chatwindow.h:370
void setSaveVisible(const bool save)
Definition: window.h:298
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:374
void parseHighlights()
void setAllowSpecialActions(const bool b)
Definition: textfield.h:205
History mCommands
Definition: chatwindow.h:378
ItemLinkHandler * mItemLinkHandler
Definition: chatwindow.h:342
void setAllowCommands(const bool b)
bool mHaveMouse
Definition: chatwindow.h:396
History mHistory
Definition: chatwindow.h:373
bool mEnableTradeFilter
Definition: chatwindow.h:400
void setResizable(const bool resize)
Definition: window.cpp:615
bool mTmpVisible
Definition: chatwindow.h:401
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:760
SetupWindow * setupWindow
Definition: setupwindow.cpp:63
ColorListModel * mColorListModel
Definition: chatwindow.h:383
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void setTitleBarHeight(unsigned int height)
Definition: window.h:505
int mChatColor
Definition: chatwindow.h:389
Window(const std::string &caption="Window", const Modal modal=Modal_false, Window *const parent=0, std::string skin="")
Definition: window.cpp:108
bool mShowAllLang
Definition: chatwindow.h:399
bool mGMLoaded
Definition: chatwindow.h:395
void setSelected(int selected)
Definition: dropdown.cpp:510
ChatInput * mChatInput
Definition: chatwindow.h:348
unsigned int mChatHistoryIndex
Definition: chatwindow.h:392
int getPadding() const
Definition: window.h:496
bool isGM() const
Definition: being.h:654
static const char *const ACTION_COLOR_PICKER
Definition: chatwindow.cpp:90
void setResizeHeight(bool b)
Definition: tabbedarea.h:231
void setWindowName(const std::string &name)
Definition: window.h:353
TabMap mWhispers
Definition: chatwindow.h:369

◆ ~ChatWindow()

ChatWindow::~ChatWindow ( )

Destructor: used to write back values to the config file

Definition at line 212 of file chatwindow.cpp.

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

213 {
214  config.removeListeners(this);
216  saveState();
217  config.setValue("ReturnToggles", mReturnToggles);
223 }
DropDown * mColorPicker
Definition: chatwindow.h:384
Configuration config
#define delete2(var)
Definition: delete2.h:24
bool mReturnToggles
Definition: chatwindow.h:393
void saveState() const
void removeListeners(ConfigListener *const listener)
void removeAllChannels()
Definition: chatwindow.cpp:622
ItemLinkHandler * mItemLinkHandler
Definition: chatwindow.h:342
void removeAllWhispers()
Definition: chatwindow.cpp:606
#define CHECKLISTENERS
Definition: localconsts.h:305
ColorListModel * mColorListModel
Definition: chatwindow.h:383
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 432 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.

433 {
434  const std::string &eventId = event.getId();
435  if (eventId == "chatinput")
436  {
437  std::string message = mChatInput->getText();
438 
439  if (!message.empty())
440  {
441  // If message different from previous, put it in the history
442  if (mHistory.empty() || message != mHistory.back())
443  mHistory.push_back(message);
444 
445  // Reset history iterator
446  mCurHist = mHistory.end();
447 
448  // Send the message to the server
449  chatInput(addColors(message));
450 
451  // Clear the text from the chat input
452  mChatInput->setText("");
453  }
454 
455  if (message.empty() || !mReturnToggles)
456  {
457  // Remove focus and hide input
459  if (mFocusHandler != nullptr)
461 
462  // If the chatWindow is shown up because you want to send a message
463  // It should hide now
464  if (mTmpVisible)
466  }
467  }
468  else if (eventId == "emote")
469  {
470  if (emoteWindow != nullptr)
471  {
472  const std::string str = emoteWindow->getSelectedEmote();
473  if (!str.empty())
474  {
475  addInputText(str, false);
477  }
478  }
479  }
480  else if (eventId == "openemote")
481  {
482  if (emoteWindow != nullptr)
483  {
485  emoteWindow->hide();
486  else
487  emoteWindow->show();
488  }
489  }
490  else if (eventId == "color")
491  {
492  if (emoteWindow != nullptr)
493  {
494  const std::string str = emoteWindow->getSelectedColor();
495  if (!str.empty())
496  {
497  addInputText(str, false);
499  }
500  }
501  }
502  else if (eventId == "font")
503  {
504  if (emoteWindow != nullptr)
505  {
506  const std::string str = emoteWindow->getSelectedFont();
507  if (!str.empty())
508  {
509  addInputText(str, false);
511  }
512  }
513  }
514  else if (eventId == "text")
515  {
516  if ((emoteWindow != nullptr) && (reverseDictionary != nullptr))
517  {
518  const int idx = emoteWindow->getSelectedTextIndex();
519  if (idx >= 0)
520  {
521  const std::string str = TextDb::getByIndex(idx);
522  const std::string enStr = reverseDictionary->getStr(str);
523  addInputText(enStr, false);
524  }
526  }
527  }
528  else if (eventId == ACTION_COLOR_PICKER)
529  {
530  if (mColorPicker != nullptr)
531  {
533  config.setValue("chatColor", mChatColor);
534  }
535  }
536 
537  if (mColorPicker != nullptr)
538  {
539  const Visible vis = fromBool(config.getBoolValue(
540  "showChatColorsList"), Visible);
541  if (mColorPicker->mVisible != vis)
542  mColorPicker->setVisible(vis);
543  }
544 }
void clearText()
void setVisible(Visible visible)
void clearColor()
void unprotectFocus()
Definition: chatinput.h:92
const bool Visible_true
Definition: visible.h:29
void setVisible(Visible visible)
Definition: widget.cpp:224
DropDown * mColorPicker
Definition: chatwindow.h:384
Configuration config
FocusHandler * mFocusHandler
Definition: widget.h:1115
void setText(const std::string &text)
Definition: textfield.cpp:799
void chatInput(const std::string &msg) const
Definition: chatwindow.cpp:658
Visible mVisible
Definition: widget.h:962
void clearFont()
bool getBoolValue(const std::string &key) const
void addInputText(const std::string &text, const bool space=true)
bool mReturnToggles
Definition: chatwindow.h:393
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:374
std::string getByIndex(const int index)
Definition: textdb.cpp:96
History mHistory
Definition: chatwindow.h:373
bool mTmpVisible
Definition: chatwindow.h:401
int getSelectedTextIndex() const
int mChatColor
Definition: chatwindow.h:389
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:348
const std::string & getText() const
Definition: textfield.h:225
int getSelected() const
Definition: dropdown.cpp:505
static const char *const ACTION_COLOR_PICKER
Definition: chatwindow.cpp:90
std::string getSelectedColor() const

◆ addChannelTab()

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

Definition at line 1276 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().

1278 {
1279  std::string tempName = name;
1280  toLower(tempName);
1281 
1282  ChatTab *const tab = addSpecialChannelTab(name, switchTo);
1283  if (tab != nullptr)
1284  return tab;
1285 
1286  const ChannelMap::const_iterator i = mChannels.find(tempName);
1287  ChannelTab *ret = nullptr;
1288 
1289  if (i != mChannels.end())
1290  {
1291  ret = i->second;
1292  }
1293  else
1294  {
1295  ret = new ChannelTab(this, name);
1296  mChannels[tempName] = ret;
1297  ret->setAllowHighlight(false);
1298  if (config.getBoolValue("showChatHistory"))
1299  ret->loadFromLogFile(name);
1300  }
1301 
1302  if (switchTo)
1303  mChatTabs->setSelectedTab(ret);
1304 
1305  return ret;
1306 }
Configuration config
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:398
friend class ChannelTab
Definition: chatwindow.h:312
void loadFromLogFile(const std::string &name)
Definition: chattab.cpp:508
TabbedArea * mChatTabs
Definition: chatwindow.h:345
bool getBoolValue(const std::string &key) const
std::string toLower(std::string const &s)
ChatTab * addSpecialChannelTab(const std::string &name, const bool switchTo=false)
ChannelMap mChannels
Definition: chatwindow.h:370
void setAllowHighlight(const bool n)
Definition: chattab.h:156

◆ addChatTab()

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

Definition at line 1308 of file chatwindow.cpp.

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

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

1311 {
1313  name.size() > 1 &&
1314  name[0] == '#')
1315  {
1316  ChatTab *const tab = addChannelTab(name, switchTo);
1317  if ((tab != nullptr) && join)
1318  chatHandler->joinChannel(name);
1319  return tab;
1320  }
1321  return addWhisperTab(name, name, switchTo);
1322 }
WhisperTab * addWhisperTab(const std::string &caption, const std::string &nick, const bool switchTo=false)
ServerTypeT getNetworkType()
Definition: net.cpp:178
Net::ChatHandler * chatHandler
Definition: net.cpp:80
virtual void joinChannel(const std::string &channel) const =0
ChatTab * addChannelTab(const std::string &name, const bool switchTo=false)

◆ addColors()

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

Definition at line 1369 of file chatwindow.cpp.

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

Referenced by action().

1370 {
1371  // default color or chat command
1372  if (mChatColor == 0 || msg.length() == 0 || msg.at(0) == '#'
1373  || msg.at(0) == '/' || msg.at(0) == '@' || msg.at(0) == '!')
1374  {
1375  return msg;
1376  }
1377 
1378  std::string newMsg;
1379  const int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8};
1380 
1381  // rainbow
1382  switch (mChatColor)
1383  {
1384  case 11:
1386  return newMsg;
1387  case 12:
1388  changeColor(cMap[mRainbowColor++])
1389  return newMsg;
1390  case 13:
1391  changeColor(cMap[9-mRainbowColor++])
1392  return newMsg;
1393  default:
1394  break;
1395  }
1396 
1397  // simple colors
1398  return std::string("##").append(toString(mChatColor - 1)).append(msg);
1399 }
unsigned int mRainbowColor
Definition: chatwindow.h:354
bool msg(InputEvent &event)
Definition: chat.cpp:38
#define changeColor(fun)
int mChatColor
Definition: chatwindow.h:389

◆ addCurrentToHistory()

bool ChatWindow::addCurrentToHistory ( )
private

Definition at line 988 of file chatwindow.cpp.

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

Referenced by keyPressed().

989 {
990  const std::string &str = mChatInput->getText();
991  if (str.empty())
992  return false;
994  {
995  if (*it == str)
996  return false;
997  }
998  mHistory.push_back(str);
999  return true;
1000 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
History::iterator HistoryIterator
Definition: chatwindow.h:372
History mHistory
Definition: chatwindow.h:373
ChatInput * mChatInput
Definition: chatwindow.h:348
const std::string & getText() const
Definition: textfield.h:225

◆ addGlobalMessage()

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

Definition at line 2116 of file chatwindow.cpp.

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

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

2117 {
2118  if (debugChatTab != nullptr &&
2119  findI(line, mGlobalsFilter) != std::string::npos)
2120  {
2122  }
2123  else
2124  {
2126  }
2127 }
ChatTab * localChatTab
Definition: chattab.cpp:61
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
StringVect mGlobalsFilter
Definition: chatwindow.h:388
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 = true 
)

Add the given text to the chat input.

Definition at line 1056 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().

1057 {
1058  const int caretPos = mChatInput->getCaretPosition();
1059  const std::string &inputText = mChatInput->getText();
1060 
1061  std::ostringstream ss;
1062  ss << inputText.substr(0, caretPos) << text;
1063  if (space)
1064  ss << " ";
1065 
1066  ss << inputText.substr(caretPos);
1067  mChatInput->setText(ss.str());
1068  mChatInput->setCaretPosition(caretPos + CAST_S32(
1069  text.length()) + CAST_S32(space));
1070  requestChatFocus();
1071 }
void setCaretPosition(unsigned int position)
Definition: textfield.cpp:748
void setText(const std::string &text)
Definition: textfield.cpp:799
#define CAST_S32
Definition: cast.h:29
bool requestChatFocus()
Definition: chatwindow.cpp:546
unsigned int getCaretPosition() const
Definition: textfield.h:235
ChatInput * mChatInput
Definition: chatwindow.h:348
const std::string & getText() const
Definition: textfield.h:225

◆ addItemText()

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

Called to add item to chat

Definition at line 1073 of file chatwindow.cpp.

References addInputText().

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

1074 {
1075  std::ostringstream text;
1076  text << "[" << item << "]";
1077  addInputText(text.str());
1078 }
void addInputText(const std::string &text, const bool space=true)

◆ addSpecialChannelTab()

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

Definition at line 1247 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().

1249 {
1250  ChatTab *ret = nullptr;
1251  if (name == TRADE_CHANNEL)
1252  {
1253  if (tradeChatTab == nullptr)
1254  {
1258  }
1259  ret = tradeChatTab;
1260  }
1261  else if (name == GM_CHANNEL)
1262  {
1263  if (gmChatTab == nullptr)
1264  {
1265  gmChatTab = new GmTab(chatWindow);
1267  }
1268  ret = gmChatTab;
1269  }
1270  if (switchTo)
1271  mChatTabs->setSelectedTab(ret);
1272 
1273  return ret;
1274 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:88
TradeTab * tradeChatTab
Definition: tradetab.cpp:35
const std::string & getChannelName() const
Definition: chattab.h:178
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:398
TabbedArea * mChatTabs
Definition: chatwindow.h:345
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:80
const std::string TRADE_CHANNEL
Definition: chat.h:30
void setAllowHighlight(const bool n)
Definition: chattab.h:156
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 582 of file chatwindow.cpp.

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

Referenced by ChatTab::ChatTab().

583 {
584  if (tab == nullptr)
585  return;
586 
587  mChatTabs->addTab(tab, tab->mScrollArea);
588  logic();
589 }
ScrollArea * mScrollArea
Definition: chattab.h:203
TabbedArea * mChatTabs
Definition: chatwindow.h:345
void addTab(Tab *const tab, Widget *const widget)
Definition: tabbedarea.cpp:229

◆ addToAwayLog()

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

Definition at line 1955 of file chatwindow.cpp.

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

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

1956 {
1957  if (!settings.awayMode)
1958  return;
1959 
1960  if (mAwayLog.size() > 20)
1961  mAwayLog.pop_front();
1962 
1963  if (findI(line, mHighlights) != std::string::npos)
1964  mAwayLog.push_back("##aaway:" + line);
1965 }
Settings settings
Definition: settings.cpp:31
StringVect mHighlights
Definition: chatwindow.h:387
std::list< std::string > mAwayLog
Definition: chatwindow.h:386
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 = ChatMsgType::BY_OTHER 
)

Definition at line 1091 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(), and Catch::trim().

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().

1094 {
1095  if (mes.empty() || (localPlayer == nullptr))
1096  return;
1097 
1098  std::string playerName = localPlayer->getName();
1099  std::string tempNick = nick;
1100 
1101  toLower(playerName);
1102  toLower(tempNick);
1103 
1104  if (tempNick == playerName)
1105  return;
1106 
1107  WhisperTab *tab = nullptr;
1108  const TabMap::const_iterator i = mWhispers.find(tempNick);
1109 
1110  if (i != mWhispers.end())
1111  {
1112  tab = i->second;
1113  }
1114  else if (config.getBoolValue("whispertab"))
1115  {
1116  tab = addWhisperTab(nick, nick);
1117  if (tab != nullptr)
1118  saveState();
1119  }
1120 
1121  if (tab != nullptr)
1122  {
1123  if (own == ChatMsgType::BY_PLAYER)
1124  {
1125  tab->chatInput(mes);
1126  }
1127  else if (own == ChatMsgType::BY_SERVER)
1128  {
1129  tab->chatLog(mes, ChatMsgType::BY_SERVER);
1130  }
1131  else
1132  {
1133  if (tab->getRemoveNames())
1134  {
1135  std::string msg = mes;
1136  const size_t idx = mes.find(':');
1137  if (idx != std::string::npos && idx > 0)
1138  {
1139  std::string nick2 = msg.substr(0, idx);
1140  msg = msg.substr(idx + 1);
1141  nick2 = removeColors(nick2);
1142  nick2 = trim(nick2);
1143  if (config.getBoolValue("removeColors"))
1144  msg = removeColors(msg);
1145  msg = trim(msg);
1146  tab->chatLog(nick2, msg);
1147  }
1148  else
1149  {
1150  if (config.getBoolValue("removeColors"))
1151  msg = removeColors(msg);
1152  tab->chatLog(msg, ChatMsgType::BY_SERVER);
1153  }
1154  }
1155  else
1156  {
1157  tab->chatLog(nick, mes);
1158  }
1159  localPlayer->afkRespond(tab, nick);
1160  }
1161  }
1162  else if (localChatTab != nullptr)
1163  {
1164  if (own == ChatMsgType::BY_PLAYER)
1165  {
1166  chatHandler->privateMessage(nick, mes);
1167 
1168  // TRANSLATORS: chat message
1169  localChatTab->chatLog(strprintf(_("Whispering to %s: %s"),
1170  nick.c_str(), mes.c_str()),
1172  }
1173  else
1174  {
1175  localChatTab->chatLog(std::string(nick).append(
1176  " : ").append(mes),
1179  if (localPlayer != nullptr)
1180  localPlayer->afkRespond(nullptr, nick);
1181  }
1182  }
1183 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
Configuration config
bool msg(InputEvent &event)
Definition: chat.cpp:38
std::string removeColors(std::string msg)
void chatInput(const std::string &msg)
Definition: chattab.cpp:380
WhisperTab * addWhisperTab(const std::string &caption, const std::string &nick, const bool switchTo=false)
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:159
const std::string & getName() const
Definition: being.h:233
Net::ChatHandler * chatHandler
Definition: net.cpp:80
TabMap mWhispers
Definition: chatwindow.h:369

◆ addWhisperTab()

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

Definition at line 1185 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().

1188 {
1189  if (localPlayer == nullptr)
1190  return nullptr;
1191 
1192  std::string playerName = localPlayer->getName();
1193  std::string tempNick = nick;
1194 
1195  toLower(playerName);
1196  toLower(tempNick);
1197 
1198  const TabMap::const_iterator i = mWhispers.find(tempNick);
1199  WhisperTab *ret = nullptr;
1200 
1201  if (tempNick == playerName)
1202  return nullptr;
1203 
1204  if (i != mWhispers.end())
1205  {
1206  ret = i->second;
1207  }
1208  else
1209  {
1210  ret = new WhisperTab(this, caption, nick);
1211  if ((gui != nullptr) && !playerRelations.isGoodName(nick))
1212  ret->setLabelFont(gui->getSecureFont());
1213  mWhispers[tempNick] = ret;
1214  if (config.getBoolValue("showChatHistory"))
1215  ret->loadFromLogFile(nick);
1216  }
1217 
1218  if (switchTo)
1219  mChatTabs->setSelectedTab(ret);
1220 
1221  return ret;
1222 }
friend class WhisperTab
Definition: chatwindow.h:314
Gui * gui
Definition: gui.cpp:110
Configuration config
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:398
void loadFromLogFile(const std::string &name)
Definition: chattab.cpp:508
bool isGoodName(Being *const being) const
TabbedArea * mChatTabs
Definition: chatwindow.h:345
bool getBoolValue(const std::string &key) const
LocalPlayer * localPlayer
std::string toLower(std::string const &s)
const std::string & getName() const
Definition: being.h:233
void setLabelFont(Font *const font)
Definition: tab.cpp:408
Font * getSecureFont() const
Definition: gui.h:171
PlayerRelationsManager playerRelations
TabMap mWhispers
Definition: chatwindow.h:369

◆ adjustTabSize()

void ChatWindow::adjustTabSize ( )

Definition at line 274 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().

275 {
276  const Rect area = getChildrenArea();
277 
278  const int aw = area.width;
279  const int ah = area.height;
280  const int frame = mChatInput->getFrameSize();
281  const int inputHeight = mChatInput->getHeight();
282  const bool showEmotes = config.getBoolValue("showEmotesButton");
283  int maxHeight = inputHeight;
284  if (showEmotes)
285  {
286  const int buttonHeight = mChatButton->getHeight();
287  if (buttonHeight > maxHeight)
288  maxHeight = buttonHeight;
289  }
290  const int frame2 = 2 * frame;
291  const int awFrame2 = aw - frame2;
292  int y = ah - maxHeight - frame;
293  mChatInput->setPosition(frame, y);
294  mChatTabs->setWidth(awFrame2);
295  const int height = ah - frame2 - (maxHeight + frame2);
296  if (mChatInput->mVisible == Visible_true ||
297  !config.getBoolValue("hideChatInput"))
298  {
299  mChatTabs->setHeight(height);
300  }
301  else
302  {
303  mChatTabs->setHeight(height + maxHeight);
304  }
306 
307  if (showEmotes)
308  {
309  const int chatButtonSize = mChatButton->getWidth();
310  int w = awFrame2 - chatButtonSize;
311  const int x = aw - frame - chatButtonSize;
312  w -= mEmoteButtonSpacing;
313  y += mEmoteButtonY;
314  mChatInput->setWidth(w);
316  mChatButton->setPosition(x, y);
317  }
318  else
319  {
320  mChatInput->setWidth(awFrame2);
322  }
323 
324  const ChatTab *const tab = getFocused();
325  if (tab != nullptr)
326  {
327  Widget *const content = tab->mScrollArea;
328  if (content != nullptr)
329  {
330  const int contentFrame2 = 2 * content->getFrameSize();
331  content->setSize(mChatTabs->getWidth() - contentFrame2,
332  mChatTabs->getContainerHeight() - contentFrame2);
333  content->logic();
334  }
335  }
336 
338  - 2 * mPadding - 8 - 16, mPadding);
339 
341 }
void setSize(const int width, const int height)
Definition: widget.cpp:366
void setHeight(int height)
Definition: tabbedarea.cpp:746
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:203
void setWidth(const int width)
Definition: widget.cpp:132
int mPadding
Definition: window.h:610
const bool Visible_true
Definition: visible.h:29
int mEmoteButtonSpacing
Definition: chatwindow.h:390
Rect getChildrenArea()
Definition: window.cpp:1461
void setVisible(Visible visible)
Definition: widget.cpp:224
Button * mChatButton
Definition: chatwindow.h:385
DropDown * mColorPicker
Definition: chatwindow.h:384
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:345
bool getBoolValue(const std::string &key) const
void updateTabsMargin()
Definition: chatwindow.cpp:266
const bool Visible_false
Definition: visible.h:29
void setWidth(int width)
Definition: tabbedarea.cpp:739
virtual void logic()
Definition: widget.h:192
int mEmoteButtonY
Definition: chatwindow.h:391
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int height
Definition: rect.h:223
void adjustSize()
Definition: tabbedarea.cpp:559
Definition: widget.h:97
ChatTab * getFocused() const
Definition: chatwindow.cpp:350
int getHeight() const
Definition: widget.h:239
ChatInput * mChatInput
Definition: chatwindow.h:348

◆ attributeChanged()

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

Implements AttributeListener.

Definition at line 1002 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

1005 {
1006  if (!mShowBattleEvents)
1007  return;
1008  PRAGMA45(GCC diagnostic push)
1009  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
1010  switch (id)
1011  {
1013  {
1014  if (oldVal > newVal)
1015  break;
1016  const int64_t change = newVal - oldVal;
1017  if (change != 0)
1018  {
1019  battleChatLog(std::string("+").append(toString(
1020  CAST_U64(change))).append(" xp"),
1022  }
1023  break;
1024  }
1026  battleChatLog(std::string(
1027  "Level: ").append(toString(CAST_S32(
1028  newVal))),
1030  break;
1032  {
1033  if (!config.getBoolValue("showJobExp"))
1034  return;
1035  if (oldVal > newVal ||
1038  {
1039  return;
1040  }
1041  const int64_t change = newVal - oldVal;
1042  if (change != 0)
1043  {
1044  battleChatLog(std::string("+").append(toString(CAST_U64(
1045  change))).append(" job"),
1047  }
1048  break;
1049  }
1050  default:
1051  break;
1052  };
1053  PRAGMA45(GCC diagnostic pop)
1054 }
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
static void battleChatLog(const std::string &line, ChatMsgTypeT own=ChatMsgType::BY_UNKNOWN, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
#define CAST_U64
Definition: cast.h:32
Configuration config
bool mShowBattleEvents
Definition: chatwindow.h:398
bool getBoolValue(const std::string &key) const
#define CAST_S32
Definition: cast.h:29
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100

◆ autoComplete() [1/3]

void ChatWindow::autoComplete ( )
protected

Definition at line 1403 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().

1404 {
1405  const int caretPos = mChatInput->getCaretPosition();
1406  int startName = 0;
1407  const std::string &inputText = mChatInput->getText();
1408  std::string name = inputText.substr(0, caretPos);
1409 
1410  for (int f = caretPos - 1; f > -1; f --)
1411  {
1412  if (isWordSeparator(inputText[f]))
1413  {
1414  startName = f + 1;
1415  name = inputText.substr(f + 1, caretPos - f);
1416  break;
1417  }
1418  }
1419 
1420  if (caretPos - 1 + 1 == startName)
1421  return;
1422 
1423  const ChatTab *const cTab = static_cast<ChatTab*>(
1425  StringVect nameList;
1426 
1427  if (cTab != nullptr)
1428  cTab->getAutoCompleteList(nameList);
1429  std::string newName = autoComplete(nameList, name);
1430  if (!newName.empty() && (startName == 0))
1431  secureChatCommand(newName);
1432 
1433  if ((cTab != nullptr) && newName.empty())
1434  {
1435  cTab->getAutoCompleteCommands(nameList);
1436  newName = autoComplete(nameList, name);
1437  }
1438 
1439  if (newName.empty() && (actorManager != nullptr))
1440  {
1442  newName = autoComplete(nameList, name);
1443  if (!newName.empty() && (startName == 0))
1444  secureChatCommand(newName);
1445  }
1446  if (newName.empty())
1447  newName = autoCompleteHistory(name);
1448  if (newName.empty() && (spellManager != nullptr))
1449  newName = spellManager->autoComplete(name);
1450  if (newName.empty())
1451  newName = autoComplete(name, &mCommands);
1452  if (newName.empty() && (actorManager != nullptr))
1453  {
1454  actorManager->getMobNames(nameList);
1455  newName = autoComplete(nameList, name);
1456  }
1457  if (newName.empty())
1458  newName = autoComplete(name, &mCustomWords);
1459  if (newName.empty())
1460  {
1461  whoIsOnline->getPlayerNames(nameList);
1462  newName = autoComplete(nameList, name);
1463  }
1464 
1465  if (!newName.empty())
1466  {
1467  mChatInput->setText(inputText.substr(0, startName).append(newName)
1468  .append(inputText.substr(caretPos,
1469  inputText.length() - caretPos)));
1470 
1471  const int len = caretPos - CAST_S32(name.length())
1472  + CAST_S32(newName.length());
1473 
1474  if (startName > 0)
1475  mChatInput->setCaretPosition(len + 1);
1476  else
1478  }
1479 }
virtual void getAutoCompleteList(StringVect &names) const
Definition: chattab.h:194
std::string autoCompleteHistory(const std::string &partName) const
SpellManager * spellManager
void secureChatCommand(std::string &str)
virtual void getAutoCompleteCommands(StringVect &names) const
Definition: chattab.h:197
void getMobNames(StringVect &names) const
History mCustomWords
Definition: chatwindow.h:379
void getPlayerNames(StringVect &names)
void setCaretPosition(unsigned int position)
Definition: textfield.cpp:748
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:799
TabbedArea * mChatTabs
Definition: chatwindow.h:345
#define CAST_S32
Definition: cast.h:29
unsigned int getCaretPosition() const
Definition: textfield.h:235
std::string autoComplete(const std::string &partName) const
bool isWordSeparator(const signed char chr)
History mCommands
Definition: chatwindow.h:378
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
ChatInput * mChatInput
Definition: chatwindow.h:348
const std::string & getText() const
Definition: textfield.h:225
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 1511 of file chatwindow.cpp.

References autoComplete().

1513 {
1514  if (words == nullptr)
1515  return "";
1516 
1517  ChatCommands::const_iterator i = words->begin();
1518  const ChatCommands::const_iterator i_end = words->end();
1519  StringVect nameList;
1520 
1521  while (i != i_end)
1522  {
1523  const std::string line = *i;
1524  if (line.find(partName, 0) == 0)
1525  nameList.push_back(line);
1526  ++i;
1527  }
1528  return autoComplete(nameList, partName);
1529 }
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 1481 of file chatwindow.cpp.

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

1483 {
1484  StringVectCIter i = names.begin();
1485  const StringVectCIter i_end = names.end();
1486  toLower(partName);
1487  std::string newName;
1488 
1489  while (i != i_end)
1490  {
1491  if (!i->empty())
1492  {
1493  std::string name = *i;
1494  toLower(name);
1495 
1496  const size_t pos = name.find(partName, 0);
1497  if (pos == 0)
1498  {
1499  if (!newName.empty())
1500  newName = findSameSubstringI(*i, newName);
1501  else
1502  newName = *i;
1503  }
1504  }
1505  ++i;
1506  }
1507 
1508  return newName;
1509 }
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 1543 of file chatwindow.cpp.

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

Referenced by autoComplete().

1544 {
1545  History::const_iterator i = mHistory.begin();
1546  const History::const_iterator i_end = mHistory.end();
1547  StringVect nameList;
1548 
1549  while (i != i_end)
1550  {
1551  std::string line = *i;
1552  unsigned int f = 0;
1553  while (f < line.length() && !isWordSeparator(line.at(f)))
1554  f++;
1555 
1556  line = line.substr(0, f);
1557  if (!line.empty())
1558  nameList.push_back(line);
1559 
1560  ++i;
1561  }
1562  return autoComplete(nameList, partName);
1563 }
void autoComplete()
std::vector< std::string > StringVect
Definition: stringvector.h:28
bool isWordSeparator(const signed char chr)
History mHistory
Definition: chatwindow.h:373

◆ battleChatLog()

void ChatWindow::battleChatLog ( const std::string &  line,
ChatMsgTypeT  own = ChatMsgType::BY_UNKNOWN,
const IgnoreRecord  ignoreRecord = IgnoreRecord_false,
const TryRemoveColors  tryRemoveColors = TryRemoveColors_true 
)
static

Definition at line 1727 of file chatwindow.cpp.

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

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

1730 {
1731  if (own == ChatMsgType::BY_UNKNOWN)
1732  own = ChatMsgType::BY_SERVER;
1733  if (battleChatTab != nullptr)
1734  battleChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1735  else if (debugChatTab != nullptr)
1736  debugChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1737 }
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
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 1739 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().

1744 {
1745  std::string tempChannel = channel;
1746  toLower(tempChannel);
1747 
1748  ChatTab *tab = nullptr;
1749  const ChannelMap::const_iterator i = mChannels.find(tempChannel);
1750 
1751  if (i != mChannels.end())
1752  {
1753  tab = i->second;
1754  }
1755  else
1756  {
1757  tab = addChannelTab(channel, false);
1758  if (tab != nullptr)
1759  saveState();
1760  }
1761 
1762  if (tab != nullptr)
1763  tab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1764 }
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
void saveState() const
std::string toLower(std::string const &s)
ChannelMap mChannels
Definition: chatwindow.h:370
ChatTab * addChannelTab(const std::string &name, const bool switchTo=false)

◆ 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 658 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().

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

References ChatTab::clearText().

Referenced by Actions::splitWhisper().

356 {
357  if (tab != nullptr)
358  tab->clearText();
359 }
void clearText()
Definition: chattab.cpp:426

◆ clearTab() [2/2]

void ChatWindow::clearTab ( ) const

Clear the current tab.

Definition at line 361 of file chatwindow.cpp.

References getFocused().

362 {
363  clearTab(getFocused());
364 }
ChatTab * getFocused() const
Definition: chatwindow.cpp:350
void clearTab() const
Definition: chatwindow.cpp:361

◆ closeTab()

void ChatWindow::closeTab ( ) const

Close current chat tab

Definition at line 412 of file chatwindow.cpp.

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

Referenced by Actions::outString().

413 {
414  if (mChatTabs == nullptr)
415  return;
416 
417  ChatTab *const tab = dynamic_cast<ChatTab*>(mChatTabs->getTabByIndex(
419  if (tab == nullptr)
420  return;
421  const ChatTabTypeT &type = tab->getType();
422  if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
423  tab->handleCommand("close", "");
424 }
virtual bool handleCommand(const std::string &type, const std::string &args)
Definition: chattab.h:123
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:705
TabbedArea * mChatTabs
Definition: chatwindow.h:345
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:440
ChatTabTypeT getType() const
Definition: chattab.h:140
ChatTabType ::T ChatTabTypeT
Definition: chattabtype.h:47

◆ copyToClipboard()

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

Definition at line 2012 of file chatwindow.cpp.

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

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

2013 {
2014  const ChatTab *const tab = getFocused();
2015  if (tab == nullptr)
2016  return;
2017 
2018  const BrowserBox *const text = tab->mTextOutput;
2019  if (text == nullptr)
2020  return;
2021 
2022  std::string str = text->getTextAtPos(x, y);
2023  sendBuffer(str);
2024 }
bool sendBuffer(const std::string &text)
Definition: copynpaste.cpp:517
std::string getTextAtPos(const int x, const int y) const
Definition: browserbox.cpp:863
BrowserBox * mTextOutput
Definition: chattab.h:202
ChatTab * getFocused() const
Definition: chatwindow.cpp:350

◆ debugMessage()

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

Implements DebugMessageListener.

Definition at line 2134 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

2135 {
2136  if (debugChatTab != nullptr)
2138 }
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
bool msg(InputEvent &event)
Definition: chat.cpp:38
ChatTab * debugChatTab
Definition: chattab.cpp:62

◆ defaultTab()

void ChatWindow::defaultTab ( )

Switch to the default tab

Definition at line 426 of file chatwindow.cpp.

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

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

427 {
428  if (mChatTabs != nullptr)
430 }
#define CAST_U32
Definition: cast.h:30
TabbedArea * mChatTabs
Definition: chatwindow.h:345
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:306

◆ displayAwayLog()

void ChatWindow::displayAwayLog ( ) const

Definition at line 1967 of file chatwindow.cpp.

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

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

1968 {
1969  if (localChatTab == nullptr)
1970  return;
1971 
1972  std::list<std::string>::const_iterator i = mAwayLog.begin();
1973  const std::list<std::string>::const_iterator i_end = mAwayLog.end();
1974 
1975  while (i != i_end)
1976  {
1977  std::string str = *i;
1978  localChatTab->addNewRow(str);
1979  ++i;
1980  }
1981 }
void addNewRow(std::string &line)
Definition: chattab.cpp:524
ChatTab * localChatTab
Definition: chattab.cpp:61
std::list< std::string > mAwayLog
Definition: chatwindow.h:386

◆ doPresent()

void ChatWindow::doPresent ( ) const

Definition at line 692 of file chatwindow.cpp.

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

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

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

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

Referenced by clearAwayLog().

2057 {
2058  BLOCK_START("ChatWindow::draw")
2059  if (!mAutoHide || mHaveMouse)
2060  {
2061  GLDEBUG_START("ChatWindow::draw");
2062  Window::draw(graphics);
2063  GLDEBUG_END();
2064  }
2065  BLOCK_END("ChatWindow::draw")
2066 }
#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:303
bool mAutoHide
Definition: chatwindow.h:397
bool mHaveMouse
Definition: chatwindow.h:396
#define GLDEBUG_END()
Definition: opengldebug.h:35

◆ fillCommands()

void ChatWindow::fillCommands ( )
private

Definition at line 251 of file chatwindow.cpp.

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

Referenced by ChatWindow().

252 {
253  loadCommandsFile("chatcommands.txt");
255 }
void loadCommandsFile(const std::string &name)
Definition: chatwindow.cpp:235
void addChatCommands(std::list< std::string > &arr)
History mCommands
Definition: chatwindow.h:378
InputManager inputManager

◆ findHighlight()

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

Definition at line 2007 of file chatwindow.cpp.

References findI(), and mHighlights.

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

2008 {
2009  return findI(str, mHighlights) != std::string::npos;
2010 }
StringVect mHighlights
Definition: chatwindow.h:387
size_t findI(std::string str, std::string subStr)

◆ getFocused()

ChatTab * ChatWindow::getFocused ( ) const

Gets the focused tab.

Definition at line 350 of file chatwindow.cpp.

References TabbedArea::getSelectedTab(), and mChatTabs.

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

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

◆ getReturnTogglesChat()

bool ChatWindow::getReturnTogglesChat ( ) const
inline

Definition at line 182 of file chatwindow.h.

References mReturnToggles.

Referenced by Actions::splitWhisper().

183  { return mReturnToggles; }
bool mReturnToggles
Definition: chatwindow.h:393

◆ getWhisperTab()

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

Definition at line 1224 of file chatwindow.cpp.

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

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

1225 {
1226  if (localPlayer == nullptr)
1227  return nullptr;
1228 
1229  std::string playerName = localPlayer->getName();
1230  std::string tempNick = nick;
1231 
1232  toLower(playerName);
1233  toLower(tempNick);
1234 
1235  const TabMap::const_iterator i = mWhispers.find(tempNick);
1236  WhisperTab *ret = nullptr;
1237 
1238  if (tempNick == playerName)
1239  return nullptr;
1240 
1241  if (i != mWhispers.end())
1242  ret = i->second;
1243 
1244  return ret;
1245 }
LocalPlayer * localPlayer
std::string toLower(std::string const &s)
const std::string & getName() const
Definition: being.h:233
TabMap mWhispers
Definition: chatwindow.h:369

◆ ignoreAllWhispers()

void ChatWindow::ignoreAllWhispers ( )

Definition at line 638 of file chatwindow.cpp.

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

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

639 {
640  for (TabMap::iterator iter = mWhispers.begin();
641  iter != mWhispers.end();
642  ++ iter)
643  {
644  WhisperTab *const tab = iter->second;
645  if (tab != nullptr)
646  {
649  {
652  }
653  tab->handleCommand("close", "");
654  }
655  }
656 }
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:369

◆ initTradeFilter()

void ChatWindow::initTradeFilter ( )
protected

Definition at line 1766 of file chatwindow.cpp.

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

Referenced by ChatWindow().

1767 {
1768  const std::string tradeListName = settings.serverConfigDir
1769  + "/tradefilter.txt";
1770 
1771  std::ifstream tradeFile;
1772  struct stat statbuf;
1773 
1774  if (stat(tradeListName.c_str(), &statbuf) == 0 &&
1775  S_ISREG(statbuf.st_mode))
1776  {
1777  tradeFile.open(tradeListName.c_str(), std::ios::in);
1778  if (tradeFile.is_open())
1779  {
1780  char line[100];
1781  while (tradeFile.getline(line, 100))
1782  {
1783  const std::string str = line;
1784  if (!str.empty())
1785  mTradeFilter.push_back(str);
1786  }
1787  }
1788  tradeFile.close();
1789  }
1790 }
StringVect mTradeFilter
Definition: chatwindow.h:381
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 572 of file chatwindow.cpp.

References Widget::isFocused(), and mChatInput.

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

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

◆ isTabPresent()

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

Definition at line 2129 of file chatwindow.cpp.

References TabbedArea::isTabPresent(), and mChatTabs.

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

2130 {
2131  return mChatTabs->isTabPresent(tab);
2132 }
TabbedArea * mChatTabs
Definition: chatwindow.h:345
bool isTabPresent(const Tab *const tab) const
Definition: tabbedarea.cpp:291

◆ joinRoom()

void ChatWindow::joinRoom ( const bool  isJoin)

Definition at line 2158 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().

2159 {
2160  Tab *const tab = mChatTabs->getTabByIndex(0);
2161  if (tab != nullptr)
2162  {
2163  std::string name;
2164  if (isJoin)
2165  {
2166  name = PlayerInfo::getRoomName();
2167  }
2168  else
2169  {
2170  // TRANSLATORS: chat tab name
2171  name = _("General");
2172  }
2173  tab->setCaption(name);
2174  }
2175 }
#define _(s)
Definition: gettext.h:34
void setCaption(const std::string &caption)
Definition: tab.cpp:452
Definition: tab.h:84
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:705
TabbedArea * mChatTabs
Definition: chatwindow.h:345
std::string getRoomName()
Definition: playerinfo.cpp:644

◆ keyPressed()

void ChatWindow::keyPressed ( KeyEvent event)
virtual

Called when key is pressed

Reimplemented from KeyListener.

Definition at line 812 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.

813 {
814  const InputActionT actionId = event.getActionId();
815  std::string temp;
816  if (actionId == InputAction::GUI_DOWN)
817  {
818  if (mCurHist != mHistory.end())
819  {
820  // Move forward through the history
821  const HistoryIterator prevHist = mCurHist++;
823 
824  if (mCurHist != mHistory.end())
825  {
828  mChatInput->getText().length()));
829  }
830  else
831  {
832  mChatInput->setText("");
833  mCurHist = prevHist;
834  }
835  }
836  else if (!mChatInput->getText().empty())
837  {
838  if (addCurrentToHistory())
839  mCurHist = mHistory.end();
840  mChatInput->setText("");
841  }
842  }
843  else if (actionId == InputAction::GUI_UP &&
844  mCurHist != mHistory.begin() &&
845  !mHistory.empty())
846  {
847  // Move backward through the history
848  --mCurHist;
852  mChatInput->getText().length()));
853  }
854  else if (actionId == InputAction::GUI_INSERT &&
855  !mChatInput->getText().empty())
856  {
857  const std::string str = mChatInput->getText();
858  // Add the current message to the history and clear the text
859  if (mHistory.empty() || str != mHistory.back())
860  mHistory.push_back(str);
861  mCurHist = mHistory.end();
862  mChatInput->setText(std::string());
863  }
864  else if (actionId == InputAction::GUI_TAB &&
865  !mChatInput->getText().empty())
866  {
867  autoComplete();
868  return;
869  }
870  else if (actionId == InputAction::GUI_CANCEL &&
872  {
874  }
875  else if (actionId == InputAction::CHAT_PREV_HISTORY &&
877  {
878  const ChatTab *const tab = getFocused();
879  if ((tab != nullptr) && tab->hasRows())
880  {
881  if (mChatHistoryIndex == 0u)
882  {
884  tab->getRows().size());
885 
886  mChatInput->setText("");
888  return;
889  }
890 
892 
893  unsigned int f = 0;
894  const std::list<std::string> &rows = tab->getRows();
895  for (std::list<std::string>::const_iterator it = rows.begin(),
896  it_end = rows.end(); it != it_end; ++ it, f ++)
897  {
898  if (f == mChatHistoryIndex)
899  mChatInput->setText(*it);
900  }
902  mChatInput->getText().length()));
903  }
904  }
905  else if (actionId == InputAction::CHAT_NEXT_HISTORY &&
907  {
908  const ChatTab *const tab = getFocused();
909  if ((tab != nullptr) && tab->hasRows())
910  {
911  const std::list<std::string> &rows = tab->getRows();
912  const size_t &tabSize = rows.size();
913  if (CAST_SIZE(mChatHistoryIndex) + 1 < tabSize)
914  {
916  }
917  else if (CAST_SIZE(mChatHistoryIndex) < tabSize)
918  {
920  mChatInput->setText("");
922  return;
923  }
924  else
925  {
926  mChatHistoryIndex = 0;
927  }
928 
929  unsigned int f = 0;
930  for (std::list<std::string>::const_iterator
931  it = rows.begin(), it_end = rows.end();
932  it != it_end; ++it, f++)
933  {
934  if (f == mChatHistoryIndex)
935  mChatInput->setText(*it);
936  }
938  mChatInput->getText().length()));
939  }
940  }
941  else if (actionId == InputAction::GUI_F1)
942  {
943  if (emoteWindow != nullptr)
944  {
946  emoteWindow->hide();
947  else
948  emoteWindow->show();
949  }
950  }
951  ifKey(InputAction::GUI_F2, "\u2318")
952  ifKey(InputAction::GUI_F3, "\u263A")
953  ifKey(InputAction::GUI_F4, "\u2665")
954  ifKey(InputAction::GUI_F5, "\u266A")
955  ifKey(InputAction::GUI_F6, "\u266B")
956  ifKey(InputAction::GUI_F7, "\u26A0")
957  ifKey(InputAction::GUI_F8, "\u2622")
958  ifKey(InputAction::GUI_F9, "\u262E")
959  ifKey(InputAction::GUI_F10, "\u2605")
960  ifKey(InputAction::GUI_F11, "\u2618")
961  ifKey(InputAction::GUI_F12, "\u2592")
962 
963  if (inputManager.isActionActive(InputAction::GUI_CTRL))
964  {
965  if (actionId == InputAction::GUI_B)
966  {
967  std::string inputText = mChatInput->getTextBeforeCaret();
968  toLower(inputText);
969  const size_t idx = inputText.rfind("##b");
970  if (idx == std::string::npos
971  || mChatInput->getTextBeforeCaret().substr(idx, 3) == "##b")
972  {
973  temp = "##B";
974  }
975  else
976  {
977  temp = "##b";
978  }
979  }
980  }
981 
982  if (!temp.empty())
983  addInputText(temp, false);
984 }
#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:748
void autoComplete()
#define ifKey(key, str)
Definition: chatwindow.cpp:806
void setText(const std::string &text)
Definition: textfield.cpp:799
Visible mVisible
Definition: widget.h:962
bool hasRows() const
Definition: chattab.h:148
void addInputText(const std::string &text, const bool space=true)
std::string getTextBeforeCaret() const
Definition: textfield.h:208
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:714
History::iterator HistoryIterator
Definition: chatwindow.h:372
bool addCurrentToHistory()
Definition: chatwindow.cpp:988
HistoryIterator mCurHist
Definition: chatwindow.h:374
ChatTab * getFocused() const
Definition: chatwindow.cpp:350
History mHistory
Definition: chatwindow.h:373
#define CAST_SIZE
Definition: cast.h:33
InputManager inputManager
void processVisible(const Visible n)
Definition: chatinput.h:73
ChatInput * mChatInput
Definition: chatwindow.h:348
unsigned int mChatHistoryIndex
Definition: chatwindow.h:392
const std::string & getText() const
Definition: textfield.h:225
const std::list< std::string > & getRows() const
Definition: chattab.h:145

◆ loadCommandsFile()

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

Definition at line 235 of file chatwindow.cpp.

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

Referenced by fillCommands(), and loadGMCommands().

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

◆ loadCustomList()

void ChatWindow::loadCustomList ( )

Definition at line 1930 of file chatwindow.cpp.

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

Referenced by ChatWindow(), and setReturnTogglesChat().

1931 {
1932  std::ifstream listFile;
1933  struct stat statbuf;
1934 
1935  std::string listName = settings.serverConfigDir
1936  + "/customwords.txt";
1937 
1938  if ((stat(listName.c_str(), &statbuf) == 0) && S_ISREG(statbuf.st_mode))
1939  {
1940  listFile.open(listName.c_str(), std::ios::in);
1941  if (listFile.is_open())
1942  {
1943  char line[101];
1944  while (listFile.getline(line, 100))
1945  {
1946  std::string str = line;
1947  if (!str.empty())
1948  mCustomWords.push_back(str);
1949  }
1950  }
1951  listFile.close();
1952  }
1953 }
History mCustomWords
Definition: chatwindow.h:379
Settings settings
Definition: settings.cpp:31
std::string serverConfigDir
Definition: settings.h:115

◆ loadGMCommands()

void ChatWindow::loadGMCommands ( )

Definition at line 257 of file chatwindow.cpp.

References loadCommandsFile(), and mGMLoaded.

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

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

◆ loadState()

void ChatWindow::loadState ( )

Definition at line 1850 of file chatwindow.cpp.

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

Referenced by createGuiWindows(), and setReturnTogglesChat().

1851 {
1852  int num = 0;
1853  while (num < 50)
1854  {
1855  const std::string nick = serverConfig.getValue(
1856  "chatWhisper" + toString(num), "");
1857 
1858  if (nick.empty())
1859  break;
1860 
1861  const int flags = serverConfig.getValue(
1862  "chatWhisperFlags" + toString(num), 1);
1863 
1864  ChatTab *const tab = addChatTab(nick, false, false);
1865  if (tab != nullptr)
1866  {
1867  tab->setAllowHighlight((flags & 1) != 0);
1868  tab->setRemoveNames(((flags & 2) / 2) != 0);
1869  tab->setNoAway(((flags & 4) / 4) != 0);
1870  }
1871  num ++;
1872  }
1873 }
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:162
void setNoAway(const bool n)
Definition: chattab.h:168
void setAllowHighlight(const bool n)
Definition: chattab.h:156

◆ 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 684 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().

685 {
686  if (localChatTab != nullptr)
688  else
689  chatInput(msg);
690 }
ChatTab * localChatTab
Definition: chattab.cpp:61
bool msg(InputEvent &event)
Definition: chat.cpp:38
void chatInput(const std::string &msg)
Definition: chattab.cpp:380
void chatInput(const std::string &msg) const
Definition: chatwindow.cpp:658

◆ mouseDragged()

void ChatWindow::mouseDragged ( MouseEvent event)
virtual

Handles mouse when dragged.

Reimplemented from Window.

Definition at line 789 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().

790 {
791  Window::mouseDragged(event);
792 
793  if (event.isConsumed())
794  return;
795 
796  if (canMove() && isMovable() && mMoved)
797  {
798  int newX = std::max(0, getX() + event.getX() - mDragOffsetX);
799  int newY = std::max(0, getY() + event.getY() - mDragOffsetY);
800  newX = std::min(mainGraphics->mWidth - getWidth(), newX);
801  newY = std::min(mainGraphics->mHeight - getHeight(), newY);
802  setPosition(newX, newY);
803  }
804 }
int getWidth() const
Definition: widget.h:220
int mDragOffsetY
Definition: window.h:634
int getY() const
Definition: widget.h:287
int mWidth
Definition: graphics.h:483
bool mMoved
Definition: window.h:639
int mDragOffsetX
Definition: window.h:627
bool isMovable() const
Definition: window.h:568
bool canMove() const
Definition: window.cpp:965
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:135
int getX() const
Definition: widget.h:268
void mouseDragged(MouseEvent &event)
Definition: window.cpp:970
int getHeight() const
Definition: widget.h:239
int getX() const
Definition: mouseevent.h:124

◆ 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 2044 of file chatwindow.cpp.

References mHaveMouse, and Window::mouseEntered().

Referenced by clearAwayLog().

2045 {
2046  mHaveMouse = true;
2047  Window::mouseEntered(event);
2048 }
void mouseEntered(MouseEvent &event)
Definition: window.cpp:907
bool mHaveMouse
Definition: chatwindow.h:396

◆ 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 2050 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

2051 {
2052  updateVisibility();
2053  Window::mouseExited(event);
2054 }
void updateVisibility()
void mouseExited(MouseEvent &event)
Definition: window.cpp:912

◆ mouseMoved()

void ChatWindow::mouseMoved ( MouseEvent event)
virtual

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

Reimplemented from Window.

Definition at line 2038 of file chatwindow.cpp.

References mHaveMouse, and Window::mouseMoved().

Referenced by clearAwayLog().

2039 {
2040  mHaveMouse = true;
2041  Window::mouseMoved(event);
2042 }
void mouseMoved(MouseEvent &event)
Definition: window.cpp:955
bool mHaveMouse
Definition: chatwindow.h:396

◆ mousePressed()

void ChatWindow::mousePressed ( MouseEvent event)
virtual

Handles mouse when pressed.

Reimplemented from Window.

Definition at line 733 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.

734 {
735  if (event.isConsumed())
736  return;
737 
738  if (event.getButton() == MouseButton::RIGHT)
739  {
740  if (popupMenu != nullptr)
741  {
742  ChatTab *const cTab = dynamic_cast<ChatTab*>(
744  if (cTab != nullptr)
745  {
746  event.consume();
748  {
751  std::string(), cTab);
752  }
753  else
754  {
756  viewport->mMouseY,
757  cTab);
758  }
759  }
760  }
761  }
762 
763  Window::mousePressed(event);
764 
765  if (event.isConsumed())
766  return;
767 
768  if (event.getButton() == MouseButton::LEFT)
769  {
770  const int clicks = event.getClickCount();
771  if (clicks == 2)
772  {
773  toggleChatFocus();
774  if (gui != nullptr)
775  gui->resetClickCount();
776  }
777  else if (clicks == 1)
778  {
779  const ChatTab *const tab = getFocused();
780  if (tab != nullptr)
781  mMoved = !isResizeAllowed(event);
782  }
783  }
784 
785  mDragOffsetX = event.getX();
786  mDragOffsetY = event.getY();
787 }
void showChatPopup(const int x, const int y, ChatTab *const tab)
Definition: popupmenu.cpp:904
int mDragOffsetY
Definition: window.h:634
Gui * gui
Definition: gui.cpp:110
MouseButtonT getButton() const
Definition: mouseevent.h:113
bool mMoved
Definition: window.h:639
int mMouseX
Definition: viewport.h:153
int mDragOffsetX
Definition: window.h:627
bool isActionActive(const InputActionT index) const
TabbedArea * mChatTabs
Definition: chatwindow.h:345
void toggleChatFocus()
PopupMenu * popupMenu
Definition: popupmenu.cpp:102
void resetClickCount()
Definition: gui.cpp:968
bool isConsumed() const
int mMouseY
Definition: viewport.h:154
ChatTab * getFocused() const
Definition: chatwindow.cpp:350
bool isResizeAllowed(const MouseEvent &event) const
Definition: window.cpp:1333
Tab * getSelectedTab() const
Definition: tabbedarea.h:174
void mousePressed(MouseEvent &event)
Definition: window.cpp:824
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 380 of file chatwindow.cpp.

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

Referenced by Actions::outString().

381 {
382  if (mChatTabs == nullptr)
383  return;
384 
385  int tab = mChatTabs->getSelectedTabIndex();
386 
387  tab++;
388  if (tab == mChatTabs->getNumberOfTabs())
389  tab = 0;
390 
392 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:160
TabbedArea * mChatTabs
Definition: chatwindow.h:345
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:440
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:306

◆ 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 2026 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

2027 {
2028  if (name == "autohideChat")
2029  mAutoHide = config.getBoolValue("autohideChat");
2030  else if (name == "showBattleEvents")
2031  mShowBattleEvents = config.getBoolValue("showBattleEvents");
2032  else if (name == "globalsFilter")
2034  else if (name == "enableTradeFilter")
2035  mEnableTradeFilter = config.getBoolValue("enableTradeFilter");
2036 }
Configuration config
bool mShowBattleEvents
Definition: chatwindow.h:398
void parseGlobalsFilter()
bool getBoolValue(const std::string &key) const
bool mAutoHide
Definition: chatwindow.h:397
bool mEnableTradeFilter
Definition: chatwindow.h:400

◆ parseGlobalsFilter()

void ChatWindow::parseGlobalsFilter ( )

Definition at line 1995 of file chatwindow.cpp.

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

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

1996 {
1997  mGlobalsFilter.clear();
1998  if (localPlayer == nullptr)
1999  return;
2000 
2002  "globalsFilter"), ',');
2003 
2004  mHighlights.push_back(localPlayer->getName());
2005 }
std::string getStringValue(const std::string &key) const
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
StringVect mGlobalsFilter
Definition: chatwindow.h:388
Configuration config
StringVect mHighlights
Definition: chatwindow.h:387
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:233

◆ parseHighlights()

void ChatWindow::parseHighlights ( )

Definition at line 1983 of file chatwindow.cpp.

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

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

1984 {
1985  mHighlights.clear();
1986  if (localPlayer == nullptr)
1987  return;
1988 
1990  "highlightWords"), ',');
1991 
1992  mHighlights.push_back(localPlayer->getName());
1993 }
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:387
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:233

◆ postConnection()

void ChatWindow::postConnection ( )

Definition at line 1324 of file chatwindow.cpp.

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

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

1325 {
1326  FOR_EACH (ChannelMap::const_iterator, iter, mChannels)
1327  {
1328  ChatTab *const tab = iter->second;
1329  if (tab == nullptr)
1330  return;
1332  }
1333  if (langChatTab != nullptr)
1335 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
LangTab * langChatTab
Definition: langtab.cpp:27
const std::string & getChannelName() const
Definition: chattab.h:178
ChannelMap mChannels
Definition: chatwindow.h:370
Net::ChatHandler * chatHandler
Definition: net.cpp:80
virtual void joinChannel(const std::string &channel) const =0

◆ postInit()

void ChatWindow::postInit ( )
virtual

Reimplemented from Window.

Definition at line 225 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

226 {
228  add(mChatTabs);
229  add(mChatInput);
230  add(mColorPicker);
231  add(mChatButton);
233 }
void updateVisibility()
Button * mChatButton
Definition: chatwindow.h:385
DropDown * mColorPicker
Definition: chatwindow.h:384
TabbedArea * mChatTabs
Definition: chatwindow.h:345
virtual void add(Widget *const widget)
ChatInput * mChatInput
Definition: chatwindow.h:348
void postInit()
Definition: window.cpp:241

◆ prevTab()

void ChatWindow::prevTab ( )

Switch to the previous tab in order

Definition at line 366 of file chatwindow.cpp.

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

Referenced by Actions::outString().

367 {
368  if (mChatTabs == nullptr)
369  return;
370 
371  int tab = mChatTabs->getSelectedTabIndex();
372 
373  if (tab <= 0)
374  tab = mChatTabs->getNumberOfTabs();
375  tab--;
376 
378 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:160
TabbedArea * mChatTabs
Definition: chatwindow.h:345
int getSelectedTabIndex() const
Definition: tabbedarea.cpp:440
void setSelectedTabByIndex(const size_t index)
Definition: tabbedarea.cpp:306

◆ removeAllChannels()

void ChatWindow::removeAllChannels ( )

Definition at line 622 of file chatwindow.cpp.

References FOR_EACH, and mChannels.

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

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

◆ removeAllWhispers()

void ChatWindow::removeAllWhispers ( )

Definition at line 606 of file chatwindow.cpp.

References FOR_EACH, and mWhispers.

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

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

◆ removeChannel()

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

Definition at line 598 of file chatwindow.cpp.

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

Referenced by ChannelTab::~ChannelTab().

599 {
600  std::string tempName = name;
601  toLower(tempName);
602  mChannels.erase(tempName);
603  chatHandler->partChannel(name);
604 }
std::string toLower(std::string const &s)
ChannelMap mChannels
Definition: chatwindow.h:370
Net::ChatHandler * chatHandler
Definition: net.cpp:80
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 577 of file chatwindow.cpp.

References mChatTabs, and TabbedArea::removeTab().

Referenced by ChatTab::~ChatTab().

578 {
579  mChatTabs->removeTab(tab);
580 }
void removeTab(Tab *const tab)
Definition: tabbedarea.cpp:314
TabbedArea * mChatTabs
Definition: chatwindow.h:345

◆ removeWhisper()

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

Definition at line 591 of file chatwindow.cpp.

References mWhispers, and Catch::toLower().

Referenced by WhisperTab::~WhisperTab().

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

◆ requestChatFocus()

bool ChatWindow::requestChatFocus ( )

Request focus for typing chat message.

Returns
true if the input was shown false otherwise

Definition at line 546 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().

547 {
548  // Make sure chatWindow is visible
549  if (!isWindowVisible())
550  {
552 
553  /*
554  * This is used to hide chatWindow after sending the message. There is
555  * a trick here, because setVisible will set mTmpVisible to false, you
556  * have to put this sentence *after* setVisible, not before it
557  */
558  mTmpVisible = true;
559  }
560 
561  // Don't do anything else if the input is already visible and has focus
563  return false;
564 
565  // Give focus to the chat input
567  unHideWindow();
569  return true;
570 }
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:476
bool isVisible() const
Definition: widget.h:377
bool mTmpVisible
Definition: chatwindow.h:401
void processVisible(const Visible n)
Definition: chatinput.h:73
ChatInput * mChatInput
Definition: chatwindow.h:348

◆ resortChatLog()

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

Definition at line 1565 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().

1570 {
1571  if (own == ChatMsgType::BY_UNKNOWN)
1572  {
1573  const size_t pos = line.find(" : ");
1574  if (pos != std::string::npos)
1575  {
1576  if (line.length() <= pos + 3)
1577  own = ChatMsgType::BY_SERVER;
1578  else if (line.substr(0, pos) == localPlayer->getName())
1579  own = ChatMsgType::BY_PLAYER;
1580  else
1581  own = ChatMsgType::BY_OTHER;
1582  }
1583  else
1584  {
1585  own = ChatMsgType::BY_SERVER;
1586  }
1587  }
1588 
1589  std::string prefix;
1590  if (!channel.empty())
1591  {
1592  prefix = std::string("##3").append(channel).append("##0");
1593  }
1594  else if (mEnableTradeFilter &&
1595  (tradeChatTab != nullptr) &&
1596  findI(line, mTradeFilter) != std::string::npos)
1597  {
1598  // TRANSLATORS: prefix for moved message to trade tab.
1599  tradeChatTab->chatLog(std::string("##S") + _("Moved: ") + line,
1600  own,
1601  ignoreRecord,
1602  tryRemoveColors);
1603  if (own == ChatMsgType::BY_PLAYER)
1604  {
1605  own = ChatMsgType::BY_SERVER;
1606  // TRANSLATORS: moved message to trade tab warning.
1607  line = _("Your message was moved to trade tab");
1608  }
1609  else
1610  {
1611  return false;
1612  }
1613  }
1614 
1615  size_t idx2 = line.find(": ");
1616  if (idx2 != std::string::npos)
1617  {
1618  std::string tmpNick = line.substr(0, idx2);
1619  if (tmpNick.find('#') != std::string::npos ||
1620  tmpNick.find(':') != std::string::npos ||
1621  tmpNick.find('%') != std::string::npos ||
1622  tmpNick.find('@') != std::string::npos ||
1623  tmpNick.size() < 5 ||
1624  tmpNick[0] == '@' ||
1625  tmpNick[0] == '/' ||
1626  tmpNick[0] == '!'
1627  )
1628  {
1629  replaceAll(tmpNick, "#", "_");
1630  replaceAll(tmpNick, "%", "_");
1631  // TRANSLATORS: error message
1632  line = _("Broken nick detected: ") + line;
1633  own = ChatMsgType::BY_SERVER;
1634  }
1635  const size_t idx = line.find(": \302\202");
1636  if (idx == idx2)
1637  {
1638  if (line.find(": \302\202\302") != std::string::npos)
1639  {
1640  if (line.find(": \302\202\302e") != std::string::npos)
1641  {
1642  // Do nothing. Before was local pet emote
1643  }
1644  else if (line.find(": \302\202\302m") != std::string::npos)
1645  {
1646  // Do nothing. Before was local pet move
1647  }
1648  else if (line.find(": \302\202\302d") != std::string::npos)
1649  {
1650  // Do nothing. Before was local pet direction
1651  }
1652  else if (line.find(": \302\202\302a") != std::string::npos)
1653  {
1654  // Do nothing. Before was local pet ai enable/disable
1655  }
1656  // ignore other special message formats.
1657  return false;
1658  }
1659 
1660  // pet talk message detected
1661  if (line.find(": \302\202\303 ") != std::string::npos)
1662  {
1663  // Do nothing. Before was local pet talk
1664  return false;
1665  }
1666  if (line.find(": \302\202\304") != std::string::npos)
1667  {
1668  replaceAll(line, ": \302\202\304", ": ");
1669  }
1670 
1671  if (tradeChatTab != nullptr)
1672  {
1673  line = line.erase(idx + 2, 2);
1674  tradeChatTab->chatLog(prefix + line,
1675  own,
1676  ignoreRecord,
1677  tryRemoveColors);
1678  }
1679  else if (localChatTab != nullptr)
1680  {
1681  line = line.erase(idx + 2, 2);
1682  localChatTab->chatLog(prefix + line,
1683  own,
1684  ignoreRecord,
1685  tryRemoveColors);
1686  }
1687  return false;
1688  }
1689  }
1690 
1691  if (!channel.empty())
1692  {
1693  if (langChatTab != nullptr)
1694  {
1696  {
1697  langChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1698  }
1699  else if (mShowAllLang)
1700  {
1701  langChatTab->chatLog(prefix + line,
1702  own,
1703  ignoreRecord,
1704  tryRemoveColors);
1705  }
1706  }
1708  {
1709  channelChatLog(channel, line, own, ignoreRecord, tryRemoveColors);
1710  return false;
1711  }
1712  else if (mShowAllLang)
1713  {
1714  localChatTab->chatLog(prefix + line,
1715  own,
1716  ignoreRecord,
1717  tryRemoveColors);
1718  }
1719  }
1720  else if ((localChatTab != nullptr) && channel.empty())
1721  {
1722  localChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
1723  }
1724  return true;
1725 }
#define _(s)
Definition: gettext.h:34
ChatTab * localChatTab
Definition: chattab.cpp:61
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109
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:178
StringVect mTradeFilter
Definition: chatwindow.h:381
LocalPlayer * localPlayer
const std::string & getName() const
Definition: being.h:233
ServerTypeT getNetworkType()
Definition: net.cpp:178
bool mEnableTradeFilter
Definition: chatwindow.h:400
bool mShowAllLang
Definition: chatwindow.h:399
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 2068 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

2069 {
2070  BLOCK_START("ChatWindow::draw")
2071  if (!mAutoHide || mHaveMouse)
2072  {
2073  GLDEBUG_START("ChatWindow::draw");
2074  Window::safeDraw(graphics);
2075  GLDEBUG_END();
2076  }
2077  BLOCK_END("ChatWindow::draw")
2078 }
#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:397
bool mHaveMouse
Definition: chatwindow.h:396
#define GLDEBUG_END()
Definition: opengldebug.h:35
void safeDraw(Graphics *const graphics)
Definition: window.cpp:415

◆ saveState()

void ChatWindow::saveState ( ) const

Definition at line 1875 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().

1876 {
1877  int num = 0;
1878  for (ChannelMap::const_iterator iter = mChannels.begin(),
1879  iter_end = mChannels.end(); iter != iter_end && num < 50; ++iter)
1880  {
1881  if (iter->second == nullptr)
1882  return;
1883  if (!saveTab(num, iter->second))
1884  continue;
1885  num ++;
1886  }
1887 
1888  for (TabMap::const_iterator iter = mWhispers.begin(),
1889  iter_end = mWhispers.end(); iter != iter_end && num < 50; ++iter)
1890  {
1891  if (iter->second == nullptr)
1892  return;
1893  if (!saveTab(num, iter->second))
1894  continue;
1895  num ++;
1896  }
1897 
1898  while (num < 50)
1899  {
1900  serverConfig.deleteKey("chatWhisper" + toString(num));
1901  serverConfig.deleteKey("chatWhisperFlags" + toString(num));
1902  num ++;
1903  }
1904 }
Configuration serverConfig
ChannelMap mChannels
Definition: chatwindow.h:370
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:369

◆ saveTab()

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

Definition at line 1906 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().

1908 {
1909  if (tab == nullptr)
1910  return false;
1911 
1912  serverConfig.setValue("chatWhisper" + toString(num),
1913  tab->getChannelName());
1914 
1915  serverConfig.setValue("chatWhisperFlags" + toString(num),
1916  CAST_S32(tab->getAllowHighlight())
1917  + (2 * CAST_S32(tab->getRemoveNames()))
1918  + (4 * CAST_S32(tab->getNoAway())));
1919 
1920  return true;
1921 }
const std::string & getChannelName() const
Definition: chattab.h:178
Configuration serverConfig
#define CAST_S32
Definition: cast.h:29
bool getRemoveNames() const
Definition: chattab.h:159
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
bool getNoAway() const
Definition: chattab.h:165
bool getAllowHighlight() const
Definition: chattab.h:153
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 2177 of file chatwindow.cpp.

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

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

2178 {
2181 }
static void removeListener(const DebugMessageListener *const listener)
virtual void scheduleDelete()
Definition: window.cpp:819

◆ 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 723 of file chatwindow.cpp.

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

Referenced by Actions::outString().

724 {
725  if (!isWindowVisible())
726  return;
727 
728  ChatTab *const tab = getFocused();
729  if (tab != nullptr)
730  tab->scroll(amount);
731 }
void scroll(const int amount)
Definition: chattab.cpp:417
bool isWindowVisible() const
Definition: window.h:476
ChatTab * getFocused() const
Definition: chatwindow.cpp:350

◆ selectTabByType()

void ChatWindow::selectTabByType ( const ChatTabTypeT type)

Definition at line 394 of file chatwindow.cpp.

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

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

395 {
396  if (mChatTabs == nullptr)
397  return;
398 
399  int sz = mChatTabs->getNumberOfTabs();
400  for (int f = 0; f < sz; f ++)
401  {
402  ChatTab *const tab = dynamic_cast<ChatTab*>(
404  if ((tab != nullptr) && tab->getType() == type)
405  {
407  break;
408  }
409  }
410 }
int getNumberOfTabs() const
Definition: tabbedarea.cpp:160
void setSelectedTab(Tab *const tab)
Definition: tabbedarea.cpp:398
Tab * getTabByIndex(const int index) const
Definition: tabbedarea.cpp:705
TabbedArea * mChatTabs
Definition: chatwindow.h:345
ChatTabTypeT getType() const
Definition: chattab.h:140

◆ 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 1080 of file chatwindow.cpp.

References mTmpVisible, and Window::setVisible().

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

1081 {
1082  Window::setVisible(visible);
1083 
1084  /*
1085  * For whatever reason, if setVisible is called, the mTmpVisible effect
1086  * should be disabled.
1087  */
1088  mTmpVisible = false;
1089 }
virtual void setVisible(Visible visible)
Definition: window.cpp:766
bool mTmpVisible
Definition: chatwindow.h:401

◆ showGMTab()

void ChatWindow::showGMTab ( )

Definition at line 2140 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().

2141 {
2142  if ((gmChatTab == nullptr) &&
2143  config.getBoolValue("enableGmTab") &&
2144  localPlayer->getGroupId() >= paths.getIntValue("gmTabMinimalLevel"))
2145  {
2147  }
2148 }
Configuration config
int getIntValue(const std::string &key) const
bool getBoolValue(const std::string &key) const
const std::string GM_CHANNEL
Definition: chat.h:29
LocalPlayer * localPlayer
int getGroupId() const
Definition: being.h:1085
ChatTab * addSpecialChannelTab(const std::string &name, const bool switchTo=false)
Configuration paths
GmTab * gmChatTab
Definition: gmtab.cpp:33

◆ toggleChatFocus()

void ChatWindow::toggleChatFocus ( )
protected

Definition at line 2150 of file chatwindow.cpp.

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

Referenced by mousePressed().

2151 {
2154  else
2155  requestChatFocus();
2156 }
virtual bool isFocused() const
Definition: widget.cpp:183
const bool Visible_false
Definition: visible.h:29
bool requestChatFocus()
Definition: chatwindow.cpp:546
bool isVisible() const
Definition: widget.h:377
void processVisible(const Visible n)
Definition: chatinput.h:73
ChatInput * mChatInput
Definition: chatwindow.h:348

◆ unHideWindow()

void ChatWindow::unHideWindow ( )

Definition at line 2102 of file chatwindow.cpp.

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

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

2103 {
2104  mHaveMouse = true;
2105 }
bool mHaveMouse
Definition: chatwindow.h:396

◆ updateOnline()

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

Definition at line 1792 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().

1793 {
1794  const Party *party = nullptr;
1795  const Guild *guild = nullptr;
1796  if (localPlayer != nullptr)
1797  {
1798  party = localPlayer->getParty();
1799  guild = localPlayer->getGuild();
1800  }
1801  FOR_EACH (TabMap::const_iterator, iter, mWhispers)
1802  {
1803  if (iter->second == nullptr)
1804  return;
1805 
1806  WhisperTab *const tab = static_cast<WhisperTab*>(iter->second);
1807  if (tab == nullptr)
1808  continue;
1809 
1810  if (onlinePlayers.find(tab->getNick()) != onlinePlayers.end())
1811  {
1812  tab->setWhisperTabColors();
1813  }
1814  else
1815  {
1816  const std::string &nick = tab->getNick();
1817  if (actorManager != nullptr)
1818  {
1819  const Being *const being = actorManager->findBeingByName(
1820  nick, ActorType::Player);
1821  if (being != nullptr)
1822  {
1823  tab->setWhisperTabColors();
1824  continue;
1825  }
1826  }
1827  if (party != nullptr)
1828  {
1829  const PartyMember *const pm = party->getMember(nick);
1830  if ((pm != nullptr) && pm->getOnline())
1831  {
1832  tab->setWhisperTabColors();
1833  continue;
1834  }
1835  }
1836  if (guild != nullptr)
1837  {
1838  const GuildMember *const gm = guild->getMember(nick);
1839  if ((gm != nullptr) && gm->getOnline())
1840  {
1841  tab->setWhisperTabColors();
1842  continue;
1843  }
1844  }
1846  }
1847  }
1848 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
bool getOnline() const
Definition: avatar.h:80
Definition: party.h:61
Being * findBeingByName(const std::string &name, const ActorTypeT type=ActorType::Unknown) const
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1219
Party * getParty() const
Definition: being.h:325
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:99
bool gm(InputEvent &event)
Definition: commands.cpp:74
uint32_t guild
Definition: being.h:93
void setWhisperTabOfflineColors()
Definition: whispertab.cpp:127
Definition: guild.h:68
ActorManager * actorManager
TabMap mWhispers
Definition: chatwindow.h:369

◆ updateTabsMargin()

void ChatWindow::updateTabsMargin ( )
private

Definition at line 266 of file chatwindow.cpp.

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

Referenced by adjustTabSize(), and ChatWindow().

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

◆ updateVisibility()

void ChatWindow::updateVisibility ( )

Definition at line 2080 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().

2081 {
2082  if (gui == nullptr)
2083  return;
2084 
2085  int mouseX = 0;
2086  int mouseY = 0;
2087  int x = 0;
2088  int y = 0;
2089  Gui::getMouseState(mouseX, mouseY);
2090  getAbsolutePosition(x, y);
2091  if (mChatInput->isVisible())
2092  {
2093  mHaveMouse = true;
2094  }
2095  else
2096  {
2097  mHaveMouse = mouseX >= x && mouseX <= x + getWidth()
2098  && mouseY >= y && mouseY <= y + getHeight();
2099  }
2100 }
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:1153
bool isVisible() const
Definition: widget.h:377
int getHeight() const
Definition: widget.h:239
bool mHaveMouse
Definition: chatwindow.h:396
ChatInput * mChatInput
Definition: chatwindow.h:348

◆ widgetResized()

void ChatWindow::widgetResized ( const Event event)
virtual

Called whenever the widget changes size.

Reimplemented from Window.

Definition at line 343 of file chatwindow.cpp.

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

Referenced by clearAwayLog().

344 {
345  Window::widgetResized(event);
346 
347  adjustTabSize();
348 }
void adjustTabSize()
Definition: chatwindow.cpp:274
void widgetResized(const Event &event)
Definition: window.cpp:643

Friends And Related Function Documentation

◆ ChannelTab

friend class ChannelTab
friend

Definition at line 312 of file chatwindow.h.

Referenced by addChannelTab().

◆ ChatTab

friend class ChatTab
friend

Definition at line 313 of file chatwindow.h.

◆ PopupMenu

friend class PopupMenu
friend

Definition at line 315 of file chatwindow.h.

◆ WhisperTab

friend class WhisperTab
friend

Definition at line 314 of file chatwindow.h.

Referenced by addWhisperTab().

Field Documentation

◆ mAutoHide

bool ChatWindow::mAutoHide
private

Definition at line 397 of file chatwindow.h.

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

◆ mAwayLog

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

Definition at line 386 of file chatwindow.h.

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

◆ mChannels

ChannelMap ChatWindow::mChannels
private

◆ mChatButton

Button* ChatWindow::mChatButton
private

Definition at line 385 of file chatwindow.h.

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

◆ mChatColor

int ChatWindow::mChatColor
private

Definition at line 389 of file chatwindow.h.

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

◆ mChatHistoryIndex

unsigned int ChatWindow::mChatHistoryIndex
private

Definition at line 392 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 383 of file chatwindow.h.

Referenced by ~ChatWindow().

◆ mColorPicker

DropDown* ChatWindow::mColorPicker
private

Definition at line 384 of file chatwindow.h.

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

◆ mCommands

History ChatWindow::mCommands
private

Command list.

Definition at line 378 of file chatwindow.h.

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

◆ mCurHist

HistoryIterator ChatWindow::mCurHist
private

History iterator.

Definition at line 374 of file chatwindow.h.

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

◆ mCustomWords

History ChatWindow::mCustomWords
private

Definition at line 379 of file chatwindow.h.

Referenced by autoComplete(), and loadCustomList().

◆ mEmoteButtonSpacing

int ChatWindow::mEmoteButtonSpacing
private

Definition at line 390 of file chatwindow.h.

Referenced by adjustTabSize().

◆ mEmoteButtonY

int ChatWindow::mEmoteButtonY
private

Definition at line 391 of file chatwindow.h.

Referenced by adjustTabSize().

◆ mEnableTradeFilter

bool ChatWindow::mEnableTradeFilter
private

Definition at line 400 of file chatwindow.h.

Referenced by optionChanged(), and resortChatLog().

◆ mGlobalsFilter

StringVect ChatWindow::mGlobalsFilter
private

Definition at line 388 of file chatwindow.h.

Referenced by addGlobalMessage(), and parseGlobalsFilter().

◆ mGMLoaded

bool ChatWindow::mGMLoaded
private

Definition at line 395 of file chatwindow.h.

Referenced by loadGMCommands().

◆ mHaveMouse

bool ChatWindow::mHaveMouse
private

Definition at line 396 of file chatwindow.h.

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

◆ mHighlights

StringVect ChatWindow::mHighlights
private

Definition at line 387 of file chatwindow.h.

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

◆ mHistory

History ChatWindow::mHistory
private

Command history.

Definition at line 373 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 342 of file chatwindow.h.

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

◆ mRainbowColor

unsigned int ChatWindow::mRainbowColor
protected

Definition at line 354 of file chatwindow.h.

Referenced by addColors().

◆ mReturnToggles

bool ChatWindow::mReturnToggles
private

Definition at line 393 of file chatwindow.h.

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

◆ mShowAllLang

bool ChatWindow::mShowAllLang
private

Definition at line 399 of file chatwindow.h.

Referenced by resortChatLog().

◆ mShowBattleEvents

bool ChatWindow::mShowBattleEvents
private

Definition at line 398 of file chatwindow.h.

Referenced by attributeChanged(), and optionChanged().

◆ mTmpVisible

bool ChatWindow::mTmpVisible
private

Definition at line 401 of file chatwindow.h.

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

◆ mTradeFilter

StringVect ChatWindow::mTradeFilter
private

Definition at line 381 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: