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