ChatRoom message events source is changed from Message to ChatRoom

cusax-fix
Yana Stamcheva 19 years ago
parent 1b9e946d6f
commit fdbcc4c6b0

@ -223,7 +223,7 @@ public void messageReceived(ChatRoomMessageReceivedEvent evt)
Contact sourceContact = evt.getSourceContact();
Date date = evt.getTimestamp();
Message message = evt.getSourceMessage();
Message message = evt.getMessage();
ChatRoom chatRoom = (ChatRoom) evt.getSource();
@ -257,7 +257,7 @@ public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
logger.trace("MESSAGE DELIVERED to contact: "
+ evt.getDestinationContact().getAddress());
Message msg = evt.getSourceMessage();
Message msg = evt.getMessage();
ChatPanel chatPanel = null;

@ -30,31 +30,31 @@ public class ChatRoomMessageDeliveredEvent
private Date timestamp = null;
/**
* The name/id of the chat room where the message was delivered.
* The received <tt>Message</tt>.
*/
private String chatRoomID = null;
private Message message = null;
/**
* Creates a <tt>MessageDeliveredEvent</tt> representing delivery of the
* <tt>source</tt> message to the specified <tt>to</tt> contact.
*
* @param source the <tt>Message</tt> whose delivery this event represents.
* @param source the <tt>ChatRoom</tt> which triggered this event.
* @param to the <tt>Contact</tt> that this message was sent to.
* @param timestamp a date indicating the exact moment when the event
* ocurred
* @param chatRoomID the name/id of the chatroom where this message was
* delivered.
*/
public ChatRoomMessageDeliveredEvent(Message source,
public ChatRoomMessageDeliveredEvent(ChatRoom source,
Contact to,
Date timestamp,
String chatRoomID)
Message message)
{
super(source);
this.to = to;
this.timestamp = timestamp;
this.chatRoomID = chatRoomID;
this.message = message;
}
/**
@ -70,15 +70,14 @@ public Contact getDestinationContact()
}
/**
* Returns the message that triggered this event
* Returns the received message.
* @return the <tt>Message</tt> that triggered this event.
*/
public Message getSourceMessage()
public Message getMessage()
{
return (Message) getSource();
return message;
}
/**
* A timestamp indicating the exact date when the event ocurred.
* @return a Date indicating when the event ocurred.
@ -89,12 +88,11 @@ public Date getTimestamp()
}
/**
* Returns the name of the chat room where this message has been delivered.
* @return the name of the chat room where this message has been delivered.
* Returns the <tt>ChatRoom</tt> that triggered this event.
* @return the <tt>ChatRoom</tt> that triggered this event.
*/
public String getChatRoomID()
public ChatRoom getSourceChatRoom()
{
return chatRoomID;
return (ChatRoom) getSource();
}
}

@ -64,9 +64,9 @@ public class ChatRoomMessageDeliveryFailedEvent
private Date timestamp = null;
/**
* The name/id of the chat room where the message was delivered.
* The received <tt>Message</tt>.
*/
private String chatRoomID = null;
private Message message = null;
/**
* Creates a <tt>MessageDeliveryFailedEvent</tt> indicating failure of
@ -78,21 +78,20 @@ public class ChatRoomMessageDeliveryFailedEvent
* @param errorCode an errorCode indicating the reason of the failure.
* @param timestamp the exacte Date when it was determined that delivery
* had failed.
* @param chatRoomID the name/id of the chat room that the failed message
* was destined to.
* @param message the received <tt>Message</tt>.
*/
public ChatRoomMessageDeliveryFailedEvent(Message source,
public ChatRoomMessageDeliveryFailedEvent(ChatRoom source,
Contact to,
int errorCode,
Date timestamp,
String chatRoomID)
Message message)
{
super(source);
this.to = to;
this.errorCode = errorCode;
this.timestamp = timestamp;
this.chatRoomID = chatRoomID;
this.message = message;
}
/**
* Returns a reference to the <tt>Contact</tt> that the source (failed)
@ -105,6 +104,15 @@ public Contact getDestinationContact()
{
return to;
}
/**
* Returns the received message.
* @return the <tt>Message</tt> that triggered this event.
*/
public Message getMessage()
{
return message;
}
/**
* Returns an error code descibing the reason for the failure of the
@ -130,13 +138,11 @@ public Date getTimestamp()
}
/**
* Returns the name of the chat room where this message was meant to be
* delivered.
* @return the name of the chat room where this message was meant to be
* delivered.
* Returns the <tt>ChatRoom</tt> that triggered this event.
* @return the <tt>ChatRoom</tt> that triggered this event.
*/
public String getChatRoomID()
public ChatRoom getSourceChatRoom()
{
return chatRoomID;
return (ChatRoom) getSource();
}
}

@ -29,31 +29,30 @@ public class ChatRoomMessageReceivedEvent
private Date timestamp = null;
/**
* The name/id of the ChatRoom where this message was received.
* The received <tt>Message</tt>.
*/
private String chatRoomID = null;
private Message message = null;
/**
* Creates a <tt>MessageReceivedEvent</tt> representing reception of the
* <tt>source</tt> message received from the specified <tt>from</tt>
* contact.
*
* @param source the <tt>Message</tt> whose reception this event represents.
* @param source the <tt>ChatRoom</tt> for which the message is received.
* @param from the <tt>Contact</tt> that has sent this message.
* @param timestamp the exact date when the event ocurred.
* @param chatRoomID the name/id of the chat room where this message has
* been received
* @param message the received <tt>Message</tt>.
*/
public ChatRoomMessageReceivedEvent(Message source,
public ChatRoomMessageReceivedEvent(ChatRoom source,
Contact from,
Date timestamp,
String chatRoomID)
Message message)
{
super(source);
this.from = from;
this.timestamp = timestamp;
this.chatRoomID = chatRoomID;
this.message = message;
}
/**
@ -69,12 +68,12 @@ public Contact getSourceContact()
}
/**
* Returns the message that triggered this event
* Returns the received message.
* @return the <tt>Message</tt> that triggered this event.
*/
public Message getSourceMessage()
public Message getMessage()
{
return (Message)getSource();
return message;
}
/**
@ -87,11 +86,11 @@ public Date getTimestamp()
}
/**
* Returns the name of the chat room where this message has been received.
* @return the name of the chat room where this message has been received.
* Returns the <tt>ChatRoom</tt> that triggered this event.
* @return the <tt>ChatRoom</tt> that triggered this event.
*/
public String getChatRoomID()
public ChatRoom getSourceChatRoom()
{
return chatRoomID;
return (ChatRoom) getSource();
}
}

Loading…
Cancel
Save