KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > muc > spi > ConversationLogEntry


1 /**
2  * $RCSfile: ConversationLogEntry.java,v $
3  * $Revision: 1.4 $
4  * $Date: 2004/12/01 18:31:18 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.muc.spi;
13
14 import java.util.Date JavaDoc;
15
16 import org.jivesoftware.messenger.muc.MUCRoom;
17 import org.xmpp.packet.Message;
18 import org.xmpp.packet.JID;
19
20 /**
21  * Represents an entry in the conversation log of a room. An entry basically obtains the necessary
22  * information to log from the message adding a timestamp of when the message was sent to the room.
23  *
24  * @author Gaston Dombiak
25  */

26 class ConversationLogEntry {
27
28     private Date JavaDoc date;
29
30     private String JavaDoc subject;
31
32     private String JavaDoc body;
33
34     private JID sender;
35     
36     private String JavaDoc nickname;
37     
38     private long roomID;
39
40     /**
41      * Creates a new ConversationLogEntry that registers that a given message was sent to a given
42      * room on a given date.
43      *
44      * @param date the date when the message was sent to the room.
45      * @param room the room that received the message.
46      * @param message the message to log as part of the conversation in the room.
47      * @param sender the real XMPPAddress of the sender (e.g. john@example.org).
48      */

49     public ConversationLogEntry(Date JavaDoc date, MUCRoom room, Message message, JID sender) {
50         this.date = date;
51         this.subject = message.getSubject();
52         this.body = message.getBody();
53         this.sender = sender;
54         this.roomID = room.getID();
55         this.nickname = message.getFrom().getResource();
56     }
57
58     /**
59      * Returns the body of the logged message.
60      *
61      * @return the body of the logged message.
62      */

63     public String JavaDoc getBody() {
64         return body;
65     }
66
67     /**
68      * Returns the XMPP address of the logged message's sender.
69      *
70      * @return the XMPP address of the logged message's sender.
71      */

72     public JID getSender() {
73         return sender;
74     }
75
76     /**
77      * Returns the nickname that the user had at the moment that the message was sent to the room.
78      *
79      * @return the nickname that the user had at the moment that the message was sent to the room.
80      */

81     public String JavaDoc getNickname() {
82         return nickname;
83     }
84
85     /**
86      * Returns the subject of the logged message.
87      *
88      * @return the subject of the logged message.
89      */

90     public String JavaDoc getSubject() {
91         return subject;
92     }
93
94     /**
95      * Returns the date when the logged message was sent to the room.
96      *
97      * @return the date when the logged message was sent to the room.
98      */

99     public Date JavaDoc getDate() {
100         return date;
101     }
102
103     /**
104      * Returns the ID of the room where the message was sent.
105      *
106      * @return the ID of the room where the message was sent.
107      */

108     public long getRoomID() {
109         return roomID;
110     }
111
112 }
Popular Tags