diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-27 13:12:24 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-27 13:13:03 -0600 |
commit | 74f23fd3d0e1fb3be8e5419193d57d91746c887a (patch) | |
tree | 2715ae060ccd76f1b472dee3b9086e169d0e6926 /src/gui/widgets/chattab.cpp | |
parent | 795cec6e276e7f5df8a25bd8306e6fd87c826502 (diff) | |
download | mana-74f23fd3d0e1fb3be8e5419193d57d91746c887a.tar.gz mana-74f23fd3d0e1fb3be8e5419193d57d91746c887a.tar.bz2 mana-74f23fd3d0e1fb3be8e5419193d57d91746c887a.tar.xz mana-74f23fd3d0e1fb3be8e5419193d57d91746c887a.zip |
Clean up chat and chat tabs some more
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r-- | src/gui/widgets/chattab.cpp | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 0594761d..715aaf20 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -19,34 +19,31 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <guichan/widgets/label.hpp> - #include "chattab.h" -#include "layouthelper.h" -#include "../browserbox.h" -#include "../chatinput.h" -#include "../itemlinkhandler.h" -#include "../recorder.h" -#include "../scrollarea.h" +#include "commandhandler.h" +#include "configuration.h" +#include "localplayer.h" -#include "../../commandhandler.h" -#include "../../configuration.h" -#include "../../localplayer.h" +#include "gui/browserbox.h" +#include "gui/itemlinkhandler.h" +#include "gui/recorder.h" +#include "gui/scrollarea.h" #ifdef TMWSERV_SUPPORT -#include "../../net/tmwserv/chatserver/chatserver.h" -#include "../../net/tmwserv/gameserver/player.h" +#include "net/tmwserv/chatserver/chatserver.h" +#include "net/tmwserv/gameserver/player.h" #else -#include "../../net/messageout.h" -#include "../../net/ea/protocol.h" +#include "net/messageout.h" +#include "net/ea/protocol.h" #endif -#include "../../resources/iteminfo.h" -#include "../../resources/itemdb.h" +#include "resources/iteminfo.h" +#include "resources/itemdb.h" -#include "../../utils/strprintf.h" -#include "../../utils/stringutils.h" +#include "utils/gettext.h" +#include "utils/strprintf.h" +#include "utils/stringutils.h" ChatTab::ChatTab(const std::string &name) : Tab() { @@ -160,10 +157,9 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) break; #endif case ACT_WHISPER: - tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str()); - tmp.nick += " "; - lineColor = "##W"; - break; + // Resend whisper through normal mechanism + chatWindow->whisper(tmp.nick, tmp.text); + return; case ACT_IS: tmp.nick += CAT_IS; lineColor = "##I"; @@ -221,10 +217,11 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) void ChatTab::chatLog(std::string &nick, std::string &msg) { - chatLog(nick + ": " + msg, nick == player_node->getName() ? BY_PLAYER : BY_OTHER, false); + chatLog(nick + CAT_NORMAL + msg, nick == player_node->getName() ? + BY_PLAYER : BY_OTHER, false); } -void ChatTab::chatSend(std::string &msg) +void ChatTab::chatInput(std::string &msg) { trim(msg); @@ -282,16 +279,11 @@ void ChatTab::chatSend(std::string &msg) start = msg.find('[', start + 1); } - // Prepare ordinary message if (msg[0] != '/') - { - sendChat(msg); - } + handleInput(msg); else - { handleCommand(std::string(msg, 1)); - } } void ChatTab::scroll(int amount) @@ -308,22 +300,22 @@ void ChatTab::clearText() mTextOutput->clearRows(); } -void ChatTab::sendChat(std::string &msg) { +void ChatTab::handleInput(const std::string &msg) { #ifdef TMWSERV_SUPPORT Net::GameServer::Player::say(msg); #else - msg = player_node->getName() + " : " + msg; + std::string mes = player_node->getName() + " : " + msg; MessageOut outMsg(chatWindow->mNetwork); outMsg.writeInt16(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly - outMsg.writeInt16(msg.length() + 4 + 1); - outMsg.writeString(msg, msg.length() + 1); + outMsg.writeInt16(mes.length() + 4 + 1); + outMsg.writeString(mes, mes.length() + 1); return; #endif } -void ChatTab::handleCommand(const std::string msg) +void ChatTab::handleCommand(std::string msg) { commandHandler->handleCommand(msg); } |