summaryrefslogtreecommitdiff
path: root/src/gui/widgets/chattab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r--src/gui/widgets/chattab.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index bbb2b8bb..c86eb2ea 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -21,7 +21,8 @@
#include "gui/widgets/chattab.h"
-#include "beingmanager.h"
+#include "actorspritemanager.h"
+#include "chatlog.h"
#include "commandhandler.h"
#include "configuration.h"
#include "localplayer.h"
@@ -51,7 +52,7 @@ ChatTab::ChatTab(const std::string &name) : Tab()
mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextOutput->setOpaque(false);
- mTextOutput->setMaxRow((int) config.getValue("ChatLogLength", 0));
+ mTextOutput->setMaxRow((int) config.getIntValue("ChatLogLength"));
mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
mTextOutput->setAlwaysUpdate(false);
@@ -73,7 +74,7 @@ ChatTab::~ChatTab()
delete mScrollArea;
}
-void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
+void ChatTab::chatLog(std::string line, Own own, bool ignoreRecord)
{
// Trim whitespace
trim(line);
@@ -182,6 +183,9 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
line = lineColor + timeStr.str() + tmp.nick + tmp.text;
+ if (config.getBoolValue("enableChatLog"))
+ saveToLogFile(line);
+
// 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.
@@ -234,7 +238,7 @@ void ChatTab::chatInput(const std::string &message)
std::string temp = msg.substr(start + 1, end - start - 1);
- const ItemInfo itemInfo = ItemDB::get(temp);
+ const ItemInfo itemInfo = itemDb->get(temp);
if (itemInfo.getId() != 0)
{
msg.insert(end, "@@");
@@ -279,7 +283,13 @@ void ChatTab::handleCommand(const std::string &msg)
void ChatTab::getAutoCompleteList(std::vector<std::string> &names) const
{
- beingManager->getPlayerNPCNameLister()->getAutoCompleteList(names);
+ actorSpriteManager->getPlayerNPCNameLister()->getAutoCompleteList(names);
+}
+
+void ChatTab::saveToLogFile(std::string &msg)
+{
+ if (chatLogger)
+ chatLogger->log(msg);
}
void ChatTab::addRow(std::string &line)