From 99f7e938fdfde625e47390e6cd510962bbb10a75 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 16 Jul 2010 12:42:36 -0700 Subject: [PATCH] made a pubsubhub constant --- config/app_config.yml | 3 +++ lib/common.rb | 4 ++-- lib/message_handler.rb | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config/app_config.yml b/config/app_config.yml index 526feac11..0c87b6b4c 100644 --- a/config/app_config.yml +++ b/config/app_config.yml @@ -1,11 +1,14 @@ development: debug: false socket_port: 8080 + pubsub_server: 'https://pubsubhubbub.appspot.com/' test: debug: false socket_port: 8081 + pubsub_server: 'https://pubsubhubbub.appspot.com/' production: debug: false socket_port: 8080 + pubsub_server: 'https://pubsubhubbub.appspot.com/' diff --git a/lib/common.rb b/lib/common.rb index 111db5f26..8e5732610 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -58,7 +58,7 @@ module Diaspora def push_to(recipients) - @@queue.add_hub_notification('http://pubsubhubbub.appspot.com/', User.owner.url + self.class.to_s.pluralize.underscore + '.atom') + @@queue.add_hub_notification(APP_CONFIG[:pubsub_server], User.owner.url + self.class.to_s.pluralize.underscore + '.atom') unless recipients.empty? recipients.map!{|x| x = x.url + "receive/"} @@ -132,7 +132,7 @@ module Diaspora def self.endpoints <<-XML - + XML end diff --git a/lib/message_handler.rb b/lib/message_handler.rb index ad39d746a..641627383 100644 --- a/lib/message_handler.rb +++ b/lib/message_handler.rb @@ -2,7 +2,7 @@ class MessageHandler NUM_TRIES = 3 TIMEOUT = 5 #seconds - + def initialize @queue = EM::Queue.new end @@ -18,7 +18,6 @@ class MessageHandler end def add_hub_notification(destination, feed_location) - puts "going to: #{destination}, telling it to fetch #{feed_location}" @queue.push(Message.new(:pubhub, destination, feed_location)) end @@ -33,7 +32,7 @@ class MessageHandler http.callback {send_to_seed(query, http.response); process} when :pubhub http = EventMachine::PubSubHubbub.new(query.destination).publish query.body, :timeout => TIMEOUT - http.callback { puts "boner city"; process} + http.callback { process} else raise "message is not a type I know!" end