summaryrefslogtreecommitdiffstats
path: root/src/server/rooms.hpp
blob: 08fffff2cc251d96c0f0e7bb01322194fbbf8035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef ROOMREALIZATION_H
#define ROOMREALIZATION_H

class Server;
class ChatSession;

class ChatRoom {
    Server *the_server;
    const bool it_lobby;

    struct item {
        ChatSession *s;
        item *next;
    };
    item *first;
public:
    ChatRoom(Server *i_server, bool i_lobby)
        : the_server(i_server), it_lobby(i_lobby), first(0) {}
    ~ChatRoom();

    void SendAll(const char *msg, ChatSession *except = 0);
    void LeaveMessage(ChatSession *except);

    void HandleMessage(ChatSession *ses, const char *str);
    void HandleCommand(ChatSession *s, int cmd_counter,
        char **commands);

    void AddSession(ChatSession *ses);
    void RemoveSession(ChatSession *ses);
    void CloseSession(ChatSession *ses);
};

#endif