]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Merge branch 'apinamespace' into 0.9.x
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 6fef20d6f59172a085d345445ced56adce66a8ca..77bc9872b401827057bc6b5c92fc118ead2b4fb1 100644 (file)
@@ -247,17 +247,6 @@ class OStatusPlugin extends Plugin
         return true;
     }
 
-    /**
-     * Check if we've got remote replies to send via Salmon.
-     *
-     * @fixme push webfinger lookup & sending to a background queue
-     * @fixme also detect short-form name for remote subscribees where not ambiguous
-     */
-
-    function onEndNoticeSave($notice)
-    {
-    }
-
     /**
      * Find any explicit remote mentions. Accepted forms:
      *   Webfinger: @user@example.com
@@ -492,7 +481,7 @@ class OStatusPlugin extends Plugin
      * Tell the FeedSub infrastructure whether we have any active OStatus
      * usage for the feed; if not it'll be able to garbage-collect the
      * feed subscription.
-     * 
+     *
      * @param FeedSub $feedsub
      * @param integer $count in/out
      * @return mixed hook return code
@@ -575,7 +564,9 @@ class OStatusPlugin extends Plugin
 
         $act->time    = time();
         $act->title   = _("Follow");
-        $act->content = sprintf(_("%s is now following %s."),
+        // TRANS: Success message for subscribe to user attempt through OStatus.
+        // TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name.
+        $act->content = sprintf(_("%1$s is now following %2$s."),
                                $subscriber->getBestName(),
                                $other->getBestName());
 
@@ -623,7 +614,9 @@ class OStatusPlugin extends Plugin
 
         $act->time    = time();
         $act->title   = _("Unfollow");
-        $act->content = sprintf(_("%s stopped following %s."),
+        // TRANS: Success message for unsubscribe from user attempt through OStatus.
+        // TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
+        $act->content = sprintf(_("%1$s stopped following %2$s."),
                                $profile->getBestName(),
                                $other->getBestName());
 
@@ -668,7 +661,9 @@ class OStatusPlugin extends Plugin
 
             $act->time = time();
             $act->title = _m("Join");
-            $act->content = sprintf(_m("%s has joined group %s."),
+            // TRANS: Success message for subscribe to group attempt through OStatus.
+            // TRANS: %1$s is the member name, %2$s is the subscribed group's name.
+            $act->content = sprintf(_m("%1$s has joined group %2$s."),
                                     $member->getBestName(),
                                     $oprofile->getBestName());
 
@@ -717,7 +712,9 @@ class OStatusPlugin extends Plugin
 
             $act->time = time();
             $act->title = _m("Leave");
-            $act->content = sprintf(_m("%s has left group %s."),
+            // TRANS: Success message for unsubscribe from group attempt through OStatus.
+            // TRANS: %1$s is the member name, %2$s is the unsubscribed group's name.
+            $act->content = sprintf(_m("%1$s has left group %2$s."),
                                     $member->getBestName(),
                                     $oprofile->getBestName());
 
@@ -757,7 +754,9 @@ class OStatusPlugin extends Plugin
 
         $act->time    = time();
         $act->title   = _("Favor");
-        $act->content = sprintf(_("%s marked notice %s as a favorite."),
+        // TRANS: Success message for adding a favorite notice through OStatus.
+        // TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice.
+        $act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
                                $profile->getBestName(),
                                $notice->uri);
 
@@ -801,7 +800,9 @@ class OStatusPlugin extends Plugin
                                   common_date_iso8601(time()));
         $act->time    = time();
         $act->title   = _("Disfavor");
-        $act->content = sprintf(_("%s marked notice %s as no longer a favorite."),
+        // TRANS: Success message for remove a favorite notice through OStatus.
+        // TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
+        $act->content = sprintf(_("%1$s marked notice %2$s as no longer a favorite."),
                                $profile->getBestName(),
                                $notice->uri);
 
@@ -876,7 +877,7 @@ class OStatusPlugin extends Plugin
                                              'class' => 'entity_subscribe'));
             $action->element('a', array('href' => common_local_url($target),
                                         'class' => 'entity_remote_subscribe')
-                                , _m('Remote'));
+                                , _m('Remote')); // @todo: i18n: Add translator hint for this text.
             $action->elementEnd('p');
             $action->elementEnd('div');
         }
@@ -916,6 +917,8 @@ class OStatusPlugin extends Plugin
                                   common_date_iso8601(time()));
         $act->time    = time();
         $act->title   = _m("Profile update");
+        // TRANS: Ping text for remote profile update through OStatus.
+        // TRANS: %s is user that updated their profile.
         $act->content = sprintf(_m("%s has updated their profile page."),
                                $profile->getBestName());
 
@@ -945,7 +948,7 @@ class OStatusPlugin extends Plugin
                                         array('nickname' => $profileUser->nickname));
                 $output->element('a', array('href' => $url,
                                             'class' => 'entity_remote_subscribe'),
-                                 _m('Subscribe'));
+                                 _m('Subscribe')); // @todo: i18n: Add context.
                 $output->elementEnd('li');
             }
         }
@@ -961,7 +964,7 @@ class OStatusPlugin extends Plugin
                             'homepage' => 'http://status.net/wiki/Plugin:OStatus',
                             'rawdescription' =>
                             _m('Follow people across social networks that implement '.
-                               '<a href="http://ostatus.org/">OStatus</a>.'));
+                               '<a href="http://ostatus.org/">OStatus</a>.')); // @todo i18n: Add translator hint.
 
         return true;
     }
@@ -995,4 +998,18 @@ class OStatusPlugin extends Plugin
         $feed = $oprofile->feeduri;
         return false;
     }
+
+    function onStartGetProfileFromURI($uri, &$profile) {
+
+        // XXX: do discovery here instead (OStatus_profile::ensureProfileURI($uri))
+
+        $oprofile = Ostatus_profile::staticGet('uri', $uri);
+
+        if (!empty($oprofile) && !$oprofile->isGroup()) {
+            $profile = $oprofile->localProfile();
+            return false;
+        }
+
+        return true;
+    }
 }