Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/codeu/chat/client/simplegui/SearchPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,25 @@ private void searchAndDisplay(ConversationSummary conversation, String searchTer
// Here we need to call a search function that returns a ListViewable object of the messages to display.
// This then replaces the conversation contents call in the for loop.

for (final Message m : clientContext.message.getConversationContents(conversation)) {
// Stubby inclusion check for search.
if (m.content.toLowerCase().contains(searchTerm.toLowerCase())) {
// Display author name if available. Otherwise display the author UUID.
final String authorName = clientContext.user.getName(m.author);
for (final ConversationSummary cs : clientContext.conversation.getConversationSummaries()) {
int first = 1;
for (final Message m : clientContext.message.getConversationContents(cs)) {
// Stubby inclusion check for search.
if (m.content.toLowerCase().contains(searchTerm.toLowerCase())) {
// Display author name if available. Otherwise display the author UUID.
if (first == 1) {
String convoTitle = cs.title;
messageListModel.addElement(convoTitle);
first = 0;
}

final String authorName = clientContext.user.getName(m.author);

final String displayString = String.format("%s: [%s]: %s",
((authorName == null) ? m.author : authorName), m.creation, m.content);
final String displayString = String.format("%s: [%s]: %s",
((authorName == null) ? m.author : authorName), m.creation, m.content);

messageListModel.addElement(displayString);
messageListModel.addElement(displayString);
}
}
}
}
Expand Down