]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/facebookhome.php
trac750 Add prefix string option in Facebook app for notice sync
[quix0rs-gnu-social.git] / actions / facebookhome.php
index 4e67494f0498f620835053db4d2beaeec6e55ea6..f72f08a3454b9f04ce92d3f13c62cf9800fca309 100644 (file)
@@ -70,6 +70,8 @@ class FacebookhomeAction extends FacebookAction
 
                 // XXX: Do some error handling here
 
+                $this->setDefaults();
+
                 $this->showHome($flink, _('You can now use Identi.ca from Facebook!'));
 
             } else {
@@ -80,22 +82,33 @@ class FacebookhomeAction extends FacebookAction
         $this->showLoginForm($msg);
     }
 
-    function showHome($flink, $msg)
+    function setDefaults()
     {
-        $this->show_header('Home');
+        $facebook = get_facebook();
 
-        if ($msg) {
-            common_element('fb:success', array('message' => $msg));
-        }
+        // A default prefix string for notices
+        $facebook->api_client->data_setUserPreference(1, 'dented: ');
+    }
+
+    function showHome($flink, $msg)
+    {
 
         $facebook = get_facebook();
         $fbuid = $facebook->require_login();
 
         $user = $flink->getUser();
 
-        echo $this->show_notices($user);
+        $notice = $user->getCurrentNotice();
+        update_profile_box($facebook, $fbuid, $user, $notice);
+
+
+        $this->show_header('Home');
 
-        $this->update_profile_box($facebook, $fbuid, $user);
+        if ($msg) {
+            common_element('fb:success', array('message' => $msg));
+        }
+
+        echo $this->show_notices($user);
 
         $this->show_footer();
     }