summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commandhandler.cpp4
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/ea/chathandler.cpp5
-rw-r--r--src/net/ea/chathandler.h2
-rw-r--r--src/net/ea/maphandler.cpp2
-rw-r--r--src/net/tmwserv/chathandler.cpp27
-rw-r--r--src/net/tmwserv/chathandler.h27
-rw-r--r--src/net/tmwserv/protocol.h5
8 files changed, 61 insertions, 13 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 48da510f..f969cb43 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -47,7 +47,7 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
std::string::size_type pos = command.find(' ');
std::string type(command, 0, pos);
std::string args(command, pos == std::string::npos ? command.size() : pos + 1);
-
+
if (type == "help") // Do help before tabs so they can't override it
{
handleHelp(args, tab);
@@ -283,7 +283,7 @@ void CommandHandler::handleWhere(const std::string &args, ChatTab *tab)
void CommandHandler::handleWho(const std::string &args, ChatTab *tab)
{
- Net::getMapHandler()->who();
+ Net::getChatHandler()->who();
}
void CommandHandler::handleMsg(const std::string &args, ChatTab *tab)
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 20feee58..d7e36c8a 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -51,6 +51,8 @@ class ChatHandler
virtual void setUserMode(int channelId, const std::string &name, int mode) = 0;
virtual void kickUser(int channelId, const std::string &name) = 0;
+
+ virtual void who() = 0;
};
}
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 2e8df374..2446e26e 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -239,4 +239,9 @@ void ChatHandler::kickUser(int channelId, const std::string &name)
localChatTab->chatLog(_("Channels are not supported!"), BY_SERVER);
}
+void ChatHandler::who()
+{
+ MessageOut outMsg(CMSG_WHO_REQUEST);
+}
+
} // namespace EAthena
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index a907535e..f77b7b80 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -58,6 +58,8 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
void setUserMode(int channelId, const std::string &name, int mode);
void kickUser(int channelId, const std::string &name);
+
+ void who();
};
} // namespace EAthena
diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp
index 79e41914..76b3c480 100644
--- a/src/net/ea/maphandler.cpp
+++ b/src/net/ea/maphandler.cpp
@@ -100,7 +100,7 @@ void MapHandler::mapLoaded(const std::string &mapName)
void MapHandler::who()
{
- MessageOut outMsg(CMSG_WHO_REQUEST);
+
}
void MapHandler::quit()
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp
index e3421e93..41dc7bee 100644
--- a/src/net/tmwserv/chathandler.cpp
+++ b/src/net/tmwserv/chathandler.cpp
@@ -66,6 +66,7 @@ ChatHandler::ChatHandler()
CPMSG_QUIT_CHANNEL_RESPONSE,
CPMSG_LIST_CHANNELUSERS_RESPONSE,
CPMSG_CHANNEL_EVENT,
+ CPMSG_WHO_RESPONSE,
0
};
handledMessages = _messages;
@@ -110,6 +111,11 @@ void ChatHandler::handleMessage(MessageIn &msg)
case CPMSG_CHANNEL_EVENT:
handleChannelEvent(msg);
+ break;
+
+ case CPMSG_WHO_RESPONSE:
+ handleWhoResponse(msg);
+ break;
}
}
@@ -296,6 +302,21 @@ void ChatHandler::handleChannelEvent(MessageIn &msg)
}
}
+void ChatHandler::handleWhoResponse(MessageIn &msg)
+{
+ std::string userNick;
+
+ while(msg.getUnreadLength())
+ {
+ userNick = msg.readString();
+ if (userNick == "")
+ {
+ break;
+ }
+ localChatTab->chatLog(userNick, BY_SERVER);
+ }
+}
+
void ChatHandler::talk(const std::string &text)
{
MessageOut msg(PGMSG_SAY);
@@ -379,4 +400,10 @@ void ChatHandler::kickUser(int channelId, const std::string &name)
Net::ChatServer::connection->send(msg);
}
+void ChatHandler::who()
+{
+ MessageOut msg(PCMSG_WHO);
+ Net::ChatServer::connection->send(msg);
+}
+
} // namespace TmwServ
diff --git a/src/net/tmwserv/chathandler.h b/src/net/tmwserv/chathandler.h
index 05f5243d..bc30de7c 100644
--- a/src/net/tmwserv/chathandler.h
+++ b/src/net/tmwserv/chathandler.h
@@ -31,7 +31,7 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
{
public:
ChatHandler();
-
+
/**
* Handle the given message appropriately.
*/
@@ -60,52 +60,59 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler
void setUserMode(int channelId, const std::string &name, int mode);
void kickUser(int channelId, const std::string &name);
-
+
+ void who();
+
private:
/**
* Handle chat messages sent from the game server.
*/
void handleGameChatMessage(MessageIn &msg);
-
+
/**
* Handle channel entry responses.
*/
void handleEnterChannelResponse(MessageIn &msg);
-
+
/**
* Handle list channels responses.
*/
void handleListChannelsResponse(MessageIn &msg);
-
+
/**
* Handle private messages.
*/
void handlePrivateMessage(MessageIn &msg);
-
+
/**
* Handle announcements.
*/
void handleAnnouncement(MessageIn &msg);
-
+
/**
* Handle chat messages.
*/
void handleChatMessage(MessageIn &msg);
-
+
/**
* Handle quit channel responses.
*/
void handleQuitChannelResponse(MessageIn &msg);
-
+
/**
* Handle list channel users responses.
*/
void handleListChannelUsersResponse(MessageIn &msg);
-
+
/**
* Handle channel events.
*/
void handleChannelEvent(MessageIn &msg);
+
+ /**
+ * Handle who responses.
+ */
+ void handleWhoResponse(MessageIn &msg);
};
} // namespace TmwServ
diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h
index 57926611..fc52bd57 100644
--- a/src/net/tmwserv/protocol.h
+++ b/src/net/tmwserv/protocol.h
@@ -167,6 +167,8 @@ enum {
CPMSG_PARTY_INVITED = 0x03A2, // S name
PCMSG_PARTY_ACCEPT_INVITE = 0x03A5, // S name
CPMSG_PARTY_ACCEPT_INVITE_RESPONSE = 0x03A6, // B error, { S name }
+ PCMSG_PARTY_REJECT_INVITE = 0x03A7, // S name
+ CPMSG_PARTY_REJECTED = 0x03A8, // S name
PCMSG_PARTY_QUIT = 0x03AA, // -
CPMSG_PARTY_QUIT_RESPONSE = 0x03AB, // B error
CPMSG_PARTY_NEW_MEMBER = 0x03B0, // W being id, S name
@@ -180,6 +182,9 @@ enum {
PCMSG_CHAT = 0x0410, // S text, W channel
PCMSG_ANNOUNCE = 0x0411, // S text
PCMSG_PRIVMSG = 0x0412, // S user, S text
+ PCMSG_WHO = 0x0415, // -
+ CPMSG_WHO_RESPONSE = 0x0416, // { S user }
+
// -- Channeling
CPMSG_CHANNEL_EVENT = 0x0430, // W channel, B event, S info
PCMSG_ENTER_CHANNEL = 0x0440, // S channel, S password