throw new IllegalWriteException(E_READ_ONLY);
}
ThreadMessage msg = (ThreadMessage) message;
// FIXME assert msg.bb == bb;
assert msg.getThread() == this;
PostRequest request = new PostRequest(bb.getHttpClient(), bb.getURL(),
"newreply.php");
NameValuePair[] params = new NameValuePair[] {
new NameValuePair("emailupdate", "9999"),
new NameValuePair("rating", "0") };
request.addParameters(params);
params = new NameValuePair[] {
new NameValuePair("title", message.getName()),
new NameValuePair("message", msg.getMessage()),
new NameValuePair("iconid", "0"), new NameValuePair("s", ""),
new NameValuePair("do", "postreply"),
new NameValuePair("t", String.valueOf(id.getLongValue())) };
request.addParameters(params);
if (message.getReplyTo() != null) {
params = new NameValuePair[] { new NameValuePair("p", String
.valueOf(((ThreadMessageID) message.getReplyTo().getID())
.getLongValue())) };
request.addParameters(params);
}
params = new NameValuePair[] { new NameValuePair("posthash", ""),
new NameValuePair("poststarttime", ""),
new NameValuePair("sbutton", "Submit Reply"),
new NameValuePair("parseurl", "1"),
// checkbox : disabled new NameValuePair("disablesmilies", "1"),
};
request.addParameters(params);
try {
request.execute();
// TODO: do we have to do this?
String resp = request.getResponseBodyAsString();
Header newLocation = request.getMethod().getResponseHeader(
"Location");
if (newLocation == null) {
throw ((VBParser) bb.getParser()).createVBException(
"The message was not posted.", resp);
}