001: /**
002: * $RCSfile$
003: * $Revision: 569 $
004: * $Date: 2004-12-01 15:31:18 -0300 (Wed, 01 Dec 2004) $
005: *
006: * Copyright (C) 2004 Jive Software. All rights reserved.
007: *
008: * This software is published under the terms of the GNU Public License (GPL),
009: * a copy of which is included in this distribution.
010: */package org.jivesoftware.openfire.muc.spi;
011:
012: import java.util.Date;
013:
014: import org.jivesoftware.openfire.muc.MUCRoom;
015: import org.xmpp.packet.Message;
016: import org.xmpp.packet.JID;
017:
018: /**
019: * Represents an entry in the conversation log of a room. An entry basically obtains the necessary
020: * information to log from the message adding a timestamp of when the message was sent to the room.
021: *
022: * @author Gaston Dombiak
023: */
024: class ConversationLogEntry {
025:
026: private Date date;
027:
028: private String subject;
029:
030: private String body;
031:
032: private JID sender;
033:
034: private String nickname;
035:
036: private long roomID;
037:
038: /**
039: * Creates a new ConversationLogEntry that registers that a given message was sent to a given
040: * room on a given date.
041: *
042: * @param date the date when the message was sent to the room.
043: * @param room the room that received the message.
044: * @param message the message to log as part of the conversation in the room.
045: * @param sender the real XMPPAddress of the sender (e.g. john@example.org).
046: */
047: public ConversationLogEntry(Date date, MUCRoom room,
048: Message message, JID sender) {
049: this .date = date;
050: this .subject = message.getSubject();
051: this .body = message.getBody();
052: this .sender = sender;
053: this .roomID = room.getID();
054: this .nickname = message.getFrom().getResource();
055: }
056:
057: /**
058: * Returns the body of the logged message.
059: *
060: * @return the body of the logged message.
061: */
062: public String getBody() {
063: return body;
064: }
065:
066: /**
067: * Returns the XMPP address of the logged message's sender.
068: *
069: * @return the XMPP address of the logged message's sender.
070: */
071: public JID getSender() {
072: return sender;
073: }
074:
075: /**
076: * Returns the nickname that the user had at the moment that the message was sent to the room.
077: *
078: * @return the nickname that the user had at the moment that the message was sent to the room.
079: */
080: public String getNickname() {
081: return nickname;
082: }
083:
084: /**
085: * Returns the subject of the logged message.
086: *
087: * @return the subject of the logged message.
088: */
089: public String getSubject() {
090: return subject;
091: }
092:
093: /**
094: * Returns the date when the logged message was sent to the room.
095: *
096: * @return the date when the logged message was sent to the room.
097: */
098: public Date getDate() {
099: return date;
100: }
101:
102: /**
103: * Returns the ID of the room where the message was sent.
104: *
105: * @return the ID of the room where the message was sent.
106: */
107: public long getRoomID() {
108: return roomID;
109: }
110:
111: }
|