Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
20d0723dec
4
README
4
README
@ -43,6 +43,10 @@ on status.net is identical to the software available for download, so
|
||||
you can move back and forth between a hosted version or a version
|
||||
installed on your own servers.
|
||||
|
||||
A commercial software subscription is available from StatusNet Inc. It
|
||||
includes 24-hour technical support and developer support. More
|
||||
information at http://status.net/contact or email sales@status.net.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
|
@ -61,7 +61,7 @@ class GroupsalmonAction extends SalmonAction
|
||||
function handlePost()
|
||||
{
|
||||
// @fixme process all objects?
|
||||
switch ($this->act->objects[0]->type) {
|
||||
switch ($this->activity->objects[0]->type) {
|
||||
case ActivityObject::ARTICLE:
|
||||
case ActivityObject::BLOGENTRY:
|
||||
case ActivityObject::NOTE:
|
||||
@ -74,7 +74,7 @@ class GroupsalmonAction extends SalmonAction
|
||||
|
||||
// Notice must be to the attention of this group
|
||||
|
||||
$context = $this->act->context;
|
||||
$context = $this->activity->context;
|
||||
|
||||
if (empty($context->attention)) {
|
||||
throw new ClientException("Not to the attention of anyone.");
|
||||
|
@ -55,10 +55,10 @@ class UsersalmonAction extends SalmonAction
|
||||
*/
|
||||
function handlePost()
|
||||
{
|
||||
common_log(LOG_INFO, "Received post of '{$this->act->objects[0]->id}' from '{$this->act->actor->id}'");
|
||||
common_log(LOG_INFO, "Received post of '{$this->activity->objects[0]->id}' from '{$this->activity->actor->id}'");
|
||||
|
||||
// @fixme: process all activity objects?
|
||||
switch ($this->act->objects[0]->type) {
|
||||
switch ($this->activity->objects[0]->type) {
|
||||
case ActivityObject::ARTICLE:
|
||||
case ActivityObject::BLOGENTRY:
|
||||
case ActivityObject::NOTE:
|
||||
@ -72,7 +72,7 @@ class UsersalmonAction extends SalmonAction
|
||||
// Notice must either be a) in reply to a notice by this user
|
||||
// or b) to the attention of this user
|
||||
|
||||
$context = $this->act->context;
|
||||
$context = $this->activity->context;
|
||||
|
||||
if (!empty($context->replyToID)) {
|
||||
$notice = Notice::staticGet('uri', $context->replyToID);
|
||||
@ -92,7 +92,7 @@ class UsersalmonAction extends SalmonAction
|
||||
throw new ClientException("Not to anyone in reply to anything!");
|
||||
}
|
||||
|
||||
$existing = Notice::staticGet('uri', $this->act->objects[0]->id);
|
||||
$existing = Notice::staticGet('uri', $this->activity->objects[0]->id);
|
||||
|
||||
if (!empty($existing)) {
|
||||
common_log(LOG_ERR, "Not saving notice '{$existing->uri}'; already exists.");
|
||||
@ -143,7 +143,7 @@ class UsersalmonAction extends SalmonAction
|
||||
|
||||
function handleFavorite()
|
||||
{
|
||||
$notice = $this->getNotice($this->act->objects[0]);
|
||||
$notice = $this->getNotice($this->activity->objects[0]);
|
||||
$profile = $this->ensureProfile()->localProfile();
|
||||
|
||||
$old = Fave::pkeyGet(array('user_id' => $profile->id,
|
||||
@ -164,7 +164,7 @@ class UsersalmonAction extends SalmonAction
|
||||
*/
|
||||
function handleUnfavorite()
|
||||
{
|
||||
$notice = $this->getNotice($this->act->objects[0]);
|
||||
$notice = $this->getNotice($this->activity->objects[0]);
|
||||
$profile = $this->ensureProfile()->localProfile();
|
||||
|
||||
$fave = Fave::pkeyGet(array('user_id' => $profile->id,
|
||||
|
@ -445,10 +445,13 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
* @param DOMElement $feed for context
|
||||
* @param string $source identifier ("push" or "salmon")
|
||||
*/
|
||||
|
||||
public function processEntry($entry, $feed, $source)
|
||||
{
|
||||
$activity = new Activity($entry, $feed);
|
||||
|
||||
if (Event::handle('StartHandleFeedEntry', array($activity))) {
|
||||
|
||||
// @todo process all activity objects
|
||||
switch ($activity->objects[0]->type) {
|
||||
case ActivityObject::ARTICLE:
|
||||
@ -456,18 +459,19 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
case ActivityObject::NOTE:
|
||||
case ActivityObject::STATUS:
|
||||
case ActivityObject::COMMENT:
|
||||
case null: // Unspecified type is assumed to be a blog post; as we get from RSS.
|
||||
break;
|
||||
default:
|
||||
common_log(LOG_INFO, "Aborting processing for unrecognized activity type " . $activity->objects[0]->type);
|
||||
throw new ClientException("Can't handle that kind of post.");
|
||||
}
|
||||
|
||||
case null:
|
||||
if ($activity->verb == ActivityVerb::POST) {
|
||||
$this->processPost($activity, $source);
|
||||
} else {
|
||||
common_log(LOG_INFO, "Ignoring activity with unrecognized verb $activity->verb");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new ClientException("Can't handle that kind of post.");
|
||||
}
|
||||
|
||||
Event::handle('EndHandleFeedEntry', array($activity));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,6 @@ class SalmonAction extends Action
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
|
||||
|
||||
// Check the signature
|
||||
$salmon = new Salmon;
|
||||
if (!$salmon->verifyMagicEnv($xml)) {
|
||||
@ -59,7 +58,6 @@ class SalmonAction extends Action
|
||||
$xml = $magic_env->unfold($env);
|
||||
}
|
||||
|
||||
|
||||
$dom = DOMDocument::loadXML($xml);
|
||||
if ($dom->documentElement->namespaceURI != Activity::ATOM ||
|
||||
$dom->documentElement->localName != 'entry') {
|
||||
@ -67,7 +65,7 @@ class SalmonAction extends Action
|
||||
$this->clientError(_m('Salmon post must be an Atom entry.'));
|
||||
}
|
||||
|
||||
$this->act = new Activity($dom->documentElement);
|
||||
$this->activity = new Activity($dom->documentElement);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -79,9 +77,9 @@ class SalmonAction extends Action
|
||||
{
|
||||
StatusNet::setApi(true); // Send smaller error pages
|
||||
|
||||
common_log(LOG_DEBUG, "Got a " . $this->act->verb);
|
||||
common_log(LOG_DEBUG, "Got a " . $this->activity->verb);
|
||||
if (Event::handle('StartHandleSalmon', array($this->activity))) {
|
||||
switch ($this->act->verb)
|
||||
switch ($this->activity->verb)
|
||||
{
|
||||
case ActivityVerb::POST:
|
||||
$this->handlePost();
|
||||
@ -164,12 +162,12 @@ class SalmonAction extends Action
|
||||
*/
|
||||
function handleUpdateProfile()
|
||||
{
|
||||
$oprofile = Ostatus_profile::getActorProfile($this->act);
|
||||
$oprofile = Ostatus_profile::getActorProfile($this->activity);
|
||||
if ($oprofile) {
|
||||
common_log(LOG_INFO, "Got a profile-update ping from $oprofile->uri");
|
||||
$oprofile->updateFromActivityObject($this->act->actor);
|
||||
$oprofile->updateFromActivityObject($this->activity->actor);
|
||||
} else {
|
||||
common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->act->actor->id);
|
||||
common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->activity->actor->id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,10 +176,10 @@ class SalmonAction extends Action
|
||||
*/
|
||||
function ensureProfile()
|
||||
{
|
||||
$actor = $this->act->actor;
|
||||
$actor = $this->activity->actor;
|
||||
if (empty($actor->id)) {
|
||||
common_log(LOG_ERR, "broken actor: " . var_export($actor, true));
|
||||
common_log(LOG_ERR, "activity with no actor: " . var_export($this->act, true));
|
||||
common_log(LOG_ERR, "activity with no actor: " . var_export($this->activity, true));
|
||||
throw new Exception("Received a salmon slap from unidentified actor.");
|
||||
}
|
||||
|
||||
@ -191,6 +189,6 @@ class SalmonAction extends Action
|
||||
function saveNotice()
|
||||
{
|
||||
$oprofile = $this->ensureProfile();
|
||||
return $oprofile->processPost($this->act, 'salmon');
|
||||
return $oprofile->processPost($this->activity, 'salmon');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user