cb21075d |
1 | // ServerQueue.H -*- C++ -*- |
2 | // Copyright (c) 1997, 1998 Etienne BERNARD |
3 | // Copyright (c) 2002 Clinton Ebadi |
4 | |
5 | // This program is free software; you can redistribute it and/or modify |
6 | // it under the terms of the GNU General Public License as published by |
7 | // the Free Software Foundation; either version 2 of the License, or |
8 | // any later version. |
9 | |
10 | // This program is distributed in the hope that it will be useful, |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // GNU General Public License for more details. |
14 | |
15 | // You should have received a copy of the GNU General Public License |
16 | // along with this program; if not, write to the Free Software |
133eff7a |
17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | // 02110-1301, USA. |
cb21075d |
19 | |
20 | #ifndef SERVERQUEUE_H |
21 | #define SERVERQUEUE_H |
22 | |
23 | #include <list> |
24 | |
cd5342f5 |
25 | #include "BotThreading.H" |
cb21075d |
26 | #include "String.H" |
27 | #include "Queue.H" |
28 | #include "ServerQueueItem.H" |
29 | |
30 | enum { |
31 | QUIT_PRIORITY, USERMODE_PRIORITY, CHANNELMODE_PRIORITY, |
32 | KICK_PRIORITY, PONG_PRIORITY, TOPIC_PRIORITY, PART_PRIORITY, |
33 | NICK_PRIORITY, USERHOST_PRIORITY, WHO_PRIORITY, |
34 | JOIN_PRIORITY, PING_PRIORITY, INVITE_PRIORITY, PRIVMSG_PRIORITY, |
35 | NOTICE_PRIORITY |
36 | }; |
37 | |
38 | static const int QUIT_PENALTY = 1; |
39 | static const int USERMODE_PENALTY = 2; |
40 | static const int CHANNELMODE_PENALTY = 2; |
41 | static const int KICK_PENALTY = 2; |
42 | static const int PONG_PENALTY = 1; |
43 | static const int TOPIC_PENALTY = 2; |
44 | static const int PART_PENALTY = 1; |
45 | static const int JOIN_PENALTY = 1; |
46 | static const int USERHOST_PENALTY = 1; |
47 | static const int WHO_PENALTY = 4; |
48 | static const int WHOIS_PENALTY = 1; |
49 | static const int NICK_PENALTY = 1; |
50 | static const int PING_PENALTY = 1; |
51 | static const int INVITE_PENALTY = 1; |
52 | static const int PRIVMSG_PENALTY = 1; |
53 | static const int NOTICE_PENALTY = 1; |
54 | |
55 | |
56 | class ServerQueue : public Queue { |
57 | |
58 | std::list<ServerQueueItem *> serverQueue; |
59 | int penalty; |
cd5342f5 |
60 | BotMutex queue_mutex; |
cb21075d |
61 | |
0b062618 |
62 | static int max_penalty; |
63 | |
cb21075d |
64 | public: |
65 | ServerQueue(Socket *, bool); |
66 | ~ServerQueue(); |
67 | void addItem(ServerQueueItem *); |
68 | void addLine(String, int, int, int); |
69 | bool flush(); |
70 | |
71 | void sendCTCP(String, String, String); |
72 | void sendCTCPReply(String, String, String); |
73 | void sendChannelMode(String); |
74 | void sendChannelMode(String, String, String); |
75 | void sendInvite(String, String); |
76 | void sendJoin(String, String); |
77 | void sendKick(String, String, String); |
78 | void sendNick(String); |
79 | void sendNotice(String, String); |
80 | void sendPart(String); |
81 | void sendPass(String); |
82 | void sendPing(String); |
83 | void sendPong(String); |
84 | void sendPrivmsg(String, String); |
85 | void sendQuit(String); |
86 | void sendTopic(String, String); |
87 | void sendUser(String, String); |
88 | void sendUserMode(String, String); |
89 | void sendUserhost(String); |
90 | void sendWho(String); |
91 | void sendWhois(String); |
92 | }; |
93 | |
94 | #endif |