summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-26 21:35:58 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-26 21:35:58 -0600
commit2d5d31406ab057abd9417d13ab808f6823b2860b (patch)
tree363b70f23aa89e3f765e81b9b430924385626f9e /src/gui/chat.cpp
parentbf6f383e82add4634c8c091216093596b4587f0d (diff)
downloadMana-2d5d31406ab057abd9417d13ab808f6823b2860b.tar.gz
Mana-2d5d31406ab057abd9417d13ab808f6823b2860b.tar.bz2
Mana-2d5d31406ab057abd9417d13ab808f6823b2860b.tar.xz
Mana-2d5d31406ab057abd9417d13ab808f6823b2860b.zip
Add WhisperTabs
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 8961b704..174285c9 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -29,6 +29,7 @@
#include "sdlinput.h"
#include "widgets/tabbedarea.h"
+#include "widgets/whispertab.h"
#include "../beingmanager.h"
#include "../configuration.h"
@@ -96,6 +97,7 @@ ChatWindow::~ChatWindow()
delete mRecorder;
#endif
delete_all(mTabs);
+ delete_all(mWhispers);
delete mItemLinkHandler;
}
@@ -137,6 +139,12 @@ void ChatWindow::widgetResized(const gcn::Event &event)
void ChatWindow::logic()
{
Window::logic();
+
+ Tab *tab = getFocused();
+ if (tab != currentTab) {
+ currentTab == tab;
+ adjustTabSize();
+ }
}
void ChatWindow::chatLog(std::string line, int own, std::string channelName,
@@ -394,3 +402,33 @@ void ChatWindow::setRecordingFile(const std::string &msg)
{
mRecorder->setRecordingFile(msg);
}
+
+void ChatWindow::whisper(std::string nick, std::string mes, bool own)
+{
+ if (mes.length() == 0) return;
+ std::string playerName = player_node->getName();
+ std::string tempNick = nick;
+
+ toLower(playerName);
+ toLower(tempNick);
+
+ if (tempNick.compare(playerName) == 0)
+ if (own)
+ ;
+ else
+ return;
+
+ ChatTab *tab = mWhispers[tempNick];
+
+ if (!tab)
+ {
+ tab = new WhisperTab(tempNick);
+ mWhispers[tempNick] = tab;
+ mChatTabs->addTab(tab, tab->mScrollArea);
+ }
+
+ if (own)
+ tab->chatSend(mes);
+ else
+ tab->chatLog(nick, mes);
+}