01: package dalma.endpoints.irc;
02:
03: import java.io.Serializable;
04:
05: /**
06: * Message received from IRC.
07: *
08: * @author Kohsuke Kawaguchi
09: */
10: public final class Message implements Serializable {
11: private final Buddy sender;
12: private final String text;
13: private final Channel receiver;
14:
15: protected Message(Buddy sender, String text, Channel channel) {
16: this .sender = sender;
17: this .text = text;
18: this .receiver = channel;
19: }
20:
21: /**
22: * Gets the {@link Buddy} who sent the message.
23: *
24: * @return never null.
25: */
26: public Buddy getSender() {
27: return sender;
28: }
29:
30: /**
31: * Gets the message that was received.
32: *
33: * @return never null.
34: */
35: public String getText() {
36: return text;
37: }
38:
39: /**
40: * Gets the {@link Channel} to which this message was sent.
41: *
42: * @return
43: * null if this message wasn't sent to a channel.
44: */
45: public Channel getReceiver() {
46: return receiver;
47: }
48:
49: public String toString() {
50: return sender.toString() + " : " + text;
51: }
52:
53: private static final long serialVersionUID = 1L;
54: }
|