summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-27 21:45:16 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-27 21:45:16 +0300
commit0fe0f8bae7b754453e6e6bb7c7b29903facb9311 (patch)
treed92c810fbc93fe8bb2f362a7ef023ebe96653c2d /src/net/ea
parent8150191686759b13a239c25970924c3c186140ff (diff)
downloadmv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.gz
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.bz2
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.tar.xz
mv-0fe0f8bae7b754453e6e6bb7c7b29903facb9311.zip
improve chathandler class.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/chathandler.cpp54
-rw-r--r--src/net/ea/chathandler.h39
2 files changed, 14 insertions, 79 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 36c79af77..6eb913d50 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -47,48 +47,11 @@ ChatHandler::ChatHandler() :
{
}
-void ChatHandler::me(const std::string &text)
+void ChatHandler::me(const std::string &text, const std::string &channel) const
{
+ // here need string duplication
std::string action = strprintf("*%s*", text.c_str());
- talk(action, GENERAL_CHANNEL);
-}
-
-void ChatHandler::channelList()
-{
-}
-
-void ChatHandler::enterChannel(const std::string &channel A_UNUSED,
- const std::string &password A_UNUSED)
-{
-}
-
-void ChatHandler::quitChannel(int channelId A_UNUSED)
-{
-}
-
-void ChatHandler::sendToChannel(int channelId A_UNUSED,
- const std::string &text A_UNUSED)
-{
-}
-
-void ChatHandler::userList(const std::string &channel A_UNUSED)
-{
-}
-
-void ChatHandler::setChannelTopic(int channelId A_UNUSED,
- const std::string &text A_UNUSED)
-{
-}
-
-void ChatHandler::setUserMode(int channelId A_UNUSED,
- const std::string &name A_UNUSED,
- int mode A_UNUSED)
-{
-}
-
-void ChatHandler::kickUser(int channelId A_UNUSED,
- const std::string &name A_UNUSED)
-{
+ talk(action, channel);
}
void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
@@ -259,7 +222,8 @@ void ChatHandler::processWhisper(Net::MessageIn &msg)
}
}
-void ChatHandler::processBeingChat(Net::MessageIn &msg, const bool channels)
+void ChatHandler::processBeingChat(Net::MessageIn &msg,
+ const bool channels) const
{
if (!actorSpriteManager)
return;
@@ -319,8 +283,8 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg, const bool channels)
}
}
-void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat,
- bool channels)
+void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
+ const bool channels) const
{
int chatMsgLength = msg.readInt16() - 4;
std::string channel;
@@ -369,7 +333,7 @@ void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat,
}
}
-void ChatHandler::processMVP(Net::MessageIn &msg)
+void ChatHandler::processMVP(Net::MessageIn &msg) const
{
// Display MVP player
const int id = msg.readInt32(); // id
@@ -383,7 +347,7 @@ void ChatHandler::processMVP(Net::MessageIn &msg)
}
}
-void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg)
+void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
{
const int action = msg.readInt8();
const int fail = msg.readInt8();
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index d46b10057..416589e86 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -40,50 +40,21 @@ class ChatHandler : public Net::ChatHandler
A_DELETE_COPY(ChatHandler)
- virtual void talk(const std::string &text,
- const std::string &channel) = 0;
-
- virtual void talkRaw(const std::string &text) = 0;
-
- void me(const std::string &text);
-
- virtual void privateMessage(const std::string &recipient,
- const std::string &text) = 0;
-
- void channelList();
-
- void enterChannel(const std::string &channel,
- const std::string &password);
-
- void quitChannel(int channelId);
-
- void sendToChannel(int channelId, const std::string &text);
-
- void userList(const std::string &channel);
-
- void setChannelTopic(int channelId, const std::string &text);
-
- void setUserMode(int channelId, const std::string &name, int mode);
-
- void kickUser(int channelId, const std::string &name);
-
- virtual void who() = 0;
-
- virtual void sendRaw(const std::string &args) = 0;
+ void me(const std::string &text, const std::string &channel) const;
virtual void processWhisperResponse(Net::MessageIn &msg);
virtual void processWhisper(Net::MessageIn &msg);
virtual void processBeingChat(Net::MessageIn &msg,
- const bool channels);
+ const bool channels) const;
virtual void processChat(Net::MessageIn &msg, bool normalChat,
- bool channels);
+ const bool channels) const;
- virtual void processMVP(Net::MessageIn &msg);
+ virtual void processMVP(Net::MessageIn &msg) const;
- virtual void processIgnoreAllResponse(Net::MessageIn &msg);
+ virtual void processIgnoreAllResponse(Net::MessageIn &msg) const;
protected:
typedef std::queue<std::string> WhisperQueue;