summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs/chat
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/tabs/chat')
-rw-r--r--src/gui/widgets/tabs/chat/battletab.cpp44
-rw-r--r--src/gui/widgets/tabs/chat/battletab.h43
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.cpp77
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.h51
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp563
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h216
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.cpp108
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.h59
-rw-r--r--src/gui/widgets/tabs/chat/gmtab.cpp57
-rw-r--r--src/gui/widgets/tabs/chat/gmtab.h49
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.cpp125
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.h56
-rw-r--r--src/gui/widgets/tabs/chat/langtab.cpp38
-rw-r--r--src/gui/widgets/tabs/chat/langtab.h39
-rw-r--r--src/gui/widgets/tabs/chat/partytab.cpp151
-rw-r--r--src/gui/widgets/tabs/chat/partytab.h58
-rw-r--r--src/gui/widgets/tabs/chat/tradetab.cpp50
-rw-r--r--src/gui/widgets/tabs/chat/tradetab.h46
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.cpp130
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.h73
20 files changed, 0 insertions, 2033 deletions
diff --git a/src/gui/widgets/tabs/chat/battletab.cpp b/src/gui/widgets/tabs/chat/battletab.cpp
deleted file mode 100644
index fc45fd5e1..000000000
--- a/src/gui/widgets/tabs/chat/battletab.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/battletab.h"
-
-#include "configuration.h"
-
-#include "utils/gettext.h"
-
-#include "debug.h"
-
-BattleTab *battleChatTab = nullptr;
-
-BattleTab::BattleTab(const Widget2 *const widget) :
- // TRANSLATORS: battle chat tab name
- ChatTab(widget, _("Battle"), "", "#Battle", ChatTabType::BATTLE)
-{
- setTabColors(ThemeColorId::BATTLE_CHAT_TAB);
- if (config.getBoolValue("showChatHistory"))
- loadFromLogFile("#Battle");
-}
-
-BattleTab::~BattleTab()
-{
-}
diff --git a/src/gui/widgets/tabs/chat/battletab.h b/src/gui/widgets/tabs/chat/battletab.h
deleted file mode 100644
index 24f69c8b9..000000000
--- a/src/gui/widgets/tabs/chat/battletab.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_BATTLETAB_H
-#define GUI_WIDGETS_TABS_CHAT_BATTLETAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for a party chat channel.
- */
-class BattleTab final : public ChatTab
-{
- public:
- explicit BattleTab(const Widget2 *const widget);
-
- A_DELETE_COPY(BattleTab)
-
- ~BattleTab();
-};
-
-extern BattleTab *battleChatTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_BATTLETAB_H
diff --git a/src/gui/widgets/tabs/chat/channeltab.cpp b/src/gui/widgets/tabs/chat/channeltab.cpp
deleted file mode 100644
index 37e6237a0..000000000
--- a/src/gui/widgets/tabs/chat/channeltab.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/channeltab.h"
-
-#include "gui/widgets/windowcontainer.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "net/chathandler.h"
-
-#include "debug.h"
-
-ChannelTab::ChannelTab(const Widget2 *const widget,
- const std::string &channel) :
- ChatTab(widget, channel, channel, channel, ChatTabType::CHANNEL)
-{
- setTabColors(ThemeColorId::CHANNEL_CHAT_TAB);
-}
-
-ChannelTab::~ChannelTab()
-{
- if (chatWindow != nullptr)
- chatWindow->removeChannel(mChannelName);
-}
-
-void ChannelTab::handleInput(const std::string &msg)
-{
- std::string newMsg;
- newMsg = ChatWindow::doReplace(msg);
- chatHandler->channelMessage(mChannelName, newMsg);
-}
-
-bool ChannelTab::handleCommand(const std::string &restrict type,
- const std::string &restrict args A_UNUSED)
-{
- if (type == "close")
- {
- if (windowContainer != nullptr)
- windowContainer->scheduleDelete(this);
- else
- delete this;
- if (chatWindow != nullptr)
- chatWindow->defaultTab();
- }
- else
- {
- return false;
- }
-
- return true;
-}
-
-void ChannelTab::getAutoCompleteCommands(StringVect& commands) const
-{
- commands.push_back("/close");
- commands.push_back(mChannelName);
-}
diff --git a/src/gui/widgets/tabs/chat/channeltab.h b/src/gui/widgets/tabs/chat/channeltab.h
deleted file mode 100644
index 3ac51e59d..000000000
--- a/src/gui/widgets/tabs/chat/channeltab.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_CHANNELTAB_H
-#define GUI_WIDGETS_TABS_CHAT_CHANNELTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for a chat channel.
- */
-class ChannelTab final : public ChatTab
-{
- public:
- ChannelTab(const Widget2 *const widget,
- const std::string &channel);
-
- A_DELETE_COPY(ChannelTab)
-
- ~ChannelTab();
-
- protected:
- void handleInput(const std::string &msg) override final;
-
- bool handleCommand(const std::string &restrict type,
- const std::string &restrict args) override final;
-
- void getAutoCompleteCommands(StringVect& commands)
- const override final;
-};
-
-#endif // GUI_WIDGETS_TABS_CHAT_CHANNELTAB_H
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
deleted file mode 100644
index e4f6d751a..000000000
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-#include "chatlogger.h"
-#include "configuration.h"
-#include "settings.h"
-#include "soundmanager.h"
-
-#include "being/localplayer.h"
-
-#include "const/sound.h"
-
-#include "gui/chatlog.h"
-#include "gui/windowmanager.h"
-
-#include "gui/windows/chatwindow.h"
-#include "gui/windows/helpwindow.h"
-
-#include "gui/widgets/scrollarea.h"
-#include "gui/widgets/itemlinkhandler.h"
-#include "gui/widgets/tabbedarea.h"
-
-#include "input/inputmanager.h"
-
-#include "net/chathandler.h"
-#include "net/net.h"
-
-#include "utils/chatutils.h"
-#include "utils/delete2.h"
-#include "utils/gettext.h"
-
-#ifdef WIN32
-#include <sys/time.h>
-#endif // WIN32
-
-#include <sstream>
-
-#include "debug.h"
-
-ChatTab *localChatTab = nullptr;
-ChatTab *debugChatTab = nullptr;
-
-static const unsigned int MAX_WORD_SIZE = 50;
-
-ChatTab::ChatTab(const Widget2 *const widget,
- const std::string &name,
- const std::string &channel,
- const std::string &logName,
- const ChatTabTypeT &type) :
- Tab(widget),
- mTextOutput(new BrowserBox(this, Opaque_true,
- "browserbox.xml")),
- mScrollArea(new ScrollArea(this, mTextOutput, Opaque_false)),
- mChannelName(channel),
- mLogName(logName),
- mType(type),
- mAllowHightlight(true),
- mRemoveNames(false),
- mNoAway(false),
- mShowOnline(false)
-{
- setCaption(name);
-
- mTextOutput->setOpaque(Opaque_false);
- mTextOutput->setMaxRow(config.getIntValue("ChatLogLength"));
- if (chatWindow != nullptr)
- mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
- mTextOutput->setAlwaysUpdate(false);
-
- mScrollArea->setScrollPolicy(ScrollArea::SHOW_NEVER,
- ScrollArea::SHOW_ALWAYS);
- mScrollArea->setScrollAmount(0, 1);
-
- if (chatWindow != nullptr)
- chatWindow->addTab(this);
- mTextOutput->updateSize(true);
-}
-
-ChatTab::~ChatTab()
-{
- if (chatWindow != nullptr)
- chatWindow->removeTab(this);
-
- delete2(mTextOutput);
- delete2(mScrollArea);
-}
-
-void ChatTab::chatLog(std::string line,
- ChatMsgTypeT own,
- const IgnoreRecord ignoreRecord,
- const TryRemoveColors tryRemoveColors)
-{
- // Trim whitespace
- trim(line);
-
- if (line.empty())
- return;
-
- if (tryRemoveColors == TryRemoveColors_true &&
- own == ChatMsgType::BY_OTHER &&
- config.getBoolValue("removeColors"))
- {
- line = removeColors(line);
- if (line.empty())
- return;
- }
-
- const unsigned lineLim = config.getIntValue("chatMaxCharLimit");
- if (lineLim > 0 && line.length() > lineLim)
- line = line.substr(0, lineLim);
-
- if (line.empty())
- return;
-
- CHATLOG tmp;
- tmp.own = own;
- tmp.nick.clear();
- tmp.text = line;
-
- const size_t pos = line.find(" : ");
- if (pos != std::string::npos)
- {
- if (line.length() <= pos + 3)
- return;
-
- tmp.nick = line.substr(0, pos);
- tmp.text = line.substr(pos + 3);
- }
- else
- {
- // Fix the owner of welcome message.
- if (line.length() > 7 && line.substr(0, 7) == "Welcome")
- own = ChatMsgType::BY_SERVER;
- }
-
- // *implements actions in a backwards compatible way*
- if ((own == ChatMsgType::BY_PLAYER || own == ChatMsgType::BY_OTHER) &&
- tmp.text.at(0) == '*' &&
- tmp.text.at(tmp.text.length()-1) == '*')
- {
- tmp.text[0] = ' ';
- tmp.text.erase(tmp.text.length() - 1);
- own = ChatMsgType::ACT_IS;
- }
-
- std::string lineColor("##C");
- switch (own)
- {
- case ChatMsgType::BY_GM:
- if (tmp.nick.empty())
- {
- // TRANSLATORS: chat message
- tmp.nick = std::string(_("Global announcement:")).append(" ");
- lineColor = "##G";
- }
- else
- {
- // TRANSLATORS: chat message
- tmp.nick = strprintf(_("Global announcement from %s:"),
- tmp.nick.c_str()).append(" ");
- lineColor = "##g"; // Equiv. to BrowserBox::RED
- }
- break;
- case ChatMsgType::BY_PLAYER:
- tmp.nick.append(": ");
- lineColor = "##Y";
- break;
- case ChatMsgType::BY_OTHER:
- case ChatMsgType::BY_UNKNOWN:
- tmp.nick.append(": ");
- lineColor = "##C";
- break;
- case ChatMsgType::BY_SERVER:
- // TRANSLATORS: chat message
- tmp.nick.clear();
- tmp.text = line;
- lineColor = "##S";
- break;
- case ChatMsgType::BY_CHANNEL:
- tmp.nick.clear();
- lineColor = "##2"; // Equiv. to BrowserBox::GREEN
- break;
- case ChatMsgType::ACT_WHISPER:
- // TRANSLATORS: chat message
- tmp.nick = strprintf(_("%s whispers: %s"), tmp.nick.c_str(), "");
- lineColor = "##W";
- break;
- case ChatMsgType::ACT_IS:
- lineColor = "##I";
- break;
- case ChatMsgType::BY_LOGGER:
- tmp.nick.clear();
- tmp.text = line;
- lineColor = "##L";
- break;
- default:
- break;
- }
-
- if (tmp.nick == ": ")
- {
- tmp.nick.clear();
- lineColor = "##S";
- }
-
- // if configured, move magic messages log to debug chat tab
- if (Net::getNetworkType() == ServerType::TMWATHENA
- && (localChatTab != nullptr) && this == localChatTab
- && ((config.getBoolValue("showMagicInDebug")
- && own == ChatMsgType::BY_PLAYER
- && tmp.text.length() > 1
- && tmp.text.at(0) == '#'
- && tmp.text.at(1) != '#')
- || (config.getBoolValue("serverMsgInDebug")
- && (own == ChatMsgType::BY_SERVER
- || tmp.nick.empty()))))
- {
- if (debugChatTab != nullptr)
- debugChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
- return;
- }
-
- // Get the current system time
- time_t t;
- time(&t);
-
- if (config.getBoolValue("useLocalTime"))
- {
- const tm *const timeInfo = localtime(&t);
- if (timeInfo != nullptr)
- {
- line = strprintf("%s[%02d:%02d] %s%s", lineColor.c_str(),
- timeInfo->tm_hour, timeInfo->tm_min, tmp.nick.c_str(),
- tmp.text.c_str());
- }
- else
- {
- line = strprintf("%s %s%s", lineColor.c_str(),
- tmp.nick.c_str(), tmp.text.c_str());
- }
- }
- else
- {
- // Format the time string properly
- std::stringstream timeStr;
- timeStr << "[" << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
- << CAST_S32(((t / 60) / 60) % 24)
- << ":" << (((t / 60) % 60 < 10) ? "0" : "")
- << CAST_S32((t / 60) % 60)
- << "] ";
- line = std::string(lineColor).append(timeStr.str()).append(
- tmp.nick).append(tmp.text);
- }
-
- if (config.getBoolValue("enableChatLog"))
- saveToLogFile(line);
-
- mTextOutput->setMaxRow(config.getIntValue("chatMaxLinesLimit"));
-
- // We look if the Vertical Scroll Bar is set at the max before
- // adding a row, otherwise the max will always be a row higher
- // at comparison.
- if (mScrollArea->getVerticalScrollAmount() + 2 >=
- mScrollArea->getVerticalMaxScroll())
- {
- addRow(line);
- mScrollArea->setVerticalScrollAmount(
- mScrollArea->getVerticalMaxScroll());
- }
- else
- {
- addRow(line);
- }
-
- if ((chatWindow != nullptr) && this == localChatTab)
- chatWindow->addToAwayLog(line);
-
- mScrollArea->logic();
- if (own != ChatMsgType::BY_PLAYER)
- {
- if (own == ChatMsgType::BY_SERVER &&
- (getType() == ChatTabType::PARTY ||
- getType() == ChatTabType::CHANNEL ||
- getType() == ChatTabType::GUILD))
- {
- return;
- }
-
- const TabbedArea *const tabArea = getTabbedArea();
- if (tabArea == nullptr)
- return;
-
- const bool notFocused = WindowManager::getIsMinimized() ||
- (!settings.mouseFocused &&
- settings.inputFocused == KeyboardFocus::Unfocused);
-
- if (this != tabArea->getSelectedTab() || notFocused)
- {
- if (getFlash() == 0)
- {
- if (chatWindow != nullptr &&
- chatWindow->findHighlight(tmp.text))
- {
- setFlash(2);
- soundManager.playGuiSound(SOUND_HIGHLIGHT);
- }
- else
- {
- setFlash(1);
- }
- }
- else if (getFlash() == 2)
- {
- if (chatWindow != nullptr &&
- chatWindow->findHighlight(tmp.text))
- {
- soundManager.playGuiSound(SOUND_HIGHLIGHT);
- }
- }
- }
-
- if ((getAllowHighlight() ||
- own == ChatMsgType::BY_GM) &&
- (this != tabArea->getSelectedTab() ||
- notFocused))
- {
- if (own == ChatMsgType::BY_GM)
- {
- if (chatWindow != nullptr)
- chatWindow->unHideWindow();
- soundManager.playGuiSound(SOUND_GLOBAL);
- }
- else if (own != ChatMsgType::BY_SERVER)
- {
- if (chatWindow != nullptr)
- chatWindow->unHideWindow();
- playNewMessageSound();
- }
- WindowManager::newChatMessage();
- }
- }
-}
-
-void ChatTab::chatLog(const std::string &nick, std::string msg)
-{
- if (localPlayer == nullptr)
- return;
-
- const ChatMsgTypeT byWho = (nick == localPlayer->getName()
- ? ChatMsgType::BY_PLAYER : ChatMsgType::BY_OTHER);
- if (byWho == ChatMsgType::BY_OTHER && config.getBoolValue("removeColors"))
- msg = removeColors(msg);
- chatLog(std::string(nick).append(" : ").append(msg),
- byWho,
- IgnoreRecord_false,
- TryRemoveColors_false);
-}
-
-void ChatTab::chatInput(const std::string &message)
-{
- std::string msg = message;
- trim(msg);
-
- if (msg.empty())
- return;
-
- replaceItemLinks(msg);
- replaceVars(msg);
-
- switch (msg[0])
- {
- case '/':
- handleCommandStr(std::string(msg, 1));
- break;
- case '?':
- if (msg.size() > 1 &&
- msg[1] != '!' &&
- msg[1] != '?' &&
- msg[1] != '.' &&
- msg[1] != ' ' &&
- msg[1] != ',')
- {
- handleHelp(std::string(msg, 1));
- }
- else
- {
- handleInput(msg);
- }
- break;
- default:
- handleInput(msg);
- break;
- }
-}
-
-void ChatTab::scroll(const int amount)
-{
- const int range = mScrollArea->getHeight() / 8 * amount;
- Rect scr;
- scr.y = mScrollArea->getVerticalScrollAmount() + range;
- scr.height = abs(range);
- mTextOutput->showPart(scr);
-}
-
-void ChatTab::clearText()
-{
- mTextOutput->clearRows();
-}
-
-void ChatTab::handleInput(const std::string &msg)
-{
- if (chatHandler)
- {
- chatHandler->talk(ChatWindow::doReplace(msg),
- mChannelName);
- }
-}
-
-void ChatTab::handleCommandStr(const std::string &msg)
-{
- const size_t pos = msg.find(' ');
- const std::string type(msg, 0, pos);
- std::string args(msg, pos == std::string::npos ? msg.size() : pos + 1);
-
- args = trim(args);
- if (!handleCommand(type, args))
- inputManager.executeChatCommand(type, args, this);
-}
-
-void ChatTab::handleHelp(const std::string &msg)
-{
- if (helpWindow != nullptr)
- {
- helpWindow->search(msg);
- helpWindow->requestMoveToTop();
- }
-}
-
-bool ChatTab::handleCommands(const std::string &type, const std::string &args)
-{
- // need split to commands and call each
-
- return handleCommand(type, args);
-}
-
-void ChatTab::saveToLogFile(const std::string &msg) const
-{
- if (chatLogger != nullptr)
- {
- if (getType() == ChatTabType::INPUT)
- {
- chatLogger->log(msg);
- }
- else if (getType() == ChatTabType::DEBUG)
- {
- if (config.getBoolValue("enableDebugLog"))
- chatLogger->log("#Debug", msg);
- }
- else if (!mLogName.empty())
- {
- chatLogger->log(mLogName, msg);
- }
- }
-}
-
-void ChatTab::addRow(std::string &line)
-{
- if (line.find("[@@http") == std::string::npos)
- {
- size_t idx = 0;
- for (size_t f = 0; f < line.length(); f++)
- {
- if (line.at(f) == ' ')
- {
- idx = f;
- }
- else if (f - idx > MAX_WORD_SIZE)
- {
- line.insert(f, " ");
- idx = f;
- }
- }
- }
- mTextOutput->addRow(line);
-}
-
-void ChatTab::loadFromLogFile(const std::string &name)
-{
- if (chatLogger != nullptr)
- {
- std::list<std::string> list;
- chatLogger->loadLast(name, list, 5);
- std::list<std::string>::const_iterator i = list.begin();
- while (i != list.end())
- {
- std::string line("##o" + *i);
- addRow(line);
- ++i;
- }
- }
-}
-
-void ChatTab::addNewRow(std::string &line)
-{
- if (mScrollArea->getVerticalScrollAmount() >=
- mScrollArea->getVerticalMaxScroll())
- {
- addRow(line);
- mScrollArea->setVerticalScrollAmount(
- mScrollArea->getVerticalMaxScroll());
- }
- else
- {
- addRow(line);
- }
- mScrollArea->logic();
-}
-
-void ChatTab::playNewMessageSound() const
-{
- soundManager.playGuiSound(SOUND_WHISPER);
-}
-
-void ChatTab::showOnline(const std::string &nick,
- const Online online)
-{
- if (!mShowOnline)
- return;
-
- if (online == Online_true)
- {
- // TRANSLATORS: chat message
- chatLog(strprintf(_("%s is now Online."), nick.c_str()),
- ChatMsgType::BY_SERVER);
- }
- else
- {
- // TRANSLATORS: chat message
- chatLog(strprintf(_("%s is now Offline."), nick.c_str()),
- ChatMsgType::BY_SERVER);
- }
-}
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
deleted file mode 100644
index 440501af4..000000000
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_CHATTAB_H
-#define GUI_WIDGETS_TABS_CHAT_CHATTAB_H
-
-#include "enums/gui/chatmsgtype.h"
-#include "enums/gui/chattabtype.h"
-
-#include "enums/simpletypes/ignorerecord.h"
-#include "enums/simpletypes/online.h"
-#include "enums/simpletypes/tryremovecolors.h"
-
-#include "gui/widgets/browserbox.h"
-
-#include "gui/widgets/tabs/tab.h"
-
-#include "localconsts.h"
-
-class ScrollArea;
-
-#define debugMsg(str) \
- if (debugChatTab) \
- debugChatTab->chatLog(str, ChatMsgType::BY_SERVER);
-
-#define setTabColors(name) \
- setTabColor(&getThemeColor(name), \
- &getThemeColor(name##_OUTLINE)); \
- setHighlightedTabColor(&getThemeColor(name##_HIGHLIGHTED), \
- &getThemeColor(name##_HIGHLIGHTED_OUTLINE)); \
- setSelectedTabColor(&getThemeColor(name##_SELECTED), \
- &getThemeColor(name##_SELECTED_OUTLINE))
-
-/**
- * A tab for the chat window. This is special to ease chat handling.
- */
-class ChatTab notfinal : public Tab
-{
- public:
- /**
- * Constructor.
- */
- ChatTab(const Widget2 *const widget,
- const std::string &name,
- const std::string &channel,
- const std::string &logName,
- const ChatTabTypeT &type);
-
- A_DELETE_COPY(ChatTab)
-
- virtual ~ChatTab();
-
- /**
- * Adds a line of text to our message list. Parameters:
- *
- * @param line Text message.
- * @param own Type of message (usually the owner-type).
- * @param ignoreRecord should this not be recorded?
- * @param tryRemoveColors try remove color if configured
- */
- void chatLog(std::string line,
- ChatMsgTypeT own,
- const IgnoreRecord ignoreRecord = IgnoreRecord_false,
- const TryRemoveColors tryRemoveColors
- = TryRemoveColors_true);
-
- /**
- * Adds the text to the message list
- *
- * @param msg The message text which is to be sent.
- */
- void chatLog(const std::string &nick, std::string msg);
-
- /**
- * Determines whether the message is a command or message, then
- * sends the given message to the game server to be said, or to the
- * command handler
- *
- * @param msg The message text which is to be sent.
- */
- void chatInput(const std::string &msg);
-
- /**
- * Scrolls the chat window
- *
- * @param amount direction 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.
- */
- void scroll(const int amount);
-
- /**
- * Clears the text from the tab
- */
- void clearText();
-
- /**
- * Handle special commands. Allows a tab to handle commands it
- * defines itself.
- *
- * @returns true if the command was handled
- * false if the command was not handled
- */
- virtual bool handleCommand(const std::string &restrict type A_UNUSED,
- const std::string &restrict args A_UNUSED)
- { return false; }
-
- /**
- * Handle special commands. Allows a tab to handle commands it
- * defines itself.
- *
- * @returns true if the command was handled
- * false if the command was not handled
- */
- virtual bool handleCommands(const std::string &type,
- const std::string &args);
-
- /**
- * Returns type of the being.
- */
- ChatTabTypeT getType() const noexcept2 A_WARN_UNUSED
- { return mType; }
-
- void saveToLogFile(const std::string &msg) const;
-
- const std::list<std::string> &getRows() const A_WARN_UNUSED
- { return mTextOutput->getRows(); }
-
- bool hasRows() const A_WARN_UNUSED
- { return mTextOutput->hasRows(); }
-
- void loadFromLogFile(const std::string &name);
-
- bool getAllowHighlight() const noexcept2 A_WARN_UNUSED
- { return mAllowHightlight; }
-
- void setAllowHighlight(const bool n) noexcept2
- { mAllowHightlight = n; }
-
- bool getRemoveNames() const noexcept2 A_WARN_UNUSED
- { return mRemoveNames; }
-
- void setRemoveNames(const bool n) noexcept2
- { mRemoveNames = n; }
-
- bool getNoAway() const noexcept2 A_WARN_UNUSED
- { return mNoAway; }
-
- void setNoAway(const bool n) noexcept2
- { mNoAway = n; }
-
- void addNewRow(std::string &line);
-
- void showOnline(const std::string &nick,
- const Online online);
-
- virtual void playNewMessageSound() const;
-
- const std::string &getChannelName() const
- { return mChannelName; }
-
- protected:
- friend class ChatWindow;
- friend class WhisperWindow;
-
- void setCurrent() override final
- { setFlash(0); }
-
- virtual void handleInput(const std::string &msg);
-
- virtual void handleCommandStr(const std::string &msg);
-
- virtual void handleHelp(const std::string &msg);
-
- virtual void getAutoCompleteList(StringVect &names A_UNUSED) const
- {}
-
- virtual void getAutoCompleteCommands(StringVect &names A_UNUSED) const
- {}
-
- void addRow(std::string &line);
-
- BrowserBox *mTextOutput A_NONNULLPOINTER;
- ScrollArea *mScrollArea;
- std::string mChannelName;
- std::string mLogName;
- ChatTabTypeT mType;
- bool mAllowHightlight;
- bool mRemoveNames;
- bool mNoAway;
- bool mShowOnline;
-};
-
-extern ChatTab *localChatTab;
-extern ChatTab *debugChatTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_CHATTAB_H
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
deleted file mode 100644
index 4e94bf11d..000000000
--- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef TMWA_SUPPORT
-
-#include "gui/widgets/tabs/chat/emulateguildtab.h"
-
-#include "configuration.h"
-#include "soundmanager.h"
-
-#include "const/sound.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "utils/gettext.h"
-
-#include "net/tmwa/guildmanager.h"
-
-#include "debug.h"
-
-EmulateGuildTab::EmulateGuildTab(const Widget2 *const widget) :
- // TRANSLATORS: guild chat tab name
- ChatTab(widget, _("Guild"), "", "#Guild", ChatTabType::GUILD),
- ConfigListener()
-{
- setTabColors(ThemeColorId::GUILD_CHAT_TAB);
- mShowOnline = config.getBoolValue("showGuildOnline");
- config.addListener("showGuildOnline", this);
-}
-
-EmulateGuildTab::~EmulateGuildTab()
-{
- config.removeListeners(this);
- CHECKLISTENERS
-}
-
-bool EmulateGuildTab::handleCommand(const std::string &restrict type,
- const std::string &restrict args)
-{
- if (type == "invite")
- GuildManager::invite(args);
- else if (type == "leave")
- GuildManager::leave();
- else if (type == "kick")
- GuildManager::kick(args);
- else if (type == "notice")
- GuildManager::notice(args);
- else
- return false;
-
- return true;
-}
-
-void EmulateGuildTab::handleInput(const std::string &msg)
-{
- if (guildManager == nullptr)
- return;
- guildManager->chat(ChatWindow::doReplace(msg));
-}
-
-void EmulateGuildTab::getAutoCompleteList(StringVect &names) const
-{
- if (guildManager == nullptr)
- return;
-
- guildManager->getNames(names);
-}
-
-void EmulateGuildTab::getAutoCompleteCommands(StringVect &names) const
-{
- names.push_back("/help");
- names.push_back("/invite ");
- names.push_back("/leave");
- names.push_back("/kick ");
- names.push_back("/notice ");
-}
-
-void EmulateGuildTab::playNewMessageSound() const
-{
- soundManager.playGuiSound(SOUND_GUILD);
-}
-
-void EmulateGuildTab::optionChanged(const std::string &value)
-{
- if (value == "showGuildOnline")
- mShowOnline = config.getBoolValue("showGuildOnline");
-}
-
-#endif // TMWA_SUPPORT
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.h b/src/gui/widgets/tabs/chat/emulateguildtab.h
deleted file mode 100644
index 3cf3a0e59..000000000
--- a/src/gui/widgets/tabs/chat/emulateguildtab.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
-#define GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
-
-#ifdef TMWA_SUPPORT
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * Emulate guild tab, because server not support normal guilds.
- */
-class EmulateGuildTab final : public ChatTab,
- public ConfigListener
-{
- public:
- explicit EmulateGuildTab(const Widget2 *const widget);
-
- A_DELETE_COPY(EmulateGuildTab)
-
- ~EmulateGuildTab();
-
- bool handleCommand(const std::string &restrict type,
- const std::string &restrict args) override final;
-
- void playNewMessageSound() const override final;
-
- void optionChanged(const std::string &value) override final;
-
- protected:
- void handleInput(const std::string &msg) override final;
-
- void getAutoCompleteList(StringVect &names) const override final;
-
- void getAutoCompleteCommands(StringVect &names) const override final;
-};
-
-#endif // TMWA_SUPPORT
-#endif // GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
diff --git a/src/gui/widgets/tabs/chat/gmtab.cpp b/src/gui/widgets/tabs/chat/gmtab.cpp
deleted file mode 100644
index 3a63cbd2d..000000000
--- a/src/gui/widgets/tabs/chat/gmtab.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2013-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/gmtab.h"
-
-#include "const/gui/chat.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "utils/gettext.h"
-
-#include "net/chathandler.h"
-
-#include "debug.h"
-
-GmTab *gmChatTab = nullptr;
-
-GmTab::GmTab(const Widget2 *const widget) :
- // TRANSLATORS: gb tab name
- ChatTab(widget, _("GM"), GM_CHANNEL, "#GM", ChatTabType::GM)
-{
- setTabColors(ThemeColorId::GM_CHAT_TAB);
-}
-
-GmTab::~GmTab()
-{
-}
-
-void GmTab::handleInput(const std::string &msg)
-{
- chatHandler->channelMessage(mChannelName, ChatWindow::doReplace(msg));
-}
-
-void GmTab::handleCommandStr(const std::string &msg A_UNUSED)
-{
-}
-
-void GmTab::getAutoCompleteList(StringVect &names A_UNUSED) const
-{
-}
diff --git a/src/gui/widgets/tabs/chat/gmtab.h b/src/gui/widgets/tabs/chat/gmtab.h
deleted file mode 100644
index a8dd46fd3..000000000
--- a/src/gui/widgets/tabs/chat/gmtab.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2013-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_GMTAB_H
-#define GUI_WIDGETS_TABS_CHAT_GMTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for whispers from a single player.
- */
-class GmTab final : public ChatTab
-{
- public:
- explicit GmTab(const Widget2 *const widget);
-
- A_DELETE_COPY(GmTab)
-
- ~GmTab();
-
- protected:
- void getAutoCompleteList(StringVect &names) const
- override final A_CONST;
-
- void handleInput(const std::string &msg) override final;
-
- void handleCommandStr(const std::string &msg) override final A_CONST;
-};
-
-extern GmTab *gmChatTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_GMTAB_H
diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp
deleted file mode 100644
index 51416b8ef..000000000
--- a/src/gui/widgets/tabs/chat/guildtab.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/guildtab.h"
-
-#include "configuration.h"
-#include "soundmanager.h"
-
-#include "const/sound.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "input/inputmanager.h"
-
-#include "net/guildhandler.h"
-
-#include "utils/gettext.h"
-
-#include "debug.h"
-
-namespace EAthena
-{
- extern Guild *taGuild;
-} // namespace EAthena
-
-GuildTab::GuildTab(const Widget2 *const widget) :
- // TRANSLATORS: guild chat tab name
- ChatTab(widget, _("Guild"), "", "#Guild", ChatTabType::GUILD)
-{
- setTabColors(ThemeColorId::GUILD_CHAT_TAB);
- mShowOnline = config.getBoolValue("showGuildOnline");
- config.addListener("showGuildOnline", this);
-}
-
-GuildTab::~GuildTab()
-{
- config.removeListeners(this);
- CHECKLISTENERS
-}
-
-bool GuildTab::handleCommand(const std::string &restrict type,
- const std::string &restrict args)
-{
- if (type == "invite" && (EAthena::taGuild != nullptr))
- {
- guildHandler->invite(args);
- }
- else if (type == "leave" && (EAthena::taGuild != nullptr))
- {
- inputManager.executeChatCommand(InputAction::LEAVE_GUILD,
- std::string(),
- this);
- }
- else if (type == "kick" && (EAthena::taGuild != nullptr))
- {
- inputManager.executeChatCommand(InputAction::KICK_GUILD,
- args,
- this);
- }
- else if (type == "notice" && (EAthena::taGuild != nullptr))
- {
- inputManager.executeChatCommand(InputAction::GUILD_NOTICE,
- args,
- this);
- }
- else
- {
- return false;
- }
-
- return true;
-}
-
-void GuildTab::handleInput(const std::string &msg)
-{
- if (EAthena::taGuild == nullptr)
- return;
-
- guildHandler->chat(ChatWindow::doReplace(msg));
-}
-
-void GuildTab::getAutoCompleteList(StringVect &names) const
-{
- if (EAthena::taGuild != nullptr)
- EAthena::taGuild->getNames(names);
-}
-
-void GuildTab::getAutoCompleteCommands(StringVect &names) const
-{
- names.push_back("/help");
- names.push_back("/invite ");
- names.push_back("/kick ");
- names.push_back("/notice ");
- names.push_back("/leave");
-}
-
-void GuildTab::playNewMessageSound() const
-{
- soundManager.playGuiSound(SOUND_GUILD);
-}
-
-void GuildTab::optionChanged(const std::string &value)
-{
- if (value == "showGuildOnline")
- mShowOnline = config.getBoolValue("showGuildOnline");
-}
diff --git a/src/gui/widgets/tabs/chat/guildtab.h b/src/gui/widgets/tabs/chat/guildtab.h
deleted file mode 100644
index 5aa540ecb..000000000
--- a/src/gui/widgets/tabs/chat/guildtab.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_GUILDTAB_H
-#define GUI_WIDGETS_TABS_CHAT_GUILDTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for a guild chat channel.
- */
-class GuildTab notfinal : public ChatTab,
- public ConfigListener
-{
- public:
- explicit GuildTab(const Widget2 *const widget);
-
- A_DELETE_COPY(GuildTab)
-
- virtual ~GuildTab();
-
- bool handleCommand(const std::string &restrict type,
- const std::string &restrict args) override final;
-
- void playNewMessageSound() const override final;
-
- void optionChanged(const std::string &value) override final;
-
- protected:
- void handleInput(const std::string &msg) override final;
-
- void getAutoCompleteList(StringVect &names) const override final;
-
- void getAutoCompleteCommands(StringVect &names) const override final;
-};
-
-#endif // GUI_WIDGETS_TABS_CHAT_GUILDTAB_H
diff --git a/src/gui/widgets/tabs/chat/langtab.cpp b/src/gui/widgets/tabs/chat/langtab.cpp
deleted file mode 100644
index ba1e21711..000000000
--- a/src/gui/widgets/tabs/chat/langtab.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/langtab.h"
-
-#include "utils/gettext.h"
-
-#include "debug.h"
-
-LangTab *langChatTab = nullptr;
-
-LangTab::LangTab(const Widget2 *const widget,
- const std::string &lang) :
- // TRANSLATORS: lang chat tab name
- ChatTab(widget, _("Lang"), lang + " ", "#Lang", ChatTabType::LANG)
-{
-}
-
-LangTab::~LangTab()
-{
-}
diff --git a/src/gui/widgets/tabs/chat/langtab.h b/src/gui/widgets/tabs/chat/langtab.h
deleted file mode 100644
index 773431e85..000000000
--- a/src/gui/widgets/tabs/chat/langtab.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_LANGTAB_H
-#define GUI_WIDGETS_TABS_CHAT_LANGTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-class LangTab final : public ChatTab
-{
- public:
- LangTab(const Widget2 *const widget,
- const std::string &lang);
-
- A_DELETE_COPY(LangTab)
-
- ~LangTab();
-};
-
-extern LangTab *langChatTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_LANGTAB_H
diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp
deleted file mode 100644
index befbb0393..000000000
--- a/src/gui/widgets/tabs/chat/partytab.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/partytab.h"
-
-#include "configuration.h"
-#include "party.h"
-#include "soundmanager.h"
-
-#include "being/localplayer.h"
-
-#include "const/sound.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "input/inputmanager.h"
-
-#include "net/net.h"
-#include "net/partyhandler.h"
-
-#include "utils/gettext.h"
-
-#include "debug.h"
-
-PartyTab *partyTab = nullptr;
-
-PartyTab::PartyTab(const Widget2 *const widget) :
- // TRANSLATORS: party chat tab name
- ChatTab(widget, _("Party"), "", "#Party", ChatTabType::PARTY)
-{
- setTabColors(ThemeColorId::PARTY_CHAT_TAB);
- mShowOnline = config.getBoolValue("showPartyOnline");
- config.addListener("showPartyOnline", this);
-}
-
-PartyTab::~PartyTab()
-{
- config.removeListeners(this);
- CHECKLISTENERS
-}
-
-void PartyTab::handleInput(const std::string &msg)
-{
- partyHandler->chat(ChatWindow::doReplace(msg));
-}
-
-bool PartyTab::handleCommand(const std::string &restrict type,
- const std::string &restrict args)
-{
- if (type == "invite")
- {
- partyHandler->invite(args);
- }
- else if (type == "leave")
- {
- inputManager.executeChatCommand(InputAction::LEAVE_PARTY,
- args,
- this);
- }
- else if (type == "kick")
- {
- inputManager.executeChatCommand(InputAction::KICK_PARTY,
- args,
- this);
- }
- else if (type == "item")
- {
- inputManager.executeChatCommand(InputAction::PARTY_ITEM_SHARE,
- args,
- this);
- }
- else if (type == "autoitem")
- {
- inputManager.executeChatCommand(InputAction::PARTY_AUTO_ITEM_SHARE,
- args,
- this);
- }
- else if (type == "exp")
- {
- inputManager.executeChatCommand(InputAction::PARTY_EXP_SHARE,
- args,
- this);
- }
- else if (type == "setleader" &&
- Net::getNetworkType() != ServerType::TMWATHENA)
- {
- inputManager.executeChatCommand(
- InputAction::COMMAND_CHANGE_PARTY_LEADER,
- args,
- this);
- }
- else
- {
- return false;
- }
-
- return true;
-}
-
-void PartyTab::getAutoCompleteList(StringVect &names) const
-{
- if (localPlayer == nullptr)
- return;
-
- const Party *const p = localPlayer->getParty();
-
- if (p != nullptr)
- p->getNames(names);
-}
-
-void PartyTab::getAutoCompleteCommands(StringVect &names) const
-{
- names.push_back("/help");
- names.push_back("/invite ");
- names.push_back("/leave");
- names.push_back("/kick ");
- names.push_back("/item");
- names.push_back("/exp");
- if (Net::getNetworkType() != ServerType::TMWATHENA)
- names.push_back("/setleader ");
-}
-
-void PartyTab::playNewMessageSound() const
-{
- soundManager.playGuiSound(SOUND_GUILD);
-}
-
-void PartyTab::optionChanged(const std::string &value)
-{
- if (value == "showPartyOnline")
- mShowOnline = config.getBoolValue("showPartyOnline");
-}
diff --git a/src/gui/widgets/tabs/chat/partytab.h b/src/gui/widgets/tabs/chat/partytab.h
deleted file mode 100644
index a987c9362..000000000
--- a/src/gui/widgets/tabs/chat/partytab.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_PARTYTAB_H
-#define GUI_WIDGETS_TABS_CHAT_PARTYTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for a party chat channel.
- */
-class PartyTab notfinal : public ChatTab,
- public ConfigListener
-{
- public:
- explicit PartyTab(const Widget2 *const widget);
-
- A_DELETE_COPY(PartyTab)
-
- virtual ~PartyTab();
-
- bool handleCommand(const std::string &restrict type,
- const std::string &restrict args) override final;
-
- void playNewMessageSound() const override final;
-
- void optionChanged(const std::string &value) override final;
-
- protected:
- void handleInput(const std::string &msg) override final;
-
- void getAutoCompleteList(StringVect &names) const override final;
-
- void getAutoCompleteCommands(StringVect &names) const override final;
-};
-
-extern PartyTab *partyTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_PARTYTAB_H
diff --git a/src/gui/widgets/tabs/chat/tradetab.cpp b/src/gui/widgets/tabs/chat/tradetab.cpp
deleted file mode 100644
index e16e5c08b..000000000
--- a/src/gui/widgets/tabs/chat/tradetab.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/tradetab.h"
-
-#include "const/gui/chat.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "net/chathandler.h"
-
-#include "utils/gettext.h"
-
-#include "debug.h"
-
-TradeTab *tradeChatTab = nullptr;
-
-TradeTab::TradeTab(const Widget2 *const widget) :
- // TRANSLATORS: trade chat tab name
- ChatTab(widget, _("Trade"), TRADE_CHANNEL, "#Trade", ChatTabType::TRADE)
-{
-}
-
-TradeTab::~TradeTab()
-{
-}
-
-void TradeTab::handleInput(const std::string &msg)
-{
- chatHandler->channelMessage(mChannelName, ChatWindow::doReplace(msg));
-}
diff --git a/src/gui/widgets/tabs/chat/tradetab.h b/src/gui/widgets/tabs/chat/tradetab.h
deleted file mode 100644
index 26c9bf8f6..000000000
--- a/src/gui/widgets/tabs/chat/tradetab.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_TRADETAB_H
-#define GUI_WIDGETS_TABS_CHAT_TRADETAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for a party chat channel.
- */
-class TradeTab final : public ChatTab
-{
- public:
- explicit TradeTab(const Widget2 *const widget);
-
- A_DELETE_COPY(TradeTab)
-
- ~TradeTab();
-
- protected:
- void handleInput(const std::string &msg) override final;
-};
-
-extern TradeTab *tradeChatTab;
-
-#endif // GUI_WIDGETS_TABS_CHAT_TRADETAB_H
diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp
deleted file mode 100644
index 73b73a17c..000000000
--- a/src/gui/widgets/tabs/chat/whispertab.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/widgets/tabs/chat/whispertab.h"
-
-#include "being/localplayer.h"
-
-#include "net/chathandler.h"
-
-#include "gui/windows/chatwindow.h"
-
-#include "gui/widgets/windowcontainer.h"
-
-#include "utils/chatutils.h"
-
-#include "debug.h"
-
-WhisperTab::WhisperTab(const Widget2 *const widget,
- const std::string &caption,
- const std::string &nick) :
- ChatTab(widget, caption, nick, nick, ChatTabType::WHISPER),
- mNick(nick)
-{
- setWhisperTabColors();
-}
-
-WhisperTab::~WhisperTab()
-{
- if (chatWindow != nullptr)
- chatWindow->removeWhisper(mNick);
-}
-
-void WhisperTab::handleInput(const std::string &msg)
-{
- std::string newMsg;
- newMsg = ChatWindow::doReplace(msg);
- chatHandler->privateMessage(mNick, newMsg);
-
- if (localPlayer != nullptr)
- chatLog(localPlayer->getName(), newMsg);
- else
- chatLog("?", newMsg);
-}
-
-void WhisperTab::handleCommandStr(const std::string &msg)
-{
- if (msg == "close")
- {
- delete this;
- return;
- }
-
- const size_t pos = msg.find(' ');
- const std::string type(msg, 0, pos);
-
- if (type == "me")
- {
- const std::string args(msg, pos == std::string::npos
- ? msg.size() : pos + 1);
- std::string str = textToMe(args);
- chatHandler->privateMessage(mNick, str);
- if (localPlayer != nullptr)
- chatLog(localPlayer->getName(), str);
- else
- chatLog("?", str);
- }
- else
- {
- ChatTab::handleCommandStr(msg);
- }
-}
-
-bool WhisperTab::handleCommand(const std::string &restrict type,
- const std::string &restrict args A_UNUSED)
-{
- if (type == "close")
- {
- if (windowContainer != nullptr)
- windowContainer->scheduleDelete(this);
- else
- delete this;
- if (chatWindow != nullptr)
- chatWindow->defaultTab();
- }
- else
- {
- return false;
- }
-
- return true;
-}
-
-void WhisperTab::getAutoCompleteList(StringVect &names) const
-{
- names.push_back(mNick);
-}
-
-void WhisperTab::getAutoCompleteCommands(StringVect& commands) const
-{
- commands.push_back("/close");
-}
-
-void WhisperTab::setWhisperTabColors()
-{
- setTabColors(ThemeColorId::WHISPER_TAB);
-}
-
-void WhisperTab::setWhisperTabOfflineColors()
-{
- setTabColors(ThemeColorId::WHISPER_TAB_OFFLINE);
-}
diff --git a/src/gui/widgets/tabs/chat/whispertab.h b/src/gui/widgets/tabs/chat/whispertab.h
deleted file mode 100644
index 1d3c03857..000000000
--- a/src/gui/widgets/tabs/chat/whispertab.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2017 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WIDGETS_TABS_CHAT_WHISPERTAB_H
-#define GUI_WIDGETS_TABS_CHAT_WHISPERTAB_H
-
-#include "gui/widgets/tabs/chat/chattab.h"
-
-/**
- * A tab for whispers from a single player.
- */
-class WhisperTab final : public ChatTab
-{
- public:
- A_DELETE_COPY(WhisperTab)
-
- const std::string &getNick() const noexcept2 A_WARN_UNUSED
- { return mNick; }
-
- bool handleCommand(const std::string &restrict type,
- const std::string &restrict args) override final;
-
- void setWhisperTabColors();
-
- void setWhisperTabOfflineColors();
-
- protected:
- friend class ChatWindow;
-
- void getAutoCompleteList(StringVect &names) const override final;
-
- void getAutoCompleteCommands(StringVect& commands)
- const override final;
-
- /**
- * Constructor.
- *
- * @param nick the name of the player this tab is whispering to
- */
- WhisperTab(const Widget2 *const widget,
- const std::string &caption,
- const std::string &nick);
-
- ~WhisperTab();
-
- void handleInput(const std::string &msg) override final;
-
- void handleCommandStr(const std::string &msg) override final;
-
- private:
- std::string mNick;
-};
-
-#endif // GUI_WIDGETS_TABS_CHAT_WHISPERTAB_H