diff options
author | anekos | 2010-09-27 08:59:16 +0000 |
---|---|---|
committer | anekos | 2010-09-27 08:59:16 +0000 |
commit | 54241e82a800caed0697572025673a3a95b30aca (patch) | |
tree | c0bae1127ef508e54ef91fad618ab7378134e546 | |
parent | 5bd9290fba5ae1dead92c48c3b61c648bc276116 (diff) | |
download | vimperator-plugins-54241e82a800caed0697572025673a3a95b30aca.tar.bz2 |
レスポンスコードをちゃんとみるようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38524 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-x | twittperator.js | 14 |
1 files changed, 13 insertions, 1 deletions
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 = <name>Twittperator</name> <description>Twitter Client using ChirpStream</description> <description lang="ja">OAuth対応Twitterクライアント</description> - <version>1.7.2</version> + <version>1.7.3</version> <minVersion>2.3</minVersion> <maxVersion>2.4</maxVersion> <author mail="teramako@gmail.com" homepage="http://d.hatena.ne.jp/teramako/">teramako</author> @@ -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]; |