Mana
Loading...
Searching...
No Matches
chathandler.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "net/chathandler.h"
25
27
28namespace ManaServ {
29
30class ChatHandler final : public MessageHandler, public Net::ChatHandler
31{
32 public:
34
38 void handleMessage(MessageIn &msg) override;
39
40 void connect();
41
42 bool isConnected();
43
44 void disconnect();
45
46 void talk(const std::string &text) override;
47
48 void me(const std::string &text) override;
49
50 void privateMessage(const std::string &recipient,
51 const std::string &text) override;
52
53 void channelList() override;
54
55 void enterChannel(const std::string &channel,
56 const std::string &password) override;
57
58 void quitChannel(int channelId) override;
59
60 void sendToChannel(int channelId, const std::string &text) override;
61
62 void userList(const std::string &channel) override;
63
64 void setChannelTopic(int channelId, const std::string &text) override;
65
66 void setUserMode(int channelId, const std::string &name, int mode) override;
67
68 void kickUser(int channelId, const std::string &name) override;
69
70 void who() override;
71
72 bool whoSupported() const override { return true; }
73
74 void requestOnlineList() override {}
75
76 private:
81
86
91
96
100 void handleAnnouncement(MessageIn &msg);
101
105 void handleChatMessage(MessageIn &msg);
106
111
116
120 void handleChannelEvent(MessageIn &msg);
121
125 void handleWhoResponse(MessageIn &msg);
126};
127
128} // namespace ManaServ
void handleWhoResponse(MessageIn &msg)
Handle who responses.
void handleListChannelsResponse(MessageIn &msg)
Handle list channels responses.
void userList(const std::string &channel) override
bool whoSupported() const override
Definition chathandler.h:72
void handlePrivateMessage(MessageIn &msg)
Handle private messages.
void enterChannel(const std::string &channel, const std::string &password) override
void handleAnnouncement(MessageIn &msg)
Handle announcements.
void me(const std::string &text) override
void handleQuitChannelResponse(MessageIn &msg)
Handle quit channel responses.
void requestOnlineList() override
Definition chathandler.h:74
void handleListChannelUsersResponse(MessageIn &msg)
Handle list channel users responses.
void privateMessage(const std::string &recipient, const std::string &text) override
void sendToChannel(int channelId, const std::string &text) override
void handleMessage(MessageIn &msg) override
Handle the given message appropriately.
void who() override
void kickUser(int channelId, const std::string &name) override
void handleEnterChannelResponse(MessageIn &msg)
Handle channel entry responses.
void channelList() override
void setChannelTopic(int channelId, const std::string &text) override
void setUserMode(int channelId, const std::string &name, int mode) override
void handleChannelEvent(MessageIn &msg)
Handle channel events.
void quitChannel(int channelId) override
void handleGameChatMessage(MessageIn &msg)
Handle chat messages sent from the game server.
void talk(const std::string &text) override
void handleChatMessage(MessageIn &msg)
Handle chat messages.
Used for parsing an incoming message from manaserv.
Definition messagein.h:37