summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/OStatus/actions/salmon.php2
-rw-r--r--plugins/OStatus/classes/FeedSub.php2
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php18
3 files changed, 15 insertions, 7 deletions
diff --git a/plugins/OStatus/actions/salmon.php b/plugins/OStatus/actions/salmon.php
index e9d6015f4..2da9db9eb 100644
--- a/plugins/OStatus/actions/salmon.php
+++ b/plugins/OStatus/actions/salmon.php
@@ -142,7 +142,7 @@ class SalmonAction extends Action
function ensureProfile()
{
$actor = $this->act->actor;
-
+ common_log(LOG_DEBUG, "Received salmon bit: " . var_export($this->act, true));
if (empty($actor->id)) {
throw new Exception("Received a salmon slap from unidentified actor.");
}
diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php
index dc2c0b710..bf9d063fa 100644
--- a/plugins/OStatus/classes/FeedSub.php
+++ b/plugins/OStatus/classes/FeedSub.php
@@ -99,7 +99,7 @@ class FeedSub extends Memcached_DataObject
'sub_state' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
'sub_start' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
'sub_end' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
- 'last_update' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
+ 'last_update' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME,
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL,
'modified' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
}
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index e0cb467e5..319b76a66 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -328,7 +328,7 @@ class Ostatus_profile extends Memcached_DataObject
$entry->element('id', null, $id);
$entry->element('title', null, $text);
$entry->element('summary', null, $text);
- $entry->element('published', null, common_date_w3dtf(time()));
+ $entry->element('published', null, common_date_w3dtf(common_sql_now()));
$entry->element('activity:verb', null, $verb);
$entry->raw($actor->asAtomAuthor());
@@ -516,7 +516,7 @@ class Ostatus_profile extends Memcached_DataObject
throw new FeedSubException('empty feed');
}
$first = new Activity($entries->item(0), $discover->feed);
- return self::ensureActorProfile($first, $feeduri);
+ return self::ensureActorProfile($first, $feeduri, $salmonuri);
}
/**
@@ -598,13 +598,14 @@ class Ostatus_profile extends Memcached_DataObject
*
* @param Activity $activity
* @param string $feeduri if we already know the canonical feed URI!
+ * @param string $salmonuri if we already know the salmon return channel URI
* @return Ostatus_profile
*/
- public static function ensureActorProfile($activity, $feeduri=null)
+ public static function ensureActorProfile($activity, $feeduri=null, $salmonuri=null)
{
$profile = self::getActorProfile($activity);
if (!$profile) {
- $profile = self::createActorProfile($activity, $feeduri);
+ $profile = self::createActorProfile($activity, $feeduri, $salmonuri);
}
return $profile;
}
@@ -640,7 +641,7 @@ class Ostatus_profile extends Memcached_DataObject
/**
* @fixme validate stuff somewhere
*/
- protected static function createActorProfile($activity, $feeduri=null)
+ protected static function createActorProfile($activity, $feeduri=null, $salmonuri=null)
{
$actor = $activity->actor;
$homeuri = self::getActorProfileURI($activity);
@@ -674,10 +675,17 @@ class Ostatus_profile extends Memcached_DataObject
$oprofile = new Ostatus_profile();
$oprofile->uri = $homeuri;
if ($feeduri) {
+ // If we don't have these, we can look them up later.
$oprofile->feeduri = $feeduri;
+ if ($salmonuri) {
+ $oprofile->salmonuri = $salmonuri;
+ }
}
$oprofile->profile_id = $profile->id;
+ $oprofile->created = common_sql_now();
+ $oprofile->modified = common_sql_now();
+
$ok = $oprofile->insert();
if ($ok) {
$oprofile->updateAvatar($avatar);