summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/chatconsts.h2
-rw-r--r--src/gui/widgets/tabs/chat/tradetab.cpp7
-rw-r--r--src/gui/windows/shopwindow.cpp4
-rw-r--r--src/net/eathena/chathandler.cpp5
-rw-r--r--src/net/tmwa/chathandler.cpp8
5 files changed, 18 insertions, 8 deletions
diff --git a/src/gui/chatconsts.h b/src/gui/chatconsts.h
index b5e9d748c..daa7a3be8 100644
--- a/src/gui/chatconsts.h
+++ b/src/gui/chatconsts.h
@@ -26,6 +26,6 @@
#include <string>
const std::string GENERAL_CHANNEL = "";
-const std::string TRADE_CHANNEL = "";
+const std::string TRADE_CHANNEL = "#trade";
#endif // GUI_CHATCONSTS_H
diff --git a/src/gui/widgets/tabs/chat/tradetab.cpp b/src/gui/widgets/tabs/chat/tradetab.cpp
index 8512d3f6a..414c97d9d 100644
--- a/src/gui/widgets/tabs/chat/tradetab.cpp
+++ b/src/gui/widgets/tabs/chat/tradetab.cpp
@@ -24,6 +24,10 @@
#include "gui/chatconsts.h"
+#include "gui/windows/chatwindow.h"
+
+#include "net/chathandler.h"
+
#include "utils/gettext.h"
#include "debug.h"
@@ -42,6 +46,5 @@ TradeTab::~TradeTab()
void TradeTab::handleInput(const std::string &msg)
{
- std::string str("\302\202" + msg);
- ChatTab::handleInput(str);
+ chatHandler->channelMessage(mChannelName, ChatWindow::doReplace(msg));
}
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 4d8e4f000..2ba34e861 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -481,7 +481,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
if (!list)
return;
- std::string data("\302\202");
+ std::string data;
if (mode == BUY)
data.append("Buy ");
else
@@ -534,7 +534,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
}
}
- chatHandler->talk(data, GENERAL_CHANNEL);
+ chatHandler->channelMessage(TRADE_CHANNEL, data);
}
void ShopWindow::giveList(const std::string &nick, const int mode)
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 3def53afd..456bda0e5 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -194,7 +194,10 @@ void ChatHandler::privateMessage(const std::string &restrict recipient,
void ChatHandler::channelMessage(const std::string &restrict channel,
const std::string &restrict text)
{
- privateMessage(channel, text);
+ if (channel == TRADE_CHANNEL)
+ talk("\302\202" + text, GENERAL_CHANNEL);
+ else
+ privateMessage(channel, text);
}
void ChatHandler::who() const
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index dafa31cf5..a48aa5426 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -26,6 +26,8 @@
#include "being/localplayer.h"
+#include "gui/chatconsts.h"
+
#include "gui/widgets/tabs/chat/chattab.h"
#include "gui/windows/chatwindow.h"
@@ -163,9 +165,11 @@ void ChatHandler::privateMessage(const std::string &restrict recipient,
mSentWhispers.push(recipient);
}
-void ChatHandler::channelMessage(const std::string &restrict channel A_UNUSED,
- const std::string &restrict text A_UNUSED)
+void ChatHandler::channelMessage(const std::string &restrict channel,
+ const std::string &restrict text)
{
+ if (channel == TRADE_CHANNEL)
+ talk("\302\202" + text, GENERAL_CHANNEL);
}
void ChatHandler::who() const