Skip to content

Commit

Permalink
Do not expose complete history list, make the history accessible via …
Browse files Browse the repository at this point in the history
…index - see issue 2
  • Loading branch information
pocmo committed Mar 11, 2010
1 parent 14ca3e0 commit 733ecd7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/org/yaaic/adapter/MessageListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public MessageListAdapter(Conversation conversation, Context context)
messages.add(header.renderTextView(context));
}

for (Message message : conversation.getHistory()) {
messages.add(message.renderTextView(context));
for (int i = 0; i < conversation.getHistorySize(); i++) {
messages.add(conversation.getHistoryMessage(i).renderTextView(context));
}

// XXX: We don't want to clear the buffer, we want to add only
Expand Down
17 changes: 13 additions & 4 deletions src/org/yaaic/model/Conversation.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,22 @@ public void addMessage(Message message)
}

/**
* Get channel history
* Get size of the current history
*/
public int getHistorySize()
{
return history.size();
}

/**
* Get message of the history at the given position
*
* @return
* @param position
* @return The message at the given position
*/
public List<Message> getHistory()
public Message getHistoryMessage(int position)
{
return history;
return history.get(position);
}

/**
Expand Down

0 comments on commit 733ecd7

Please sign in to comment.