blob: 55fd149b160d24b5c0f13919a4fa356c21d8afba [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001/**
2 * $RCSfile$
3 * $Revision$
4 * $Date$
5 *
6 * Copyright 2003-2007 Jive Software.
7 *
8 * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21package org.jivesoftware.smackx;
22
23import org.jivesoftware.smackx.packet.DiscoverItems;
24
25/**
26 * The OfflineMessageHeader holds header information of an offline message. The header
27 * information was retrieved using the {@link OfflineMessageManager} class.<p>
28 *
29 * Each offline message is identified by the target user of the offline message and a unique stamp.
30 * Use {@link OfflineMessageManager#getMessages(java.util.List)} to retrieve the whole message.
31 *
32 * @author Gaston Dombiak
33 */
34public class OfflineMessageHeader {
35 /**
36 * Bare JID of the user that was offline when the message was sent.
37 */
38 private String user;
39 /**
40 * Full JID of the user that sent the message.
41 */
42 private String jid;
43 /**
44 * Stamp that uniquely identifies the offline message. This stamp will be used for
45 * getting the specific message or delete it. The stamp may be of the form UTC timestamps
46 * but it is not required to have that format.
47 */
48 private String stamp;
49
50 public OfflineMessageHeader(DiscoverItems.Item item) {
51 super();
52 user = item.getEntityID();
53 jid = item.getName();
54 stamp = item.getNode();
55 }
56
57 /**
58 * Returns the bare JID of the user that was offline when the message was sent.
59 *
60 * @return the bare JID of the user that was offline when the message was sent.
61 */
62 public String getUser() {
63 return user;
64 }
65
66 /**
67 * Returns the full JID of the user that sent the message.
68 *
69 * @return the full JID of the user that sent the message.
70 */
71 public String getJid() {
72 return jid;
73 }
74
75 /**
76 * Returns the stamp that uniquely identifies the offline message. This stamp will
77 * be used for getting the specific message or delete it. The stamp may be of the
78 * form UTC timestamps but it is not required to have that format.
79 *
80 * @return the stamp that uniquely identifies the offline message.
81 */
82 public String getStamp() {
83 return stamp;
84 }
85}