001/** 002 * 003 * Copyright 2003-2007 Jive Software. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.jivesoftware.smackx.offline; 019 020import org.jivesoftware.smackx.disco.packet.DiscoverItems; 021import org.jxmpp.jid.Jid; 022 023/** 024 * The OfflineMessageHeader holds header information of an offline message. The header 025 * information was retrieved using the {@link OfflineMessageManager} class.<p> 026 * 027 * Each offline message is identified by the target user of the offline message and a unique stamp. 028 * Use {@link OfflineMessageManager#getMessages(java.util.List)} to retrieve the whole message. 029 * 030 * @author Gaston Dombiak 031 */ 032public class OfflineMessageHeader { 033 /** 034 * Bare JID of the user that was offline when the message was sent. 035 */ 036 private Jid user; 037 /** 038 * Full JID of the user that sent the message. 039 */ 040 private String jid; 041 /** 042 * Stamp that uniquely identifies the offline message. This stamp will be used for 043 * getting the specific message or delete it. The stamp may be of the form UTC timestamps 044 * but it is not required to have that format. 045 */ 046 private String stamp; 047 048 public OfflineMessageHeader(DiscoverItems.Item item) { 049 super(); 050 user = item.getEntityID(); 051 jid = item.getName(); 052 stamp = item.getNode(); 053 } 054 055 /** 056 * Returns the bare JID of the user that was offline when the message was sent. 057 * 058 * @return the bare JID of the user that was offline when the message was sent. 059 */ 060 public Jid getUser() { 061 return user; 062 } 063 064 /** 065 * Returns the full JID of the user that sent the message. 066 * 067 * @return the full JID of the user that sent the message. 068 */ 069 public String getJid() { 070 return jid; 071 } 072 073 /** 074 * Returns the stamp that uniquely identifies the offline message. This stamp will 075 * be used for getting the specific message or delete it. The stamp may be of the 076 * form UTC timestamps but it is not required to have that format. 077 * 078 * @return the stamp that uniquely identifies the offline message. 079 */ 080 public String getStamp() { 081 return stamp; 082 } 083}