summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-24 16:52:16 -0800
committerZach Copley <zach@status.net>2010-02-24 16:52:16 -0800
commit10884dcd49da8db1fcca3cbbef0f85869d43520e (patch)
tree7c8376ed6cea7c971faacaa6e223a670d0e6481f /plugins/OStatus/lib
parent543ff40ef62f2587cde084b03bcf2e956f52ce2f (diff)
parent5173d92895e892412e8a8c10b4e434c924593c99 (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
* 'testing' of gitorious.org:statusnet/mainline: Merge StatusNet core localization updates from 0.9.x branch Fix update_po_templates.php to support the plural and context variants of _m() in plugins Drop HTMLPurifier; we don't need its extra capabilities and we're already using htmLawed which is lighter-weight. OStatus: handle update-profile Salmon pings Revert "Updated jQuery Form Plugin from v2.17 to v2.36" OStatus: disable HTMLPurify cache unless we've configured a writable path for it.
Diffstat (limited to 'plugins/OStatus/lib')
-rw-r--r--plugins/OStatus/lib/salmonaction.php55
1 files changed, 29 insertions, 26 deletions
diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php
index 9aac2ed52..a03169101 100644
--- a/plugins/OStatus/lib/salmonaction.php
+++ b/plugins/OStatus/lib/salmonaction.php
@@ -38,11 +38,11 @@ class SalmonAction extends Action
parent::prepare($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
- $this->clientError(_('This method requires a POST.'));
+ $this->clientError(_m('This method requires a POST.'));
}
if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/atom+xml') {
- $this->clientError(_('Salmon requires application/atom+xml'));
+ $this->clientError(_m('Salmon requires application/atom+xml'));
}
$xml = file_get_contents('php://input');
@@ -76,8 +76,7 @@ class SalmonAction extends Action
{
StatusNet::setApi(true); // Send smaller error pages
- // TODO : Insert new $xml -> notice code
-
+ common_log(LOG_DEBUG, "Got a " . $this->act->verb);
if (Event::handle('StartHandleSalmon', array($this->activity))) {
switch ($this->act->verb)
{
@@ -106,8 +105,11 @@ class SalmonAction extends Action
case ActivityVerb::LEAVE:
$this->handleLeave();
break;
+ case ActivityVerb::UPDATE_PROFILE:
+ $this->handleUpdateProfile();
+ break;
default:
- throw new ClientException(_("Unimplemented."));
+ throw new ClientException(_m("Unrecognized activity type."));
}
Event::handle('EndHandleSalmon', array($this->activity));
}
@@ -115,56 +117,57 @@ class SalmonAction extends Action
function handlePost()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand posts."));
}
function handleFollow()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand follows."));
}
function handleUnfollow()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand unfollows."));
}
function handleFavorite()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand favorites."));
}
- /**
- * Remote user doesn't like one of our posts after all!
- * Confirm the post is ours, and delete a local favorite event.
- */
-
function handleUnfavorite()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand unfavorites."));
}
- /**
- * Hmmmm
- */
function handleShare()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand share events."));
}
- /**
- * Hmmmm
- */
function handleJoin()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand joins."));
+ }
+
+ function handleLeave()
+ {
+ throw new ClientException(_m("This target doesn't understand leave events."));
}
/**
- * Hmmmm
+ * Remote user sent us an update to their profile.
+ * If we already know them, accept the updates.
*/
- function handleLeave()
+ function handleUpdateProfile()
{
- throw new ClientException(_("Unimplemented!"));
+ $oprofile = Ostatus_profile::getActorProfile($this->act);
+ if ($oprofile) {
+ common_log(LOG_INFO, "Got a profile-update ping from $oprofile->uri");
+ $oprofile->updateFromActivityObject($this->act->actor);
+ } else {
+ common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->act->actor->id);
+ }
}
/**