]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/implugin.php
Comment improvements with spl_autoload_register
[quix0rs-gnu-social.git] / lib / implugin.php
index 3eba3469fd80517704f964d910736a52789da5a7..4ee9d854663e22cd240df05d189da15b28a938b4 100644 (file)
@@ -84,7 +84,7 @@ abstract class ImPlugin extends Plugin
      *
      * @return boolean success value
      */
-    function sendNotice($screenname, $notice)
+    function sendNotice($screenname, Notice $notice)
     {
         return $this->sendMessage($screenname, $this->formatNotice($notice));
     }
@@ -370,10 +370,19 @@ abstract class ImPlugin extends Plugin
      * @return string plain-text version of the notice, with user nickname prefixed
      */
 
-    function formatNotice($notice)
+    protected function formatNotice(Notice $notice)
     {
         $profile = $notice->getProfile();
-        return $profile->nickname . ': ' . $notice->content . ' [' . $notice->id . ']';
+
+        try {
+            $parent = $notice->getParent();
+            $orig_profile = $parent->getProfile();
+            $nicknames = sprintf('%1$s => %2$s', $profile->nickname, $orig_profile->nickname);
+        } catch (Exception $e) {
+            $nicknames = $profile->nickname;
+        }
+
+        return sprintf('%1$s: %2$s [%3$u]', $nicknames, $notice->content, $notice->id);
     }
     //========================UTILITY FUNCTIONS USEFUL TO IMPLEMENTATIONS - RECEIVING ========================\