final WoTMessageManager messageManager = mFreetalk.getMessageManager();
synchronized(messageManager) {
for(final MessageList.MessageReference ref : messageManager.getDownloadableMessagesSortedByDate(mBoard)) {
MessageFetchFailedMarker failureMarker = null;
int failedFetches;
try {
failureMarker = messageManager.getMessageFetchFailedMarker(ref);
failedFetches = failureMarker.getNumberOfRetries();
} catch(NoSuchFetchFailedMarkerException e) {
if(ref.wasMessageDownloaded())
continue; // We are the unfetched messages page, don't display fetched ones
failedFetches = 0;
}
String authorText;
String authorScore;
// Author related stuff
{
Identity author = null;
// TODO: Use a colored "unknown" if the author/score is unknown
// TODO: Use a special color if author == yourself
authorText = "?"; // TODO: l10n
authorScore = "?";
try {
author = ref.getMessageList().getAuthor();
authorText = author.getShortestUniqueName();
// TODO: Get rid of the cast somehow, we should maybe call this WoTBoardPage :|
final int score = ((WoTOwnIdentity)mOwnIdentity).getScoreFor((WoTIdentity)author);
if (score == Integer.MAX_VALUE)
authorScore = "-"; // TODO: l10n
else
authorScore = Integer.toString(score);
} catch(NotInTrustTreeException e) {
authorScore = l10n().getString("Common.WebOfTrust.ScoreNull");
} catch(Exception e) {
Logger.error(this, "getScoreFor() failed", e);
}
}
row = table.addChild("tr", "class", "message-row");
/* URI */
row.addChild("td", "class", "uri", ref.getURI().toString());
/* Author */
row.addChild("td", "class", "author-name", authorText);
/* Trust */
row.addChild("td", "class", "author-score", authorScore);
/* Date */
row.addChild("td", "class", "date", dateFormat.format(ref.getCreationDate()));
/* Fetched fail count */
row.addChild("td", "class", "failed-fetches", Integer.toString(failedFetches));
/* Last fail reason. TODO: l10n */
row.addChild("td", "class", "failure-reason", failureMarker == null ? "-" : failureMarker.getReason().toString());
}
}
}