Source code: org/jabber/jabberbeans/ContentPacket.java
1 package org.jabber.jabberbeans;
2
3
4 /**
5 * a packet is a single unit of information to be sent (or received) from the
6 * server. The two types of packets currently 'known' are IQ and Message.
7 *
8 * @author David Waite <a href="mailto:mass@ufl.edu"><i><mass@ufl.edu>
9 * </i></a>
10 * @author $Author: mass $
11 * @version $Revision: 1.1 $
12 */
13 abstract class ContentPacket
14 extends Packet
15 {
16 User toAddress;
17 User fromAddress;
18
19 String identifier;
20
21 String type;
22 String errorType;
23 String errorText;
24
25 /**
26 * This constructor builds the packet portion of packet-derived objects.
27 * Note that due to different requirements of packet-derived objects,
28 * these values are not checked.
29 *
30 * @param packet a <code>PacketBuilder</code> which holds the value of the
31 * packet parameters
32 * @return the beginnings of a <code>Packet</code> object.
33 */
34 protected ContentPacket(PacketBuilder packet)
35 {
36 toAddress=packet.getToAddress();
37 fromAddress=packet.getFromAddress();
38 type=packet.getType();
39 identifier=packet.getIdentifier();
40 /* note: we always use an identifier- if one is not specified by
41 * the client, we insert our own. */
42 if (identifier==null)
43 identifier=IdentifierCounter.getNewIdentifier();
44 errorType=packet.getErrorType();
45 errorText=packet.getErrorText();
46 }
47
48 public User getToAddress()
49 {
50 return toAddress;
51 }
52 public User getFromAddress()
53 {
54 return fromAddress;
55 }
56 public String getIdentifier()
57 {
58 return identifier;
59 }
60 public String getType()
61 {
62 return type;
63 }
64 public String getErrorType()
65 {
66 return errorType;
67 }
68 public String getErrorText()
69 {
70 return errorText;
71 }
72 }