diff --git a/Gemfile b/Gemfile
index e3813ce4d..c2e6e3300 100644
--- a/Gemfile
+++ b/Gemfile
@@ -28,6 +28,9 @@ gem 'pubsubhubbub'
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
gem 'addressable', :require => 'addressable/uri'
gem 'em-websocket'
+gem 'thin'
+gem 'will_paginate', '3.0.pre'
+gem 'redfinger'
#File uploading
gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb
index c37a86ca7..810b850f1 100644
--- a/app/controllers/requests_controller.rb
+++ b/app/controllers/requests_controller.rb
@@ -25,7 +25,8 @@ class RequestsController < ApplicationController
end
def create
- @request = current_user.send_friend_request_to(params[:request][:destination_url])
+ url = diaspora_url(params[:request][:destination_url])
+ @request = current_user.send_friend_request_to(url)
if @request
flash[:notice] = "a friend request was sent to #{@request.destination_url}"
redirect_to requests_url
@@ -38,4 +39,8 @@ class RequestsController < ApplicationController
end
+
+ private
+
+
end
diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb
index 53ac95ccc..c0bf4a1d8 100644
--- a/app/helpers/requests_helper.rb
+++ b/app/helpers/requests_helper.rb
@@ -1,2 +1,10 @@
module RequestsHelper
+ def diaspora_url(identifier)
+ if identifier.include? '@'
+ f = Redfinger.finger(identifier)
+ identifier = f.links.each{|x| return x.href if x.rel =='http://joindiaspora.com/seed_location'}
+ end
+ identifier
+ end
+
end
diff --git a/app/views/publics/webfinger.erb b/app/views/publics/webfinger.erb
index 8ad41e0e7..bafd58acb 100644
--- a/app/views/publics/webfinger.erb
+++ b/app/views/publics/webfinger.erb
@@ -4,4 +4,5 @@
"<%=@user.url%>hcard"
+
diff --git a/spec/controllers/requests_controller_spec.rb b/spec/controllers/requests_controller_spec.rb
new file mode 100644
index 000000000..03824a70b
--- /dev/null
+++ b/spec/controllers/requests_controller_spec.rb
@@ -0,0 +1,16 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe RequestsController do
+ describe "profile" do
+ it 'should fetch the public webfinger profile on request' do
+ #post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'}
+
+ url = RequestsController.diaspora_url('http://tom.joindiasproa.com')
+ url.should == 'htto://tom.joindiaspora.com'
+
+
+ url = RequestsController.diaspora_url('tom@tom.joindiaspora.com')
+ url.should == 'http://tom.joindiaspora.com'
+ end
+ end
+end
diff --git a/spec/helpers/requests_helper_spec.rb b/spec/helpers/requests_helper_spec.rb
new file mode 100644
index 000000000..38d0d1cd4
--- /dev/null
+++ b/spec/helpers/requests_helper_spec.rb
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+include RequestsHelper
+
+describe RequestsHelper do
+ describe "profile" do
+ it 'should fetch the public webfinger profile on request' do
+ #post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'}
+
+ url = diaspora_url('http://tom.joindiaspora.com/')
+ url.should == 'http://tom.joindiaspora.com/'
+
+
+ url = diaspora_url('tom@tom.joindiaspora.com')
+ url.should == 'http://tom.joindiaspora.com/'
+ end
+ end
+end
diff --git a/spec/models/webfinger_spec.rb b/spec/models/webfinger_spec.rb
new file mode 100644
index 000000000..9969a5f38
--- /dev/null
+++ b/spec/models/webfinger_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe 'webfinger' do
+ redner_views
+ describe "profile" do
+ it 'should fetch the public webfinger profile on request' do
+
+ end
+ end
+end