app/controllers/remoteusers_controller.rb in social2social-0.0.2 vs app/controllers/remoteusers_controller.rb in social2social-0.0.3
- old
+ new
@@ -1,17 +1,26 @@
class RemoteusersController < ApplicationController
before_filter :authenticate_user!
def index
if params[:slug].present?
- wfslug = params[:slug].split('@')
- a = RemoteUser.create!(:name => wfslug[0],
- :webfinger_slug => params[:slug],
- :origin_node_url => wfslug[1],
- :hub_url => Social2social.hub)
- home_feed = 'http://'+a.origin_node_url+'/api/user/'+a.name+'/home/'
- puts home_feed
- #TO-DO: I'M WORKING HERE
+ #Selecting the remote subject
+ u = RemoteSubject.find_or_create_using_wslug(params[:slug])
+
+ #Creating the tie between me and the remote subject
+ t = Tie.create!(:sender => current_user.actor,
+ :receiver => u.actor,
+ :relation_name => "friend")
+
+ #Requesting a subscription to the hub
+ t = Thread.new do
+ uri = URI.parse(Social2social.hub)
+ response = Net::HTTP::post_form(uri,{ 'hub.callback' => pshb_callback_url,
+ 'hub.mode' => "subscribe",
+ 'hub.topic' => u.home_feed_url,
+ 'hub.verify' => 'sync'})
+
+ end
end
respond_to do |format|
format.html
end
\ No newline at end of file