aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtwittperator.js33
1 files changed, 13 insertions, 20 deletions
diff --git a/twittperator.js b/twittperator.js
index 855f91e..c562772 100755
--- a/twittperator.js
+++ b/twittperator.js
@@ -1069,9 +1069,6 @@ TwitterOauth.prototype = (function() {
// ChirpUserStream
let ChirpUserStream = (function () {
-
- const JSON = Cc['@mozilla.org/dom/json;1'].getService(Ci.nsIJSON);
-
function getUserInfo () {
let host = ['http://twitter.com', 'https://twitter.com'];
let loginManager = Cc['@mozilla.org/login-manager;1'].getService(Ci.nsILoginManager);
@@ -1079,11 +1076,22 @@ let ChirpUserStream = (function () {
return login;
}
-
function extractURL (s)
let (m = s.match(/https?:\/\/[\S]+/))
(m && m[0]);
+ function stop () {
+ let prev = __context__.prev;
+
+ if (!prev)
+ return;
+
+ clearInterval(prev.interval);
+ prev.sos.close();
+ prev.sis.close();
+
+ delete __context__.prev;
+ }
function start () {
stop();
@@ -1141,7 +1149,7 @@ let ChirpUserStream = (function () {
lines[0] = buf + lines[0];
for (let [, line] in Iterator(lines.slice(0, -1))) {
try {
- onMsg(JSON.decode(line), line);
+ onMsg(JSON.parse(line), line);
} catch (e) {}
}
buf = lines.slice(-1)[0];
@@ -1157,21 +1165,6 @@ let ChirpUserStream = (function () {
};
}
-
- function stop () {
- let prev = __context__.prev;
-
- if (!prev)
- return;
-
- clearInterval(prev.interval);
- prev.sos.close();
- prev.sis.close();
-
- delete __context__.prev;
- }
-
-
function onMsg (msg, raw) {
if (msg.text) {
let talk = msg.user.screen_name + ': ' + msg.text;