diff --git a/src/i18n/monitoring_i18n.properties b/src/i18n/monitoring_i18n.properties index 72bf095af..78fbfe957 100644 --- a/src/i18n/monitoring_i18n.properties +++ b/src/i18n/monitoring_i18n.properties @@ -151,7 +151,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 5eba714ba..ca21b94d8 100644 --- a/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java +++ b/src/java/org/jivesoftware/openfire/archive/ConversationUtils.java @@ -213,6 +213,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()); @@ -271,6 +272,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. @@ -299,6 +301,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); @@ -358,6 +367,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("
").append("[").append(time).append("]").append(" | "); @@ -439,7 +450,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 c7515d24e..d65afd25f 100644 --- a/src/web/archive-search.jsp +++ b/src/web/archive-search.jsp @@ -745,6 +745,12 @@ i++; continue; } + + if (conversation.getMessages(conversationManager).size() == 0) + { + continue; + } + Map