cb21075d |
1 | // Message.H -*- C++ -*- |
2 | // Copyright (c) 1997, 1998 Etienne BERNARD |
c6e7af05 |
3 | // Copyright (c) 2005 Clinton Ebadi |
cb21075d |
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 |
c6e7af05 |
17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | // 02110-1301, USA. |
cb21075d |
19 | |
20 | #ifndef MESSAGE_H |
21 | #define MESSAGE_H |
22 | |
23 | #include "String.H" |
24 | |
25 | struct Message { |
26 | int code; |
27 | String description; |
28 | |
29 | Message(int c, String d) : code(c), description(d) { } |
30 | int getCode() const { return code; } |
31 | String getMessage() const { return description; } |
5aec4622 |
32 | |
33 | bool operator== (Message m) { return getCode () == m.getCode (); } |
cb21075d |
34 | }; |
35 | |
5aec4622 |
36 | #define Ok (Message(0, "")) |
37 | #define NotOnChannel(c) (Message(-1, String("I am not on channel ") + (c))) |
38 | #define NotChannelOp(c) (Message(-2, String("I am not channel op on ") + (c))) |
39 | #define UserNotFound(w, c) (Message(-3, (w) + " is not on channel " + (c))) |
40 | #define UserNotOp(w, c) (Message(-4, (w) + " is not channel op on " + (c))) |
41 | #define UserProtected(w, c) (Message(-5, (w) + " is protected on " + (c))) |
42 | #define InvalidNick(n) (Message(-6, (n) + " is not a valid nickname")) |
43 | #define InvalidChannel(c) (Message(-7, (c) + " is not a valid channel name")) |
44 | #define MassOpNotAllowed (Message(-8, "Mass op is not allowed.")) |
45 | #define UserOnShitList(w) (Message(-9, String("User ") + w + " is on my shitlist")) |
46 | #define CanNotChangeTopic(c) (Message(-10, String("I can not change topic on ") + (c))) |
47 | #define TopicLocked(c) (Message(-11, String("Topic is locked on ") + (c))) |
48 | #define InvalidPort(p) (Message(-12, String((long)(p)) + " is an invalid port number")) |
49 | #define InvalidTime(t) (Message(-13, String((long)(t)) + " is an invalid time")) |
50 | #define CanNotChangeServer (Message(-14, "I cannot change server without loosing op on one of my channels")) |
51 | #define EmptyServerList (Message(-15, "Server list is empty")) |
52 | #define InvalidServerNumber(n) (Message(-16, String((long)(n)) + " is an invalid server number")) |
53 | #define InvalidParameters (Message(-17, "Invalid parameters")) |
54 | #define NotFound(w) (Message(-18, String("I can not find ") + (w))); |
55 | #define NotInUserlist(w) (Message(-19, (w) + " is not in my userlist")) |
56 | #define NotInShitlist(w) (Message(-20, (w) + " is not in my shitlist")) |
57 | #define AlreadyInUserlist(m, mc) (Message(-21, (m) + " is already in userlist on channel(s) " + (mc))) |
58 | #define AlreadyInShitlist(m, mc) (Message(-22, (m) + " is already in shitlist on channel(s) " + (mc))) |
59 | #define EmptyMessage (Message(-23, "Can not send an empty message")) |
60 | #define EmptyAddressee (Message(-24, "Can not send to nobody")) |
672b7d4e |
61 | #define NotToChannel (Message(-25, "Can not send to a channel.")) |
5aec4622 |
62 | #define NotConnected (Message(-26, "Not connected.")) |
63 | |
cb21075d |
64 | #endif |