From 54241e82a800caed0697572025673a3a95b30aca Mon Sep 17 00:00:00 2001
From: anekos
Date: Mon, 27 Sep 2010 08:59:16 +0000
Subject: レスポンスコードをちゃんとみるようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38524 d0d07461-0603-4401-acd4-de1884942a52
---
twittperator.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
(limited to 'twittperator.js')
diff --git a/twittperator.js b/twittperator.js
index 4d8ab01..2f084e7 100755
--- a/twittperator.js
+++ b/twittperator.js
@@ -28,7 +28,7 @@ let PLUGIN_INFO =
Twittperator
Twitter Client using ChirpStream
OAuth対応Twitterクライアント
- 1.7.2
+ 1.7.3
2.3
2.4
teramako
@@ -1316,6 +1316,8 @@ let PLUGIN_INFO =
sos.write(get, get.length);
let buf = "";
+ let first = true;
+
let interval = setInterval(function() {
try {
let len = sis.available();
@@ -1341,8 +1343,18 @@ let PLUGIN_INFO =
lines[0] = buf + lines[0];
for (let [, line] in Iterator(lines.slice(0, -1))) {
try {
+ if (first) {
+ first = false;
+ let [, code] = line.match(/^\S+\s+(\d+)/);
+ if (code != '200') {
+ stop();
+ return liberator.echoerr("Twittperator: " + name + "'s response code is " + code + ".");
+ }
+ }
if (/^\s*\{/(line))
onMsg(Utils.fixStatusObject(JSON.parse(line)), line);
+ else
+ liberator.log(name + ': \n' + line);
} catch (e) { liberator.log(e); }
}
buf = lines.slice(-1)[0];
--
cgit v1.2.3