Changeset 38252
- Timestamp:
- 08/12/10 13:02:39 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/twittperator.js
r38251 r38252 29 29 <description>Twitter Client using ChirpStream</description> 30 30 <description lang="ja">OAuth対応Twitterクライアント</description> 31 <version>1. 0.12</version>31 <version>1.1.0</version> 32 32 <minVersion>2.3</minVersion> 33 33 <maxVersion>2.4</maxVersion> … … 1204 1204 startTime = new Date(); 1205 1205 1206 let useProxy = !!setting.proxyHost; 1206 1207 let host = "chirpstream.twitter.com"; 1207 1208 let path = "/2b/user.json"; 1209 let authHeader = tw.getAuthorizationHeader("http://" + host + path); 1210 1211 if (useProxy) 1212 path = "http://" + host + path; 1208 1213 1209 1214 let get = [ 1210 "GET " + path + " HTTP/1. 1",1215 "GET " + path + " HTTP/1.0", 1211 1216 "Host: " + host, 1212 "Authorization: " + tw.getAuthorizationHeader("http://" + host + path),1217 "Authorization: " + authHeader, 1213 1218 "", 1214 1219 "" … … 1220 1225 svc.QueryInterface(Ci["nsISocketTransportService"]); 1221 1226 1222 let transport = socketService.createTransport(null, 0, host, 80, null); 1227 let transport = 1228 socketService.createTransport( 1229 null, 0, 1230 useProxy ? setting.proxyHost : host, 1231 useProxy ? parseInt(setting.proxyPort || '3128', 10) : 80, 1232 null); 1223 1233 let os = transport.openOutputStream(0, 0, 0); 1224 1234 let is = transport.openInputStream(0, 0, 0); … … 1245 1255 let data = sis.read(len); 1246 1256 let lines = data.split(/\r\n|[\r\n]/); 1247 if (lines.length > 2) {1257 if (lines.length >= 2) { 1248 1258 lines[0] = buf + lines[0]; 1249 1259 for (let [, line] in Iterator(lines.slice(0, -1))) { 1250 1260 try { 1251 liberator.log(line);1252 onMsg(Util.fixStatusObject(JSON.parse(line)), line);1261 if (/^\s*\{/(line)) 1262 onMsg(Util.fixStatusObject(JSON.parse(line)), line); 1253 1263 } catch (e) { liberator.log(e); } 1254 1264 } … … 1614 1624 action: function(arg) { 1615 1625 if (arg.match(/^.+/)) { 1616 showFollowersStatus(arg, true);1626 Twittperator.showFollowersStatus(arg, true); 1617 1627 } else { 1618 1628 Twittperator.showTwitterMentions(); … … 1723 1733 1724 1734 if (!arg) 1725 return showFollowersStatus(null, args.bang);1735 return Twittperator.showFollowersStatus(null, args.bang); 1726 1736 1727 1737 if (args.bang) { … … 1731 1741 } else { 1732 1742 if (arg.length === 0) 1733 showFollowersStatus();1743 Twittperator.showFollowersStatus(); 1734 1744 else 1735 1745 Twitter.say(arg); … … 1794 1804 historyLimit: let (v = gv.twittperator_history_limit) (v === 0 ? 0 : (v || 1000)), 1795 1805 showTLURLScheme: let (v = gv.twittperator_show_tl_with_https_url) ("http" + (v === false ? "" : "s")), 1806 proxyHost: gv.twittperator_proxy_host, 1807 proxyPort: gv.twittperator_proxy_port, 1796 1808 }); 1797 1809
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)