Make rate limiting penalties less severe
[clinton/bobotpp.git] / source / ServerQueue.H
CommitLineData
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
30enum {
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
38static const int QUIT_PENALTY = 1;
39static const int USERMODE_PENALTY = 2;
40static const int CHANNELMODE_PENALTY = 2;
41static const int KICK_PENALTY = 2;
42static const int PONG_PENALTY = 1;
43static const int TOPIC_PENALTY = 2;
44static const int PART_PENALTY = 1;
45static const int JOIN_PENALTY = 1;
46static const int USERHOST_PENALTY = 1;
47static const int WHO_PENALTY = 4;
48static const int WHOIS_PENALTY = 1;
49static const int NICK_PENALTY = 1;
50static const int PING_PENALTY = 1;
51static const int INVITE_PENALTY = 1;
52static const int PRIVMSG_PENALTY = 1;
53static const int NOTICE_PENALTY = 1;
54
55
56class 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 64public:
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