summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <git@evanprodromou.name>2009-01-29 08:37:51 -0500
committerEvan Prodromou <git@evanprodromou.name>2009-01-29 08:37:51 -0500
commit746880e49eb3955d260835ffbc127c3a02b0f211 (patch)
tree2162463df70e6c5ff2b754f237af6e9195cdce0a
parentb6fbb9462c5087e00c6812a9e83aa49fae5403a5 (diff)
parentc7d06519f05e8013fcafd5efc44fa095b4c9e5c3 (diff)
Merge branch 'master' of evan@dev.controlyourself.ca:/var/www/trunk
-rw-r--r--actions/facebookhome.php49
-rw-r--r--lib/facebookaction.php60
2 files changed, 61 insertions, 48 deletions
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index 4eaf0b4f7..7f9c942ea 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -89,7 +89,7 @@ class FacebookhomeAction extends FacebookAction
}
}
-
+
function login()
{
@@ -232,53 +232,6 @@ class FacebookhomeAction extends FacebookAction
$this->elementEnd('div');
}
-
- function saveNewNotice()
- {
-
- $user = $this->flink->getUser();
-
- $content = $this->trimmed('status_textarea');
-
- if (!$content) {
- $this->showPage(_('No notice content!'));
- return;
- } else {
- $content_shortened = common_shorten_links($content);
-
- if (mb_strlen($content_shortened) > 140) {
- common_debug("Content = '$content_shortened'", __FILE__);
- common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
- $this->showPage(_('That\'s too long. Max notice size is 140 chars.'));
- return;
- }
- }
-
- $inter = new CommandInterpreter();
-
- $cmd = $inter->handle_command($user, $content_shortened);
-
- if ($cmd) {
-
- // XXX fix this
-
- $cmd->execute(new WebChannel());
- return;
- }
-
- $replyto = $this->trimmed('inreplyto');
-
- $notice = Notice::saveNew($user->id, $content,
- 'Facebook', 1, ($replyto == 'false') ? null : $replyto);
-
- if (is_string($notice)) {
- $this->showPage($notice);
- return;
- }
-
- common_broadcast_notice($notice);
-
- }
/**
* Generate pagination links
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index 63ac66250..bfba702e6 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -441,6 +441,66 @@ class FacebookAction extends Action
}
}
+ function updateFacebookStatus($notice)
+ {
+ $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, $this->fbuid);
+ $content = "$prefix $notice->content";
+
+ if ($this->facebook->api_client->users_hasAppPermission('status_update', $this->fbuid)) {
+ $this->facebook->api_client->users_setStatus($content, $this->fbuid, false, true);
+ }
+ }
+
+ function saveNewNotice()
+ {
+
+ $user = $this->flink->getUser();
+
+ $content = $this->trimmed('status_textarea');
+
+ if (!$content) {
+ $this->showPage(_('No notice content!'));
+ return;
+ } else {
+ $content_shortened = common_shorten_links($content);
+
+ if (mb_strlen($content_shortened) > 140) {
+ common_debug("Content = '$content_shortened'", __FILE__);
+ common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
+ $this->showPage(_('That\'s too long. Max notice size is 140 chars.'));
+ return;
+ }
+ }
+
+ $inter = new CommandInterpreter();
+
+ $cmd = $inter->handle_command($user, $content_shortened);
+
+ if ($cmd) {
+
+ // XXX fix this
+
+ $cmd->execute(new WebChannel());
+ return;
+ }
+
+ $replyto = $this->trimmed('inreplyto');
+
+ $notice = Notice::saveNew($user->id, $content,
+ 'Facebook', 1, ($replyto == 'false') ? null : $replyto);
+
+ if (is_string($notice)) {
+ $this->showPage($notice);
+ return;
+ }
+
+ common_broadcast_notice($notice);
+
+ // Also update the user's Facebook status
+ $this->updateFacebookStatus($notice);
+ $this->updateProfileBox($notice);
+
+ }
}