1. Multi chat message history

2. Test for Multi chat message history
3. Change in LocalUserChatRoomPresenceListener
cusax-fix
Damian Minkov 19 years ago
parent 811a779709
commit 845d734242

@ -33,7 +33,9 @@
public class MessageHistoryServiceImpl
implements MessageHistoryService,
MessageListener,
ServiceListener
ChatRoomMessageListener,
ServiceListener,
LocalUserChatRoomPresenceListener
{
/**
* The logger for this class.
@ -213,7 +215,6 @@ public Collection findByPeriod(MetaContact contact,
throws RuntimeException
{
return findByPeriod(contact, startDate, endDate, keywords, false);
}
/**
@ -341,7 +342,6 @@ public Collection findFirstMessagesAfter(MetaContact contact, Date date,
startIndex = 0;
return resultAsList.subList(startIndex, resultAsList.size());
}
/**
@ -424,6 +424,71 @@ private History getHistory(Contact localContact, Contact remoteContact)
return retVal;
}
/**
* Returns the history by specified local contact
* (if is null the default is used)
* and by the chat room
*
* @param room The chat room
* @return History the history - created if not existing
* @throws IOException
*/
private History getHistoryForMultiChat(
Contact localContact,
ChatRoom room)
throws IOException
{
AccountID account = room.getParentProvider().getAccountID();
return this.getHistoryForMultiChat(
null,
account.getAccountUniqueID(),
account.getService(),
room.getName());
}
/**
* Returns the history by specified local contact
* (if is null the default is used)
* and by accountUniqueID, channel and server
* used by the multichat account.
*
* @param localContact Contact
* @param account The account UniqueID
* @param server the server used by the account
* @param channel the channel history we are searching for
* @return History the history - created if not existing
* @throws IOException
*/
private History getHistoryForMultiChat(
Contact localContact,
String account,
String server,
String channel)
throws IOException
{
History retVal = null;
String localId = localContact == null ? "default" : localContact
.getAddress();
HistoryID historyId = HistoryID.createFromID(
new String[] { "messages",
localId,
account,
channel + "@" + server });
if (this.historyService.isHistoryExisting(historyId))
{
retVal = this.historyService.getHistory(historyId);
} else {
retVal = this.historyService.createHistory(historyId,
recordStructure);
}
return retVal;
}
/**
* Used to convert HistoryRecord in MessageDeliveredEvent or MessageReceivedEvent
@ -466,6 +531,56 @@ private Object convertHistoryRecordToMessageEvent(HistoryRecord hr, Contact cont
contact,
timestamp);
}
/**
* Used to convert HistoryRecord in ChatRoomMessageDeliveredEvent or
* ChatRoomMessageReceivedEvent
* which are returned by the finder methods
*
* @param hr HistoryRecord
* @param contact Contact
* @return Object
*/
private Object convertHistoryRecordToMessageEvent(
HistoryRecord hr, ChatRoom room)
{
MessageImpl msg = new MessageImpl(hr);
Date timestamp = null;
// if there is value for date of receiving the message
// this is the event timestamp (this is the date that had came from protocol)
// the HistoryRecord timestamp is the timestamp when the record was written
if(msg.getMessageReceivedDate() != null)
{
if(msg.getMessageReceivedDate().after(hr.getTimestamp()) &&
(msg.getMessageReceivedDate().getTime() -
hr.getTimestamp().getTime()) > 86400000) // 24*60*60*1000
timestamp = hr.getTimestamp();
else
timestamp = msg.getMessageReceivedDate();
}
else
timestamp = hr.getTimestamp();
// 5 is the index of the subject in the structure
String fromStr = hr.getPropertyValues()[5];
ChatRoomMember from = new ChatRoomMemberImpl(fromStr, room, null);
if(msg.isOutgoing)
{
return new ChatRoomMessageDeliveredEvent(
room,
timestamp,
msg);
}
else
return new ChatRoomMessageReceivedEvent(
room,
from,
timestamp,
msg);
}
/**
* starts the service. Check the current registerd protocol providers
@ -571,13 +686,52 @@ public void messageDelivered(MessageDeliveredEvent evt)
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
{
}
// //////////////////////////////////////////////////////////////////////////
// ChatRoomMessageListener implementation methods
public void messageReceived(ChatRoomMessageReceivedEvent evt)
{
try
{
History history = this.getHistoryForMultiChat(
null,
evt.getSourceChatRoom());
writeMessage(history, "in", evt.getSourceChatRoomMember(),
evt.getMessage(), evt.getTimestamp());
} catch (IOException e)
{
logger.error("Could not add message to history", e);
}
}
public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
{
try
{
History history = this.
getHistoryForMultiChat(
null,
evt.getSourceChatRoom());
writeMessage(history, "out", evt.getMessage(), evt.getTimestamp());
} catch (IOException e)
{
logger.error("Could not add message to history", e);
}
}
public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
{
}
/**
*
* @param direction String
* @param source Contact
* @param destination Contact
* @param message Message
* Writes message to the history
* @param direction String direction of the message
* @param source The source Contact
* @param destination The destiantion Contact
* @param message Message message to be written
* @param messageTimestamp Date this is the timestamp when was message received
* that came from the protocol provider
*/
@ -586,6 +740,25 @@ private void writeMessage(String direction, Contact source,
{
try {
History history = this.getHistory(source, destination);
writeMessage(history, direction, message, messageTimestamp);
} catch (IOException e)
{
logger.error("Could not add message to history", e);
}
}
/**
* Writes message to the history
* @param history The history to which will write the message
* @param message Message
* @param messageTimestamp Date this is the timestamp when was message received
* that came from the protocol provider
*/
private void writeMessage(History history, String direction,
Message message, Date messageTimestamp)
{
try {
HistoryWriter historyWriter = history.getWriter();
historyWriter.addRecord(new String[] { direction,
message.getContent(), message.getContentType(),
@ -597,6 +770,32 @@ private void writeMessage(String direction, Contact source,
logger.error("Could not add message to history", e);
}
}
/**
* Writes message to the history
* @param history The history to which will write the message
* @param message Message
* @param messageTimestamp Date this is the timestamp when was message received
* that came from the protocol provider
*/
private void writeMessage(History history, String direction,
ChatRoomMember from,
Message message, Date messageTimestamp)
{
try {
HistoryWriter historyWriter = history.getWriter();
historyWriter.addRecord(new String[] { direction,
message.getContent(), message.getContentType(),
message.getEncoding(), message.getMessageUID(),
from.getContactAddress(),
String.valueOf(messageTimestamp.getTime()) },
new Date()); // this date is when the history record is written
} catch (IOException e)
{
logger.error("Could not add message to history", e);
}
}
// //////////////////////////////////////////////////////////////////////////
/**
@ -691,6 +890,29 @@ private void handleProviderAdded(ProtocolProviderService provider)
{
logger.trace("Service did not have a im op. set.");
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
if (opSetMultiUChat != null)
{
Iterator iter =
opSetMultiUChat.getCurrentlyJoinedChatRooms().iterator();
while(iter.hasNext())
{
ChatRoom room = (ChatRoom)iter.next();
room.addMessageListener(this);
}
opSetMultiUChat.addPresenceListener(this);
}
else
{
logger.trace("Service did not have a multi im op. set.");
}
}
/**
@ -710,6 +932,43 @@ private void handleProviderRemoved(ProtocolProviderService provider)
{
opSetIm.removeMessageListener(this);
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
if (opSetMultiUChat != null)
{
Iterator iter =
opSetMultiUChat.getCurrentlyJoinedChatRooms().iterator();
while(iter.hasNext())
{
ChatRoom room = (ChatRoom)iter.next();
room.removeMessageListener(this);
}
}
}
/**
* Called to notify interested parties that a change in our presence in
* a chat room has occured. Changes may include us being kicked, join,
* left.
* @param evt the <tt>LocalUserChatRoomPresenceChangeEvent</tt> instance
* containing the chat room and the type, and reason of the change
*/
public void localUserPresenceChanged(LocalUserChatRoomPresenceChangeEvent evt)
{
if(evt.getEventType() ==
LocalUserChatRoomPresenceChangeEvent.CHAT_ROOM_JOINED)
{
evt.getChatRoom().addMessageListener(this);
}
else
{
evt.getChatRoom().removeMessageListener(this);
}
}
/**
@ -951,6 +1210,422 @@ private Hashtable getHistoryReaders(MetaContact contact)
}
return readers;
}
/**
* Returns all the messages exchanged in the supplied
* chat room after the given date
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByStartDate(ChatRoom room, Date startDate)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.findByStartDate(startDate);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns all the messages exchanged
* in the supplied chat room before the given date
*
* @param room The chat room
* @param endDate Date the end date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByEndDate(ChatRoom room, Date endDate)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.findByEndDate(endDate);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.findByPeriod(startDate, endDate);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @param keywords array of keywords
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room,
Date startDate, Date endDate, String[] keywords)
throws RuntimeException
{
return findByPeriod(room, startDate, endDate, keywords, false);
}
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @param keywords array of keywords
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate,
String[] keywords, boolean caseSensitive)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.findByPeriod(startDate, endDate, keywords,
SEARCH_FIELD, caseSensitive);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns all the messages exchanged
* in the supplied room having the given keyword
*
* @param room The Chat room
* @param keyword keyword
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeyword(ChatRoom room, String keyword)
throws RuntimeException
{
return findByKeyword(room, keyword, false);
}
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keyword
*
* @param room The chat room
* @param keyword keyword
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeyword(ChatRoom room, String keyword,
boolean caseSensitive)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.
findByKeyword(keyword, SEARCH_FIELD, caseSensitive);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
* @param keywords keyword
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeywords(ChatRoom room, String[] keywords)
throws RuntimeException
{
return findByKeywords(room, keywords, false);
}
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
* @param keywords keyword
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeywords(ChatRoom room, String[] keywords,
boolean caseSensitive)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
// add the progress listeners
addHistorySearchProgressListeners(reader, 1);
Iterator recs = reader.
findByKeywords(keywords, SEARCH_FIELD, caseSensitive);
while (recs.hasNext())
{
result.add(convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(), room));
}
removeHistorySearchProgressListeners(reader);
} catch (IOException e)
{
logger.error("Could not read history", e);
}
return result;
}
/**
* Returns the supplied number of recent messages exchanged
* in the supplied chat room
*
* @param room The chat room
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findLast(ChatRoom room, int count)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
// get the readers for this room
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findLast(count);
while (recs.hasNext())
{
result.add(
convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(),
room));
}
} catch (IOException e)
{
logger.error("Could not read history", e);
}
LinkedList resultAsList = new LinkedList(result);
int startIndex = resultAsList.size() - count;
if(startIndex < 0)
startIndex = 0;
return resultAsList.subList(startIndex, resultAsList.size());
}
/**
* Returns the supplied number of recent messages after the given date
* exchanged in the supplied chat room
*
* @param room The chat room
* @param date messages after date
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findFirstMessagesAfter(ChatRoom room, Date date, int count)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findFirstRecordsAfter(date, count);
while (recs.hasNext())
{
result.add(
convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(),
room));
}
} catch (IOException e)
{
logger.error("Could not read history", e);
}
LinkedList resultAsList = new LinkedList(result);
int startIndex = resultAsList.size() - count;
if(startIndex < 0)
startIndex = 0;
return resultAsList.subList(startIndex, resultAsList.size());
}
/**
* Returns the supplied number of recent messages before the given date
* exchanged in the supplied chat room
*
* @param room The chat room
* @param date messages before date
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findLastMessagesBefore(ChatRoom room, Date date, int count)
throws RuntimeException
{
TreeSet result = new TreeSet(new ChatRoomMessageEventComparator());
try
{
HistoryReader reader =
this.getHistoryForMultiChat(null, room).getReader();
Iterator recs = reader.findLastRecordsBefore(date, count);
while (recs.hasNext())
{
result.add(
convertHistoryRecordToMessageEvent(
(HistoryRecord)recs.next(),
room));
}
} catch (IOException e)
{
logger.error("Could not read history", e);
}
LinkedList resultAsList = new LinkedList(result);
int startIndex = resultAsList.size() - count;
if(startIndex < 0)
startIndex = 0;
return resultAsList.subList(startIndex, resultAsList.size());
}
/**
* A wrapper around HistorySearchProgressListener
@ -1145,4 +1820,79 @@ else if(o2 instanceof MessageReceivedEvent)
return date1.compareTo(date2);
}
}
}
/**
* Used to compare ChatRoomMessageDeliveredEvent
* or ChatRoomMessageReceivedEvent
* and to be ordered in TreeSet according their timestamp
*/
private class ChatRoomMessageEventComparator
implements Comparator
{
public int compare(Object o1, Object o2)
{
Date date1 = null;
Date date2 = null;
if(o1 instanceof ChatRoomMessageDeliveredEvent)
date1 = ((ChatRoomMessageDeliveredEvent)o1).getTimestamp();
else if(o1 instanceof ChatRoomMessageReceivedEvent)
date1 = ((ChatRoomMessageReceivedEvent)o1).getTimestamp();
else
return 0;
if(o2 instanceof ChatRoomMessageDeliveredEvent)
date2 = ((ChatRoomMessageDeliveredEvent)o2).getTimestamp();
else if(o2 instanceof ChatRoomMessageReceivedEvent)
date2 = ((ChatRoomMessageReceivedEvent)o2).getTimestamp();
else
return 0;
return date1.compareTo(date2);
}
}
/**
* Simple ChatRoomMember implementation.
*/
class ChatRoomMemberImpl
implements ChatRoomMember
{
private ChatRoom chatRoom;
private String name;
private ChatRoomMemberRole role;
public ChatRoomMemberImpl(String name, ChatRoom chatRoom,
ChatRoomMemberRole role)
{
this.chatRoom = chatRoom;
this.name = name;
this.role = role;
}
public ChatRoom getChatRoom()
{
return chatRoom;
}
public ProtocolProviderService getProtocolProvider()
{
return chatRoom.getParentProvider();
}
public String getContactAddress()
{
return name;
}
public String getName()
{
return name;
}
public ChatRoomMemberRole getRole()
{
return role;
}
}
}

@ -77,7 +77,7 @@ public void addMessageListener(MessageListener listener)
public Message createMessage(byte[] content, String contentType,
String contentEncoding, String subject)
{
return new MessageImpl(new String(content), contentType
return new MockMessage(new String(content), contentType
, contentEncoding, subject);
}
@ -90,7 +90,7 @@ public Message createMessage(byte[] content, String contentType,
*/
public Message createMessage(String messageText)
{
return new MessageImpl(messageText, DEFAULT_MIME_TYPE,
return new MockMessage(messageText, DEFAULT_MIME_TYPE,
DEFAULT_MIME_ENCODING, null);
}
@ -187,69 +187,4 @@ public void deliverMessage(String to, Message msg)
listener.messageReceived(msgReceivedEvt);
}
}
public class MessageImpl
implements Message
{
private String textContent = null;
private String contentType = null;
private String contentEncoding = null;
private String messageUID = null;
private String subject = null;
public MessageImpl(String content,
String contentType,
String contentEncoding,
String subject)
{
this.textContent = content;
this.contentType = contentType;
this.contentEncoding = contentEncoding;
this.subject = subject;
//generate the uid
this.messageUID = String.valueOf( System.currentTimeMillis())
+ String.valueOf(hashCode());
}
public String getContent()
{
return textContent;
}
public String getContentType()
{
return contentType;
}
public String getEncoding()
{
return contentEncoding;
}
public String getMessageUID()
{
return messageUID;
}
public byte[] getRawData()
{
return getContent().getBytes();
}
public int getSize()
{
return getContent().length();
}
public String getSubject()
{
return subject;
}
}
}
}

@ -0,0 +1,90 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.protocol.mock;
import net.java.sip.communicator.service.protocol.*;
/**
*
* @author Damian Minkov
*/
public class MockChatRoomMember
implements ChatRoomMember
{
private ChatRoom chatRoom;
private String name;
private ChatRoomMemberRole role;
public MockChatRoomMember(String name, ChatRoom chatRoom,
ChatRoomMemberRole role)
{
this.chatRoom = chatRoom;
this.name = name;
this.role = role;
}
/**
* Returns the chat room that this member is participating in.
*
* @return the <tt>ChatRoom</tt> instance that this member belongs to.
*/
public ChatRoom getChatRoom()
{
return chatRoom;
}
/**
* Returns the protocol provider instance that this member has originated
* in.
*
* @return the <tt>ProtocolProviderService</tt> instance that created this
* member and its containing cht room
*/
public ProtocolProviderService getProtocolProvider()
{
return chatRoom.getParentProvider();
}
/**
* Returns the contact identifier representing this contact. In protocols
* like IRC this method would return the same as getName() but in others
* like Jabber, this method would return a full contact id uri.
*
* @return a String (contact address), uniquely representing the contact
* over the service the service being used by the associated protocol
* provider instance/
*/
public String getContactAddress()
{
return name;
}
/**
* Returns the name of this member as it is known in its containing
* chatroom (aka a nickname). The name returned by this method, may
* sometimes match the string returned by getContactID() which is actually
* the address of a contact in the realm of the corresponding protocol.
*
* @return the name of this member as it is known in the containing chat
* room (aka a nickname).
*/
public String getName()
{
return name;
}
/**
* Returns the role of this chat room member in its containing room.
*
* @return a <tt>ChatRoomMemberRole</tt> instance indicating the role
* the this member in its containing chat room.
*/
public ChatRoomMemberRole getRole()
{
return role;
}
}

@ -0,0 +1,127 @@
/*
* MockMessage.java
*
* Created on Jun 21, 2007, 3:10:21 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package net.java.sip.communicator.impl.protocol.mock;
import net.java.sip.communicator.service.protocol.*;
/**
* Message Impl.
* @author Damian Minkov
*/
public class MockMessage
implements Message
{
private String textContent = null;
private String contentType = null;
private String contentEncoding = null;
private String messageUID = null;
private String subject = null;
MockMessage(String content,
String contentType,
String contentEncoding,
String subject)
{
this.textContent = content;
this.contentType = contentType;
this.contentEncoding = contentEncoding;
this.subject = subject;
//generate the uid
this.messageUID = String.valueOf( System.currentTimeMillis())
+ String.valueOf(hashCode());
}
MockMessage(String content)
{
this.textContent = content;
this.contentType =
OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE;
this.contentEncoding =
OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING;
this.subject = null;
//generate the uid
this.messageUID = String.valueOf( System.currentTimeMillis())
+ String.valueOf(hashCode());
}
/**
* Returns the content of this message if representable in text form or null
* if this message does not contain text data.
* @return a String containing the content of this message or null if the
* message does not contain data representable in text form.
*/
public String getContent()
{
return textContent;
}
/**
* Returns the MIME type for the message content.
* @return a String containing the mime type of the message contant.
*/
public String getContentType()
{
return contentType;
}
/**
* Returns the MIME content encoding of this message.
* @return a String indicating the MIME encoding of this message.
*/
public String getEncoding()
{
return contentEncoding;
}
/**
* Returns a unique identifier of this message.
* @return a String that uniquely represents this message in the scope of
* this protocol.
*/
public String getMessageUID()
{
return messageUID;
}
/**
* Get the raw/binary content of an instant message.
* @return a byte[] array containing message bytes.
*/
public byte[] getRawData()
{
return getContent().getBytes();
}
/**
* Returns the size of the content stored in this message.
* @return an int indicating the number of bytes that this message contains.
*/
public int getSize()
{
return getContent().length();
}
/**
* Returns the subject of this message or null if the message contains no
* subject.
* @return the subject of this message or null if the message contains no
* subject.
*/
public String getSubject()
{
return subject;
}
}

@ -0,0 +1,310 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.protocol.mock;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
/**
* Multiuser chat functionalites for the mock protocol.
* @author Damian Minkov
*/
public class MockMultiUserChat
implements OperationSetMultiUserChat,
ChatRoomJoinListener
{
/**
* The protocol provider that created us.
*/
private MockProvider provider = null;
private List existingChatRooms = new Vector();
private List joinedChatRooms = new Vector();
/**
* Currently registered invitation listeners.
*/
private Vector invitationListeners = new Vector();
/**
* Currently registered invitation reject listeners.
*/
private Vector invitationRejectListeners = new Vector();
/**
* Currently registered local user chat room presence listeners.
*/
private Vector localUserChatRoomPresenceListeners = new Vector();
/**
* Creates an instance of this operation set keeping a reference to the
* parent protocol provider and presence operation set.
*
* @param provider The provider instance that creates us.
*/
public MockMultiUserChat(MockProvider provider)
{
this.provider = provider;
}
/**
* Returns the <tt>List</tt> of <tt>String</tt>s indicating chat rooms
* currently available on the server that this protocol provider is
* connected to.
*
* @return a <tt>java.util.List</tt> of the name <tt>String</tt>s for chat
* rooms that are currently available on the server that this protocol
* provider is connected to.
*
* @throws OperationFailedException if we faile retrieving this list from
* the server.
* @throws OperationNotSupportedException if the server does not support
* multi user chat
*/
public List getExistingChatRooms()
throws OperationFailedException,
OperationNotSupportedException
{
return existingChatRooms;
}
/**
* Returns a list of the chat rooms that we have joined and are currently
* active in.
*
* @return a <tt>List</tt> of the rooms where the user has joined using a
* given connection.
*/
public List getCurrentlyJoinedChatRooms()
{
return joinedChatRooms;
}
/**
* Returns a list of the chat rooms that <tt>chatRoomMember</tt> has joined
* and is currently active in.
*
* @param chatRoomMember the chatRoomMember whose current ChatRooms we will
* be querying.
* @return a list of the chat rooms that <tt>chatRoomMember</tt> has
* joined and is currently active in.
*
* @throws OperationFailedException if an error occurs while trying to
* discover the room on the server.
* @throws OperationNotSupportedException if the server does not support
* multi user chat
*/
public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember)
throws OperationFailedException,
OperationNotSupportedException
{
List result = new Vector();
Iterator iter = joinedChatRooms.iterator();
while(iter.hasNext())
{
ChatRoom elem = (ChatRoom)iter.next();
if(elem.getMembers().contains(chatRoomMember))
result.add(elem);
}
return result;
}
/**
* Creates a room with the named <tt>roomName</tt> and according to the
* specified <tt>roomProperties</tt> on the server that this protocol
* provider is currently connected to. When the method returns the room the
* local user will not have joined it and thus will not receive messages on
* it until the <tt>ChatRoom.join()</tt> method is called.
* <p>
* @param roomName the name of the <tt>ChatRoom</tt> to create.
* @param roomProperties properties specifying how the room should be
* created.
* @throws OperationFailedException if the room couldn't be created for some
* reason (e.g. room already exists; user already joined to an existant
* room or user has no permissions to create a chat room).
* @throws OperationNotSupportedException if chat room creation is not
* supported by this server
*
* @return the newly created <tt>ChatRoom</tt> named <tt>roomName</tt>.
*/
public ChatRoom createChatRoom(String roomName, Hashtable roomProperties)
throws OperationFailedException,
OperationNotSupportedException
{
MockChatRoom room = new MockChatRoom(provider, this, roomName);
existingChatRooms.add(room);
room.addJoinListener(this);
return room;
}
/**
* Returns a reference to a chatRoom named <tt>roomName</tt> or null if no
* such room exists.
* <p>
* @param roomName the name of the <tt>ChatRoom</tt> that we're looking for.
* @return the <tt>ChatRoom</tt> named <tt>roomName</tt> or null if no such
* room exists on the server that this provider is currently connected to.
*
* @throws OperationFailedException if an error occurs while trying to
* discover the room on the server.
* @throws OperationNotSupportedException if the server does not support
* multi user chat
*/
public ChatRoom findRoom(String roomName)
throws OperationFailedException,
OperationNotSupportedException
{
Iterator iter = existingChatRooms.iterator();
while(iter.hasNext())
{
ChatRoom elem = (ChatRoom)iter.next();
if(elem.getName().equals(roomName))
return elem;
}
return null;
}
/**
* Informs the sender of an invitation that we decline their invitation.
*
* @param invitation the invitation we are rejecting.
*/
public void rejectInvitation(ChatRoomInvitation invitation)
{
ChatRoomInvitationRejectedEvent evt =
new ChatRoomInvitationRejectedEvent(
invitation,
null,
null,
invitation.getReason(),
new Date());
Iterator iter = invitationRejectListeners.iterator();
while(iter.hasNext())
{
ChatRoomInvitationRejectionListener elem =
(ChatRoomInvitationRejectionListener)iter.next();
elem.invitationRejected(evt);
}
}
/**
* Adds a listener to invitation notifications. The listener will be fired
* anytime an invitation is received.
*
* @param listener an invitation listener.
*/
public void addInvitationListener(ChatRoomInvitationListener listener)
{
if(!invitationListeners.contains(listener))
invitationListeners.add(listener);
}
/**
* Removes <tt>listener</tt> from the list of invitation listeners
* registered to receive invitation events.
*
* @param listener the invitation listener to remove.
*/
public void removeInvitationListener(ChatRoomInvitationListener listener)
{
invitationListeners.remove(listener);
}
/**
* Adds a listener to invitation notifications. The listener will be fired
* anytime an invitation is received.
*
* @param listener an invitation listener.
*/
public void addInvitationRejectionListener(
ChatRoomInvitationRejectionListener listener)
{
if(!invitationRejectListeners.contains(listener))
invitationRejectListeners.add(listener);
}
/**
* Removes the given listener from the list of invitation listeners
* registered to receive events every time an invitation has been rejected.
*
* @param listener the invitation listener to remove.
*/
public void removeInvitationRejectionListener(
ChatRoomInvitationRejectionListener listener)
{
invitationRejectListeners.remove(listener);
}
/**
* Returns true if <tt>contact</tt> supports multi user chat sessions.
*
* @param contact reference to the contact whose support for chat rooms
* we are currently querying.
* @return a boolean indicating whether <tt>contact</tt> supports chatrooms.
*/
public boolean isMultiChatSupportedByContact(Contact contact)
{
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Indicates that a new
* {@link net.java.sip.communicator.service.protocol.ChatRoom} has been
* joined.
*
* @param event the <tt>ChatRoomJoinedEvent</tt> containing the
* <tt>ChatRoom</tt> that has been joined
*/
public void chatRoomJoined(ChatRoomJoinedEvent event)
{
joinedChatRooms.add(event.getSourceChatRoom());
existingChatRooms.add(event.getSourceChatRoom());
}
/**
* Adds a listener that will be notified of changes in our participation in
* a chat room such as us being kicked, joined, left.
*
* @param listener a local user participation listener.
*/
public void addPresenceListener(
LocalUserChatRoomPresenceListener listener)
{
if(!localUserChatRoomPresenceListeners.contains(listener))
localUserChatRoomPresenceListeners.add(listener);
}
/**
* Removes a listener that was being notified of changes in our
* participation in a room such as us being kicked, joined, left.
*
* @param listener a local user participation listener.
*/
public void removePresenceListener(
LocalUserChatRoomPresenceListener listener)
{
localUserChatRoomPresenceListeners.remove(listener);
}
void fireLocalUserChatRoomPresenceChangeEvent(
LocalUserChatRoomPresenceChangeEvent evt)
{
Iterator iter = localUserChatRoomPresenceListeners.iterator();
while(iter.hasNext())
{
LocalUserChatRoomPresenceListener elem =
(LocalUserChatRoomPresenceListener)iter.next();
elem.localUserPresenceChanged(evt);
}
}
}

@ -66,6 +66,10 @@ public MockProvider(String userName)
this.supportedOperationSets.put(
OperationSetBasicInstantMessaging.class.getName(),
mockBImOpSet);
this.supportedOperationSets.put(
OperationSetMultiUserChat.class.getName(),
new MockMultiUserChat(this));
MockOperationSetBasicTelephony mockTelphonyOpSet =
new MockOperationSetBasicTelephony(this);

@ -8,6 +8,7 @@
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.msghistory.event.*;
@ -189,4 +190,164 @@ public Collection findLastMessagesBefore(MetaContact contact, Date date, int cou
* @param listener HistorySearchProgressListener
*/
public void removeSearchProgressListener(MessageHistorySearchProgressListener listener);
/**
* Returns all the messages exchanged in the supplied
* chat room after the given date
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByStartDate(ChatRoom room, Date startDate)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room before the given date
*
* @param room The chat room
* @param endDate Date the end date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByEndDate(ChatRoom room, Date endDate)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @param keywords array of keywords
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room,
Date startDate, Date endDate, String[] keywords)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room between the given dates and having the given
* keywords
*
* @param room The chat room
* @param startDate Date the start date of the conversations
* @param endDate Date the end date of the conversations
* @param keywords array of keywords
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByPeriod(ChatRoom room, Date startDate, Date endDate,
String[] keywords, boolean caseSensitive)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied room having the given keyword
*
* @param room The Chat room
* @param keyword keyword
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeyword(ChatRoom room, String keyword)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keyword
*
* @param room The chat room
* @param keyword keyword
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
Collection findByKeyword(ChatRoom room, String keyword,
boolean caseSensitive)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
* @param keywords keyword
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeywords(ChatRoom room, String[] keywords)
throws RuntimeException;
/**
* Returns all the messages exchanged
* in the supplied chat room having the given keywords
*
* @param room The chat room
* @param keywords keyword
* @param caseSensitive is keywords search case sensitive
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findByKeywords(ChatRoom room, String[] keywords,
boolean caseSensitive)
throws RuntimeException;
/**
* Returns the supplied number of recent messages exchanged
* in the supplied chat room
*
* @param room The chat room
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findLast(ChatRoom room, int count)
throws RuntimeException;
/**
* Returns the supplied number of recent messages after the given date
* exchanged in the supplied chat room
*
* @param room The chat room
* @param date messages after date
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findFirstMessagesAfter(ChatRoom room, Date date, int count)
throws RuntimeException;
/**
* Returns the supplied number of recent messages before the given date
* exchanged in the supplied chat room
*
* @param room The chat room
* @param date messages before date
* @param count messages count
* @return Collection of MessageReceivedEvents or MessageDeliveredEvents
* @throws RuntimeException
*/
public Collection findLastMessagesBefore(ChatRoom room, Date date, int count)
throws RuntimeException;
}

@ -21,8 +21,9 @@ public interface LocalUserChatRoomPresenceListener
* Called to notify interested parties that a change in our presence in
* a chat room has occured. Changes may include us being kicked, join,
* left.
* @param evt the <tt>LocalUserChatRoomPresenceListener</tt> instance
* @param evt the <tt>LocalUserChatRoomPresenceChangeEvent</tt> instance
* containing the chat room and the type, and reason of the change
*/
public void localUserPresenceChanged(LocalUserChatRoomPresenceListener evt);
public void localUserPresenceChanged(
LocalUserChatRoomPresenceChangeEvent evt);
}

@ -34,6 +34,8 @@ public class TestMsgHistoryService
private static final Logger logger = Logger.getLogger(TestMsgHistoryService.class);
static final String TEST_CONTACT_NAME = "Mincho_Penchev";
static final String TEST_ROOM_NAME = "test_room";
/**
* The provider that we use to make a dummy server-stored contactlist
@ -46,6 +48,7 @@ public class TestMsgHistoryService
*/
public static MockPersistentPresenceOperationSet mockPresOpSet = null;
public static MockBasicInstantMessaging mockBImOpSet = null;
public static MockMultiUserChat mockMultiChat = null;
private static ServiceReference msgHistoryServiceRef = null;
public static MessageHistoryService msgHistoryService = null;
@ -81,6 +84,10 @@ public static Test suite()
new TestMsgHistoryService("writeRecords"));
suite.addTest(
new TestMsgHistoryService("readRecords"));
suite.addTest(
new TestMsgHistoryService("writeRecordsToMultiChat"));
suite.addTest(
new TestMsgHistoryService("readRecordsFromMultiChat"));
suite.addTest(
new TestMsgHistoryService("testPurgeLocalContactListCopy"));
@ -114,6 +121,10 @@ public void setupContact()
mockBImOpSet =
(MockBasicInstantMessaging) supportedOperationSets.get(
OperationSetBasicInstantMessaging.class.getName());
mockMultiChat =
(MockMultiUserChat) supportedOperationSets.get(
OperationSetMultiUserChat.class.getName());
msgHistoryServiceRef =
MsgHistoryServiceLick.bc.
@ -367,6 +378,231 @@ public void readRecords()
assertTrue("Message no found",
msgs.contains(messagesToSend[2].getContent()));
}
public void writeRecordsToMultiChat()
{
try
{
ChatRoom room = mockMultiChat.createChatRoom("test_room", null);
room.join();
// ChatRoom room = mockMultiChat.findRoom(TEST_ROOM_NAME);
// room.joinAs(TEST_CONTACT_NAME);
// First deliver message, so they are stored by the message history service
room.sendMessage(messagesToSend[0]);
this.controlDate1 = new Date();
Object lock = new Object();
synchronized (lock)
{
// wait a moment
try
{
lock.wait(200);
}
catch (InterruptedException ex)
{
}
}
room.sendMessage(messagesToSend[1]);
room.sendMessage(messagesToSend[2]);
this.controlDate2 = new Date();
synchronized (lock)
{
// wait a moment
try
{
lock.wait(200);
}
catch (InterruptedException ex)
{
}
}
room.sendMessage(messagesToSend[3]);
room.sendMessage(messagesToSend[4]);
}
catch(OperationFailedException ex)
{
fail("Failed to create room : " + ex.getMessage());
logger.error("Failed to create room", ex);
}
catch(OperationNotSupportedException ex)
{
fail("Failed to create room : " + ex.getMessage());
logger.error("Failed to create room", ex);
}
}
/**
* tests all read methods (finders)
*/
public void readRecordsFromMultiChat()
{
ChatRoom room = null;
try
{
room = mockMultiChat.findRoom(TEST_ROOM_NAME);
}catch(Exception ex)
{
fail("Cannot find room!" + ex.getMessage());
}
/**
* This matches all written messages, they are minimum 5
*/
Collection rs = msgHistoryService.findByKeyword(room, "test");
assertTrue("Nothing found findByKeyword ", !rs.isEmpty());
Vector msgs = getChatMessages(rs);
assertTrue("Messages too few - findByKeyword", msgs.size() >= 5);
/**
* Will test case sernsitive and insensitive search
*/
rs = msgHistoryService.findByKeyword(room, "Test", false);
assertTrue("Nothing found findByKeyword caseINsensitive search", !rs.isEmpty());
msgs = getChatMessages(rs);
assertTrue("Messages too few - findByKeyword", msgs.size() >= 5);
rs = msgHistoryService.findByKeyword(room, "Test", true);
assertFalse("Something found by findByKeyword casesensitive search", !rs.isEmpty());
/**
* This must match also many messages, as tests are run many times
* but the minimum is 3
*/
rs = msgHistoryService.findByEndDate(room, controlDate2);
assertTrue("Nothing found findByEndDate", !rs.isEmpty());
msgs = getChatMessages(rs);
assertTrue("Messages too few - findByEndDate", msgs.size() >= 3);
/**
* This must find also many messages but atleast one
*/
rs = msgHistoryService.findByKeywords(
room,
new String[]{"test", "word2"});
assertTrue("Nothing found findByKeywords", !rs.isEmpty());
msgs = getChatMessages(rs);
assertTrue("Messages too few - findByKeywords", msgs.size() >= 1);
/**
* Nothing to be found
*/
rs = msgHistoryService.findByKeywords(
room,
new String[]{"test1", "word2"});
assertFalse("Something found findByKeywords", !rs.isEmpty());
/**
* must find 2 messages
*/
rs = msgHistoryService.findByPeriod(
room, controlDate1, controlDate2);
assertTrue("Nothing found findByPeriod", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 2", msgs.size(), 2);
assertTrue("Message no found",
msgs.contains(messagesToSend[1].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[2].getContent()));
/**
* must find 1 record
*/
rs = msgHistoryService.findByPeriod(
room, controlDate1, controlDate2, new String[]{"word2"});
assertTrue("Nothing found findByPeriod", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 1", msgs.size(), 1);
assertTrue("Message no found",
msgs.contains(messagesToSend[1].getContent()));
/**
* must find 2 records
*/
rs = msgHistoryService.findByStartDate(room, controlDate2);
assertTrue("Nothing found findByStartDate", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 2", msgs.size(), 2);
assertTrue("Message no found",
msgs.contains(messagesToSend[3].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[4].getContent()));
/**
* Must return exactly the last 3 messages
*/
rs = msgHistoryService.findLast(room, 3);
assertTrue("Nothing found 8", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 3", msgs.size(), 3);
assertTrue("Message no found",
msgs.contains(messagesToSend[2].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[3].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[4].getContent()));
/**
* Must return exactly the 3 messages after controlDate1
*/
rs = msgHistoryService.findFirstMessagesAfter(room, controlDate1, 3);
assertTrue("Nothing found 9", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 3", msgs.size(), 3);
assertTrue("Message no found",
msgs.contains(messagesToSend[1].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[2].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[3].getContent()));
/**
* Must return exactly the 3 messages before controlDate2
*/
rs = msgHistoryService.findLastMessagesBefore(room, controlDate2, 3);
assertTrue("Nothing found 10", !rs.isEmpty());
msgs = getChatMessages(rs);
assertEquals("Messages must be 3", msgs.size(), 3);
assertTrue("Message no found",
msgs.contains(messagesToSend[0].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[1].getContent()));
assertTrue("Message no found",
msgs.contains(messagesToSend[2].getContent()));
}
/**
* Removes the locally stored contact list copy. The purpose of this is to
@ -383,7 +619,7 @@ private Vector getMessages(Collection rs)
Iterator iter = rs.iterator();
while (iter.hasNext())
{
Object item = (Object) iter.next();
Object item = iter.next();
if(item instanceof MessageDeliveredEvent)
result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent());
else
@ -393,6 +629,25 @@ private Vector getMessages(Collection rs)
return result;
}
private Vector getChatMessages(Collection rs)
{
Vector result = new Vector();
Iterator iter = rs.iterator();
while (iter.hasNext())
{
Object item = iter.next();
if(item instanceof ChatRoomMessageDeliveredEvent)
result.add(((ChatRoomMessageDeliveredEvent)item).
getMessage().getContent());
else
if(item instanceof ChatRoomMessageReceivedEvent)
result.add(((ChatRoomMessageReceivedEvent)item).
getMessage().getContent());
}
return result;
}
private void dumpResult(QueryResultSet rs)

Loading…
Cancel
Save