[project @ 2002-07-07 02:33:51 by unknown_lamer]
[clinton/bobotpp.git] / source / ServerQueue.H
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
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18
19 #ifndef SERVERQUEUE_H
20 #define SERVERQUEUE_H
21
22 #include <list>
23
24 #include "String.H"
25 #include "Queue.H"
26 #include "ServerQueueItem.H"
27
28 enum {
29 QUIT_PRIORITY, USERMODE_PRIORITY, CHANNELMODE_PRIORITY,
30 KICK_PRIORITY, PONG_PRIORITY, TOPIC_PRIORITY, PART_PRIORITY,
31 NICK_PRIORITY, USERHOST_PRIORITY, WHO_PRIORITY,
32 JOIN_PRIORITY, PING_PRIORITY, INVITE_PRIORITY, PRIVMSG_PRIORITY,
33 NOTICE_PRIORITY
34 };
35
36 static const int QUIT_PENALTY = 1;
37 static const int USERMODE_PENALTY = 2;
38 static const int CHANNELMODE_PENALTY = 2;
39 static const int KICK_PENALTY = 2;
40 static const int PONG_PENALTY = 1;
41 static const int TOPIC_PENALTY = 2;
42 static const int PART_PENALTY = 1;
43 static const int JOIN_PENALTY = 1;
44 static const int USERHOST_PENALTY = 1;
45 static const int WHO_PENALTY = 4;
46 static const int WHOIS_PENALTY = 1;
47 static const int NICK_PENALTY = 1;
48 static const int PING_PENALTY = 1;
49 static const int INVITE_PENALTY = 1;
50 static const int PRIVMSG_PENALTY = 1;
51 static const int NOTICE_PENALTY = 1;
52
53
54 class ServerQueue : public Queue {
55
56 std::list<ServerQueueItem *> serverQueue;
57 int penalty;
58
59 public:
60 ServerQueue(Socket *, bool);
61 ~ServerQueue();
62 void addItem(ServerQueueItem *);
63 void addLine(String, int, int, int);
64 bool flush();
65
66 void sendCTCP(String, String, String);
67 void sendCTCPReply(String, String, String);
68 void sendChannelMode(String);
69 void sendChannelMode(String, String, String);
70 void sendInvite(String, String);
71 void sendJoin(String, String);
72 void sendKick(String, String, String);
73 void sendNick(String);
74 void sendNotice(String, String);
75 void sendPart(String);
76 void sendPass(String);
77 void sendPing(String);
78 void sendPong(String);
79 void sendPrivmsg(String, String);
80 void sendQuit(String);
81 void sendTopic(String, String);
82 void sendUser(String, String);
83 void sendUserMode(String, String);
84 void sendUserhost(String);
85 void sendWho(String);
86 void sendWhois(String);
87 };
88
89 #endif