]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
OStatus: use 'profile' consistently as param on ostatussub and ostatusinit to help...
authorBrion Vibber <brion@pobox.com>
Mon, 22 Feb 2010 18:03:34 +0000 (10:03 -0800)
committerBrion Vibber <brion@pobox.com>
Mon, 22 Feb 2010 18:03:34 +0000 (10:03 -0800)
plugins/OStatus/actions/ostatusinit.php
plugins/OStatus/js/ostatus.js

index abd8cb5419a81b323df83b3df7c5d970f3f17350..3f2f6368f6038b94092e8fc0090fd8cfa4c5e18f 100644 (file)
@@ -29,7 +29,7 @@ class OStatusInitAction extends Action
 {
 
     var $nickname;
-    var $acct;
+    var $profile;
     var $err;
 
     function prepare($args)
@@ -41,8 +41,11 @@ class OStatusInitAction extends Action
             return false;
         }
 
-        $this->nickname    = $this->trimmed('nickname');
-        $this->acct = $this->trimmed('acct');
+        // Local user the remote wants to subscribe to
+        $this->nickname = $this->trimmed('nickname');
+        
+        // Webfinger or profile URL of the remote user
+        $this->profile = $this->trimmed('profile');
 
         return true;
     }
@@ -100,7 +103,7 @@ class OStatusInitAction extends Action
                      _m('Nickname of the user you want to follow'));
         $this->elementEnd('li');
         $this->elementStart('li', array('id' => 'ostatus_profile'));
-        $this->input('acct', _m('Profile Account'), $this->acct,
+        $this->input('profile', _m('Profile Account'), $this->profile,
                      _m('Your account id (i.e. user@identi.ca)'));
         $this->elementEnd('li');
         $this->elementEnd('ul');
@@ -112,15 +115,17 @@ class OStatusInitAction extends Action
     function ostatusConnect()
     {
         $opts = array('allowed_schemes' => array('http', 'https', 'acct'));
-        if (Validate::uri($this->acct, $opts)) {
-            $bits = parse_url($this->acct);
+        if (Validate::uri($this->profile, $opts)) {
+            $bits = parse_url($this->profile);
             if ($bits['scheme'] == 'acct') {
                 $this->connectWebfinger($bits['path']);
             } else {
-                $this->connectProfile($this->acct);
+                $this->connectProfile($this->profile);
             }
-        } elseif (strpos($this->acct, '@') !== false) {
-            $this->connectWebfinger($this->acct);
+        } elseif (strpos($this->profile, '@') !== false) {
+            $this->connectWebfinger($this->profile);
+        } else {
+            $this->clientError(_m("Must provide a remote profile."));
         }
     }
 
@@ -140,12 +145,12 @@ class OStatusInitAction extends Action
                 $target_profile = common_local_url('userbyid', array('id' => $user->id));
 
                 $url = $w->applyTemplate($link['template'], $target_profile);
-
+                common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
                 common_redirect($url, 303);
             }
 
         }
-
+        $this->clientError(_m("Couldn't confirm remote profile address."));
     }
 
     function connectProfile($subscriber_profile)
@@ -157,6 +162,7 @@ class OStatusInitAction extends Action
         $suburl = preg_replace('!^(.*)/(.*?)$!', '$1/main/ostatussub', $subscriber_profile);
         $suburl .= '?profile=' . urlencode($target_profile);
 
+        common_log(LOG_INFO, "Sending remote subscriber $subscriber_profile to $suburl");
         common_redirect($suburl, 303);
     }
 
index 4b4c329102cc82d14f298ed7206d19b23e06ac11..0daeb1a8b03cfc35f651f239e9b96199820aa799 100644 (file)
@@ -40,7 +40,6 @@ SN.U.DialogBox = {
                             return false;
                         });
 
-                        form.find('#acct').focus();
                         form.find('#profile').focus();
                     }