summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-20 12:33:04 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-21 21:09:08 +0300
commit54ee7d240a8ab3a328d0f3f06f3b9627d4727c90 (patch)
treea50136462b44739cecf17c438ed65640d031dbcd
parentc483cf600e74e7d38a7c0cc7d80435e97040c76c (diff)
downloadmanaverse-54ee7d240a8ab3a328d0f3f06f3b9627d4727c90.tar.gz
manaverse-54ee7d240a8ab3a328d0f3f06f3b9627d4727c90.tar.bz2
manaverse-54ee7d240a8ab3a328d0f3f06f3b9627d4727c90.tar.xz
manaverse-54ee7d240a8ab3a328d0f3f06f3b9627d4727c90.zip
Send channel name to net code layer.
-rw-r--r--src/commands.cpp4
-rw-r--r--src/gui/shopwindow.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp9
-rw-r--r--src/net/chathandler.h3
-rw-r--r--src/net/ea/adminhandler.cpp10
-rw-r--r--src/net/ea/chathandler.cpp3
-rw-r--r--src/net/ea/chathandler.h3
-rw-r--r--src/net/eathena/chathandler.cpp3
-rw-r--r--src/net/eathena/chathandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.h2
11 files changed, 26 insertions, 17 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 64bb6ba3b..80e276d8b 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -182,7 +182,7 @@ static void outStringNormal(ChatTab *const tab,
if (!tab)
{
- Net::getChatHandler()->talk(str);
+ Net::getChatHandler()->talk(str, GENERAL_CHANNEL);
return;
}
@@ -214,7 +214,7 @@ static void outStringNormal(ChatTab *const tab,
break;
}
default:
- Net::getChatHandler()->talk(def);
+ Net::getChatHandler()->talk(def, GENERAL_CHANNEL);
break;
}
}
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index d42583f62..ffe347099 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -491,7 +491,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
}
}
- Net::getChatHandler()->talk(data);
+ Net::getChatHandler()->talk(data, GENERAL_CHANNEL);
}
void ShopWindow::giveList(const std::string &nick, const int mode)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 2b360789a..f219bb661 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -412,9 +412,14 @@ void ChatTab::clearText()
void ChatTab::handleInput(const std::string &msg)
{
if (chatWindow)
- Net::getChatHandler()->talk(chatWindow->doReplace(msg));
+ {
+ Net::getChatHandler()->talk(chatWindow->doReplace(msg),
+ mChannelName);
+ }
else
- Net::getChatHandler()->talk(msg);
+ {
+ Net::getChatHandler()->talk(msg, mChannelName);
+ }
}
void ChatTab::handleCommand(const std::string &msg)
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index bd2dc59aa..c21a30f74 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -34,7 +34,8 @@ class ChatHandler
virtual ~ChatHandler()
{ }
- virtual void talk(const std::string &text) = 0;
+ virtual void talk(const std::string &text,
+ const std::string &channel) = 0;
virtual void talkRaw(const std::string &text) = 0;
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 542937008..f6450a225 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -31,9 +31,11 @@
namespace Ea
{
+const std::string GENERAL_CHANNEL = "\000\000\000";
+
void AdminHandler::kickName(const std::string &name)
{
- Net::getChatHandler()->talk("@kick " + name);
+ Net::getChatHandler()->talk("@kick " + name, GENERAL_CHANNEL);
}
void AdminHandler::ban(int playerId A_UNUSED)
@@ -43,7 +45,7 @@ void AdminHandler::ban(int playerId A_UNUSED)
void AdminHandler::banName(const std::string &name)
{
- Net::getChatHandler()->talk("@ban " + name);
+ Net::getChatHandler()->talk("@ban " + name, GENERAL_CHANNEL);
}
void AdminHandler::unban(int playerId A_UNUSED)
@@ -53,7 +55,7 @@ void AdminHandler::unban(int playerId A_UNUSED)
void AdminHandler::unbanName(const std::string &name)
{
- Net::getChatHandler()->talk("@unban " + name);
+ Net::getChatHandler()->talk("@unban " + name, GENERAL_CHANNEL);
}
void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED,
@@ -65,7 +67,7 @@ void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED,
void AdminHandler::warp(std::string map, int x, int y)
{
Net::getChatHandler()->talk(strprintf(
- "@warp %s %d %d", map.c_str(), x, y));
+ "@warp %s %d %d", map.c_str(), x, y), GENERAL_CHANNEL);
}
} // namespace Ea
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index c6e490b00..7be94ca3e 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -49,8 +49,7 @@ ChatHandler::ChatHandler()
void ChatHandler::me(const std::string &text)
{
std::string action = strprintf("*%s*", text.c_str());
-
- talk(action);
+ talk(action, GENERAL_CHANNEL);
}
void ChatHandler::channelList()
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index ca753169f..301289084 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -40,7 +40,8 @@ class ChatHandler : public Net::ChatHandler
A_DELETE_COPY(ChatHandler)
- virtual void talk(const std::string &text) = 0;
+ virtual void talk(const std::string &text,
+ const std::string &channel) = 0;
virtual void talkRaw(const std::string &text) = 0;
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 5c4d84753..d6ed2c9be 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -101,7 +101,8 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
}
}
-void ChatHandler::talk(const std::string &text)
+void ChatHandler::talk(const std::string &text,
+ const std::string &channel A_UNUSED)
{
if (!player_node)
return;
diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h
index 022924167..8a278bc29 100644
--- a/src/net/eathena/chathandler.h
+++ b/src/net/eathena/chathandler.h
@@ -42,7 +42,7 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
void handleMessage(Net::MessageIn &msg);
- void talk(const std::string &text);
+ void talk(const std::string &text, const std::string &channel);
void talkRaw(const std::string &text);
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index a6fb2a95b..753272e4f 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -103,7 +103,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
BLOCK_END("ChatHandler::handleMessage")
}
-void ChatHandler::talk(const std::string &text)
+void ChatHandler::talk(const std::string &text, const std::string &channel)
{
if (!player_node)
return;
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 5d250af8e..0359e9f13 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -42,7 +42,7 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
void handleMessage(Net::MessageIn &msg);
- void talk(const std::string &text);
+ void talk(const std::string &text, const std::string &channel);
void talkRaw(const std::string &text);