diff --git a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb index 3d3d3a2..0ee2661 100644 --- a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb +++ b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb @@ -8,8 +8,9 @@ require 'json' # BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) - - #raise hub.id.inspect + if pooling_time == nil + pooling_time = 5 + end @graph = Koala::Facebook::API.new(token) initialComments = [] extractedComments = [] @@ -40,6 +41,7 @@ def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) newComments.each{|comment| puts comment noosferoComment = Comment.new + noosferoComment.title = 'hub-message-facebook' noosferoComment.source_id = hub.id noosferoComment.body = comment noosferoComment.author_id = author_id diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb index 72c19d6..13915bb 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub.rb @@ -38,26 +38,22 @@ class CommunityHubPlugin::Hub < Folder end def self.twitter_service(hub, action) - #raise hub.inspect - #if self.twitter_enabled == false author_id = 54 if action==:start thread = Thread.new { - Twurl::Stream.run(hub, author_id, self.hashtags_twitter, File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', self.proxy_url) - } unless@@twitter_thread_started + Twurl::Stream.run(hub, author_id, hub.setting[:hashtags_twitter], File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', hub.setting[:proxy_url]) + } unless@@twitter_thread_started @@twitter_thread_started = true end end def self.facebook_service(hub, action) author_id = 54 - page_id="mundoreagindo" if action==:start - #facebook_comments(page, author_id, page_id, pooling_time=5, token='CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') - thread = Thread.new { - facebook_comments(hub, author_id, self.facebook_page_id, self.pooling_time, self.facebook_access_token, self.proxy_url) + thread = Thread.new { + facebook_comments(hub, author_id, hub.setting[:facebook_page_id], hub.setting[:facebook_pooling_time], hub.setting[:facebook_access_token], hub.setting[:proxy_url]) } unless@@facebook_thread_started - @@facebook_thread_started = true + @@facebook_thread_started = true end end diff --git a/plugins/community_hub/tweeter_stream/lib/twurl/request_controller.rb b/plugins/community_hub/tweeter_stream/lib/twurl/request_controller.rb index 416cad9..ec995a9 100755 --- a/plugins/community_hub/tweeter_stream/lib/twurl/request_controller.rb +++ b/plugins/community_hub/tweeter_stream/lib/twurl/request_controller.rb @@ -23,6 +23,7 @@ module Twurl comment_text = ic.iconv("@#{parsed["user"]["name"]} " + _('said') + ": #{parsed["text"]}" + ' ')[0..-2] print "#{comment_text}\n" comment = Comment.new + comment.title = 'hub-message-twitter' comment.source_id = Stream.page.id comment.body = comment_text comment.author_id = Stream.author_id -- libgit2 0.21.2