diff --git a/nodes/core/social/27-twitter.html b/nodes/core/social/27-twitter.html
index 6993ee290..e95b8701f 100644
--- a/nodes/core/social/27-twitter.html
+++ b/nodes/core/social/27-twitter.html
@@ -111,10 +111,11 @@
-
+
@@ -141,7 +142,7 @@
defaults: {
twitter: {type:"twitter-credentials",required:true},
tags: {value:"",required:true},
- user: {value:"false",required:true},
+ user: {value:"public",required:true},
name: {value:""},
topic: {value:"tweets"}
},
@@ -153,6 +154,21 @@
},
labelStyle: function() {
return this.name?"node_label_italic":"";
+ },
+ oneditprepare: function() {
+ $("#node-input-user").change(function() {
+ var type = $("#node-input-user option:selected").val();
+ if (type == "user") {
+ $("#node-input-tags-label").html("User");
+ $("#node-input-tags").attr("placeholder","comma-separated @twitter handles");
+ } else {
+ $("#node-input-tags-label").html("for");
+ $("#node-input-tags").attr("placeholder","comma-separated words, @ids, #hashtags");
+ }
+
+ });
+ $("#node-input-user").change();
+
}
});
diff --git a/nodes/core/social/27-twitter.js b/nodes/core/social/27-twitter.js
index 2548349ca..326b89b09 100644
--- a/nodes/core/social/27-twitter.js
+++ b/nodes/core/social/27-twitter.js
@@ -44,10 +44,55 @@ function TwitterInNode(n) {
});
var node = this;
- if (this.tags !== "") {
+ if (this.user === "user") {
+ node.poll_ids = [];
+ node.since_ids = {};
+ var users = node.tags.split(",");
+ for (var i=0;i=0;t-=1) {
+ var tweet = cb[t];
+ var where = tweet.user.location||"";
+ var la = tweet.lang || tweet.user.lang;
+ //console.log(tweet.user.location,"=>",tweet.user.screen_name,"=>",pay);
+ var msg = { topic:node.topic+"/"+tweet.user.screen_name, payload:tweet.text, location:where, lang:la, tweet:tweet };
+ node.send(msg);
+ if (t == 0) {
+ node.since_ids[u] = tweet.id_str;
+ }
+ }
+ }
+ if (err) {
+ node.error(err);
+ }
+ });
+ },60000));
+ }
+ }());
+ }
+ } else if (this.tags !== "") {
try {
var thing = 'statuses/filter';
- if (this.user == "true") { thing = 'user'; }
+ if (this.user === "true") { thing = 'user'; }
var st = { track: [node.tags] };
var bits = node.tags.split(",");
if ((bits.length > 0) && (bits.length % 4 == 0)) {
@@ -110,6 +155,11 @@ function TwitterInNode(n) {
this.active = false;
this.stream.destroy();
}
+ if (this.poll_ids) {
+ for (var i=0;i