}
// TODO: Optimization: We don't need this lock probably, see Javadoc of postMessage
synchronized(mMessageManager) {
try {
Message parentMessage;
try {
parentMessage = mMessageManager.get(parser.getParentID());
}
catch (NoSuchFieldException e) {
parentMessage = null;
}
catch (NoSuchMessageException e) {
parentMessage = null;
}
// FIXME: When replying to forked threads, this code will always sent the replies to the original thread. We need to find a way
// to figure out whether the user wanted to reply to a forked thread - does NNTP pass a thread ID?
MessageURI parentMessageURI = null;
if (parentMessage != null) {
parentMessageURI = parentMessage.isThread() ? parentMessage.getURI() : parentMessage.getThreadURI();
}
final HashSet<String> boardSet = new HashSet<String>(parser.getBoards());
final OwnMessage message = mMessageManager.postMessage(parentMessageURI,
parentMessage, boardSet, parser.getReplyToBoard(), mAuthenticatedUser, parser.getTitle(), parser.getDate(), parser.getText(), null);