public boolean postThread(IThread thread) throws IllegalWriteException,
BBException {
if ((mode & READ_ONLY) == READ_ONLY) {
throw new IllegalWriteException(E_READ_ONLY);
}
WebRequest request = new PostRequest(bb.getHttpClient(), bb.getURL(),
"posting.php");
NameValuePair params[];
params = new NameValuePair[] {
new NameValuePair("subject", thread.getPrePostMessage()
.getName()),
new NameValuePair("message", thread.getPrePostMessage()
.getMessage()),
new NameValuePair("f", String.valueOf(id.getLongValue())),
new NameValuePair("mode", "newtopic"),
// checkbox : disabled new NameValuePair("disable_smilies",
// "on"),
// checkbox : disabled new NameValuePair("disable_bbcode",
// "on"),
// checkbox : disabled new NameValuePair("notify", "on"),
new NameValuePair("post", "Submit") };
request.addParameters(params);
// We seem to always have to get the response body.
try {
request.execute();
request.getResponseBodyAsString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
request.releaseConnection();
return true;
}