From aaa376954f12e9db3e96ebad9cbdfa7262515ff2 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Wed, 15 Mar 2023 16:46:30 +0100 Subject: [PATCH] #166: Refactor to conform to naming convention --- .../openfire/archive/ArchiveInterceptor.java | 2 +- .../openfire/archive/ConversationEvent.java | 20 +++++++++---------- .../archive/GroupConversationInterceptor.java | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java/org/jivesoftware/openfire/archive/ArchiveInterceptor.java b/src/java/org/jivesoftware/openfire/archive/ArchiveInterceptor.java index 8611365b3..271ab6338 100644 --- a/src/java/org/jivesoftware/openfire/archive/ArchiveInterceptor.java +++ b/src/java/org/jivesoftware/openfire/archive/ArchiveInterceptor.java @@ -100,7 +100,7 @@ public void interceptPacket(Packet packet, Session session, boolean incoming, bo else if (conversationManager.isEmptyMessageArchivingEnabledFor(message)) { eventsQueue.addChatEvent(conversationManager.getConversationKey(sender, receiver), - ConversationEvent.getEmptyMessageReceivedEvent(sender, receiver, + ConversationEvent.emptyMessageReceivedEvent(sender, receiver, message.toXML(), new Date())); } diff --git a/src/java/org/jivesoftware/openfire/archive/ConversationEvent.java b/src/java/org/jivesoftware/openfire/archive/ConversationEvent.java index 509ac53ae..f4ae02b08 100644 --- a/src/java/org/jivesoftware/openfire/archive/ConversationEvent.java +++ b/src/java/org/jivesoftware/openfire/archive/ConversationEvent.java @@ -156,6 +156,16 @@ public static ConversationEvent roomMessageReceived(JID roomJID, JID user, JID r return event; } + public static ConversationEvent emptyMessageReceivedEvent(JID sender, JID receiver, String stanza, Date date) { + ConversationEvent event = new ConversationEvent(); + event.type = Type.chatMessageReceived; + event.sender = sender; + event.receiver = receiver; + event.date = date; + event.stanza=stanza; + return event; + } + private enum Type { /** * Event triggered when a room was destroyed. @@ -195,14 +205,4 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(type, date, body, stanza, sender, receiver, roomJID, user, nickname); } - - public static ConversationEvent getEmptyMessageReceivedEvent(JID sender, JID receiver, String stanza, Date date) { - ConversationEvent event = new ConversationEvent(); - event.type = Type.chatMessageReceived; - event.sender = sender; - event.receiver = receiver; - event.date = date; - event.stanza=stanza; - return event; - } } diff --git a/src/java/org/jivesoftware/openfire/archive/GroupConversationInterceptor.java b/src/java/org/jivesoftware/openfire/archive/GroupConversationInterceptor.java index a8fb4d4be..475eb18fb 100644 --- a/src/java/org/jivesoftware/openfire/archive/GroupConversationInterceptor.java +++ b/src/java/org/jivesoftware/openfire/archive/GroupConversationInterceptor.java @@ -159,7 +159,7 @@ else if (conversationManager.isEmptyMessageArchivingEnabledFor(message)) ConversationEventsQueue eventsQueue = conversationManager.getConversationEventsQueue(); eventsQueue.addGroupChatEvent(conversationManager.getRoomConversationKey(roomJID), - ConversationEvent.getEmptyMessageReceivedEvent(roomJID, user, message.toXML(), new Date())); + ConversationEvent.emptyMessageReceivedEvent(roomJID, user, message.toXML(), new Date())); } } }