Commit 34e487e8 authored by Daryl Herzmann's avatar Daryl Herzmann Committed by akrherz

OF-18: Be sure to log private chats via MUC


git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11230 b35dd754-fafc-0310-a699-88a17e54d16e
parent ce3e1b75
......@@ -232,6 +232,9 @@ public class ClearspaceMUCTranscriptManager implements MUCEventListener {
}
}
public void privateMessageRecieved(JID fromJID, JID toJID, Message message) {
}
public void roomSubjectChanged(JID roomJID, JID user, String newSubject) {
if (isClearspaceRoom(roomJID) && !isRoomOwner(roomJID, user)) {
addGroupChatEvent(ClearspaceMUCTranscriptEvent.roomSubjectChanged(roomJID, user, newSubject,
......
......@@ -68,6 +68,12 @@ public class MUCEventDispatcher {
}
}
public static void privateMessageRecieved(JID toJID, JID fromJID, Message message) {
for (MUCEventListener listener : listeners) {
listener.privateMessageRecieved(toJID, fromJID, message);
}
}
public static void roomCreated(JID roomJID) {
for (MUCEventListener listener : listeners) {
listener.roomCreated(roomJID);
......
......@@ -74,6 +74,15 @@ public interface MUCEventListener {
*/
void messageReceived(JID roomJID, JID user, String nickname, Message message);
/**
* Event triggered when a room occupant sent a private message to another room user
*
* @param toJID the JID of who the message is to.
* @param fromJID the JID of who the message came from.
* @param message the message sent to user.
*/
void privateMessageRecieved(JID toJID, JID fromJID, Message message);
/**
* Event triggered when the subject of a room is changed.
*
......
......@@ -928,6 +928,11 @@ public class LocalMUCRoom implements MUCRoom {
if (occupant != null) {
packet.setFrom(senderRole.getRoleAddress());
occupant.send(packet);
if(packet instanceof Message) {
Message message = (Message) packet;
MUCEventDispatcher.privateMessageRecieved(occupant.getUserAddress(), senderRole.getUserAddress(),
message);
}
}
else {
throw new NotFoundException();
......@@ -2348,4 +2353,4 @@ public class LocalMUCRoom implements MUCRoom {
// name is unique for each one particular MUC service.
return name;
}
}
\ No newline at end of file
}
......@@ -116,6 +116,21 @@ public class GroupConversationInterceptor implements MUCEventListener, Startable
ConversationEvent.roomMessageReceived(roomJID, user, nickname, withBody ? message.getBody() : null, new Date()));
}
}
public void privateMessageRecieved(JID toJID, JID fromJID, Message message) {
if(message.getBody() != null) {
if (ClusterManager.isSeniorClusterMember()) {
conversationManager.processMessage(fromJID, toJID, message.getBody(), new Date());
}
else {
ConversationEventsQueue eventsQueue = conversationManager.getConversationEventsQueue();
eventsQueue.addChatEvent(conversationManager.getConversationKey(fromJID, toJID),
ConversationEvent.chatMessageReceived(toJID, fromJID,
conversationManager.isMessageArchivingEnabled() ? message.getBody() : null,
new Date()));
}
}
}
public void roomSubjectChanged(JID roomJID, JID user, String newSubject) {
// Do nothing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment