diff --git a/src/i18n/monitoring_i18n.properties b/src/i18n/monitoring_i18n.properties index 9f8f8edbe..9b1a06d63 100644 --- a/src/i18n/monitoring_i18n.properties +++ b/src/i18n/monitoring_i18n.properties @@ -153,7 +153,7 @@ archive.search.results.messagecount = Message Count: archive.search.results.date = Date: archive.search.results.duration = Duration: archive.search.results.none = No conversations were found using the specified search criteria. Please change your search criteria and try again. -archive.search.results.archive_disabled = The messages in this conversation were not archived. +archive.search.results.archive_disabled = The messages in this conversation were not archived or do not have a readable body. archive.search.output.emptymessages = Output messages without body. archive.search.output.emptymessages.enable = Enable archive.search.output.save_settings=Save diff --git a/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java b/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java index 49b1a4435..652324e22 100644 --- a/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java +++ b/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java @@ -208,6 +208,7 @@ private ByteArrayOutputStream buildPDFContent(ConversationManager conversationMa document.add( new Paragraph().add(new Text("\n"))); final Paragraph messageParagraph = new Paragraph(); + boolean foundReadableMessages = false; for (ArchivedMessage message : conversation.getMessages(conversationManager)) { String time = JiveGlobals.formatTime(message.getSentDate()); @@ -266,6 +267,7 @@ private ByteArrayOutputStream buildPDFContent(ConversationManager conversationMa if (bodyLessText!=null||body!=null) { + foundReadableMessages=true; if (!message.isRoomEvent()) { /* * If body is null, we add the resource to see which device has sent the message. @@ -294,6 +296,13 @@ private ByteArrayOutputStream buildPDFContent(ConversationManager conversationMa messageParagraph.add(new Text("\n")); } } + + + if (conversation.getMessages(conversationManager).size() == 0||!foundReadableMessages) { + messageParagraph.add(new Text(LocaleUtils.getLocalizedString("archive.search.results.archive_disabled", + MonitoringConstants.NAME) )); + messageParagraph.add(new Text("\n")); + } document.add(messageParagraph); @@ -353,6 +362,7 @@ private ConversationInfo toConversationInfo(ConversationManager conversationMana info.setDate(JiveGlobals.formatDateTime(conversation.getStartDate())); info.setLastActivity(JiveGlobals.formatTime(conversation.getLastActivity())); // Create body. + boolean foundReadableMessages = false; final StringBuilder builder = new StringBuilder(); builder.append(""); for (ArchivedMessage message : conversation.getMessages(conversationManager)) { @@ -416,6 +426,7 @@ private ConversationInfo toConversationInfo(ConversationManager conversationMana if (bodyLessText!=null||body!=null) { + foundReadableMessages=true; builder.append(""); if (!message.isRoomEvent()) { builder.append(""); @@ -434,7 +445,7 @@ private ConversationInfo toConversationInfo(ConversationManager conversationMana } } - if (conversation.getMessages(conversationManager).size() == 0) { + if (conversation.getMessages(conversationManager).size() == 0||!foundReadableMessages) { builder.append("" + LocaleUtils.getLocalizedString("archive.search.results.archive_disabled", MonitoringConstants.NAME) + diff --git a/src/web/archive-search.jsp b/src/web/archive-search.jsp index 28bd961c5..2dc641114 100644 --- a/src/web/archive-search.jsp +++ b/src/web/archive-search.jsp @@ -724,6 +724,12 @@ i++; continue; } + + if (conversation.getMessages(conversationManager).size() == 0) + { + continue; + } + Map participants = getParticipants(conversation); String color = "#FFFFFF"; if (i % 2 == 0) {
").append("[").append(time).append("]").append("