Fix crash when providing bad command line argument
[clinton/bobotpp.git] / source / ServerQueueItem.H
1 // ServerQueueItem.H -*- C++ -*-
2 // Copyright (c) 1998 Etienne BERNARD
3
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // any later version.
8
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18
19 #ifndef SERVERQUEUEITEM_H
20 #define SERVERQUEUEITEM_H
21
22 #include "String.H"
23
24 class ServerQueueItem {
25 public:
26 int priority, penalty, type;
27
28 enum {
29 CHANNELMODE, USERMODE, INVITE, JOIN, KICK,
30 NICK, NOTICE, PART, PASS, PING, PONG, PRIVMSG,
31 QUIT, TOPIC, USER, USERHOST, WHO, WHOIS, OTHER
32 };
33
34 ServerQueueItem(int, int, int);
35 virtual ~ServerQueueItem() { }
36
37 virtual bool merge(ServerQueueItem *) { return false; }
38 virtual String getLine() = 0;
39
40 bool operator< (const ServerQueueItem & item);
41
42 friend class ServerQueue;
43
44 private:
45 ServerQueueItem(const ServerQueueItem &);
46 };
47
48
49 class ServerQueueOtherItem : public ServerQueueItem {
50 public:
51 String line;
52
53 ServerQueueOtherItem(String, int, int, int);
54 String getLine();
55 };
56
57 class ServerQueueChannelModeItem : public ServerQueueItem {
58 public:
59 String channel;
60 String mode;
61 String parameters;
62 int paramcount;
63
64 ServerQueueChannelModeItem(String, String, String);
65 bool merge(ServerQueueItem *);
66 String getLine();
67 };
68
69 class ServerQueueKickItem : public ServerQueueItem {
70 public:
71 String channel;
72 String who;
73 String reason;
74 int count;
75
76 ServerQueueKickItem(String, String, String);
77 bool merge(ServerQueueItem *);
78 String getLine();
79 };
80
81 class ServerQueueNoticeItem : public ServerQueueItem {
82 public:
83 String dest;
84 String message;
85 int count;
86
87 ServerQueueNoticeItem(String, String);
88 bool merge(ServerQueueItem *);
89 String getLine();
90 };
91
92 #endif