function roninLogin(wp, isRes)
{
if ((String(wp.thread.url)).indexOf('bbspink') < 0) { return true; }
// ---- [ログイン情報] --------------------------
var userEmail = '';
var secretKey = '';
// ---- [初期認証] ------------------------------
var session = v2c.getScriptObject();
if (!session) {
var data = new java.lang.String('ID=' + userEmail + '&PW=' + secretKey);
var hr = v2c.createHttpRequest('http://a...content-available-to-author-only...k.com/ronin/?' + data);
hr.setRequestProperty('User-Agent', 'DOLIB/1.00');
hr.setRequestProperty('X-2ch-UA', 'V2C/2.11.4');
hr.setRequestProperty('Referer', 'http://a...content-available-to-author-only...k.com');
hr.setRequestProperty('Host', 'http://a...content-available-to-author-only...k.com');
session = {};
session.tt = new Date();
session.sid = String(hr.getContentsAsString()).replace(/[\r\n]/g, '');
if (session.sid.indexOf('SESSION-ID=ERROR:') >= 0) {
v2c.println('[post.js:PINKチャンネル浪人BETA] セッションの取得に失敗しました。\r\nIDとパスワードに誤りがないか確認してください。');
return false;
}
v2c.setScriptObject(session);
}
// ---- [POSTデータ作成] ------------------------
/*
var boundary = "ghj39458tu43";
function putd(boun, name, val) {
return '---' + boun + '\r\n' +
'Content-Disposition: form-data; name="' + name + '"\r\n' +
'\r\n' +
val + '\r\n';
}
var data = putd(boundary, 'bbs', wp.thread.board.key);
data += putd(boundary, 'key', wp.thread.key);
data += putd(boundary, 'sid', session.sid);
data += putd(boundary, 'FROM', wp.name);
data += putd(boundary, 'MESSAGE', wp.message);
data += putd(boundary, 'mail', wp.mail);
data += putd(boundary, 'time', '1');
data += putd(boundary, 'submit', '書き込む');
if (!isRes) {
data += putd(boundary, 'subject', wp.title);
}
data += '---' + boundary + '--\r\n';
data = new java.lang.String(data);
var buf = data.getBytes("MS932");
*/
v2c.println(session.sid);
var data = 'bbs=' + wp.thread.board.key + '&key=' + wp.thread.key + '&sid=' + session.sid + '&FROM=' + wp.name + '&MESSAGE=' + wp.message + '&mail=' + wp.mail + '&time=1&submit=書き込む';
// ---- [レスorスレ立て送信] --------------------
var hr = v2c.createHttpRequest('http://' + wp.thread.url.host + '/test/bbs.cgi?guid=ON', data);
hr.setRequestProperty('Host', wp.thread.board.url.host);
hr.setRequestProperty('Referer', wp.thread.url);
hr.setRequestProperty('User-Agent', 'Monazilla/1.00');
var responseMes = hr.getContentsAsString();
v2c.println(responseMes);
if (responseMes.indexOf('書きこみが終わりました。') >= 0) {
wp.name.text = '';
wp.mail.text = '';
wp.title.text = '';
wp.message.text = '';
java.lang.Thread.sleep(1000);
var hr = v2c.createHttpRequest('http://' + wp.thread.host + '/' + wp.thread.board.key + '/dat/' + wp.thread.key + '.dat');
var dat = hr.getContentsAsBytes();
v2c.println(dat);
if (dat) {
var th = wp.thread;
th.importDatBytes(dat);
var res = th.getRes(th.localResCount - 1);
var rl = v2c.getResLabel('書き込み');
if (rl) { res.setResLabel(rl); }
}
}
/*
var postUrl = 'http://' + wp.thread.url.host + '/test/bbs.cgi?guid=ON';
var url = new java.net.URL(postUrl);
var conn = url.openConnection();
with (conn) {
setDoOutput(true);
setRequestProperty('Host', wp.thread.board.url.host);
setRequestProperty('Referer', wp.thread.url);
setRequestProperty('User-Agent', 'Monazilla/1.00');
with (JavaImporter(java.io)) {
var dos = new DataOutputStream(getOutputStream());
dos.write(buf, 0, buf.length);
dos.flush();
dos.close();
var ins = getInputStream();
var bReader = new BufferedReader(new InputStreamReader(ins));
var responseData = null;
if (getResponseCode() == 200) {
while ((responseData = bReader.readLine()) != null) {
v2c.println(responseData);
}
}
ins.close();
}
}
*/
return false;
}