diff options
Diffstat (limited to 'plugins/OStatus/lib')
-rw-r--r-- | plugins/OStatus/lib/salmonaction.php | 23 | ||||
-rw-r--r-- | plugins/OStatus/lib/webfinger.php | 14 |
2 files changed, 25 insertions, 12 deletions
diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index 11c411c7d..4aba20cc4 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -173,13 +173,17 @@ class SalmonAction extends Action $html = $this->act->object->content; - $rendered = HTMLPurifier::purify($html); + $purifier = new HTMLPurifier(); + + $rendered = $purifier->purify($html); + $content = html_entity_decode(strip_tags($rendered)); $options = array('is_local' => Notice::REMOTE_OMB, 'uri' => $this->act->object->id, 'url' => $this->act->object->link, - 'rendered' => $rendered); + 'rendered' => $rendered, + 'replies' => $this->act->context->attention); if (!empty($this->act->context->location)) { $options['lat'] = $location->lat; @@ -199,12 +203,17 @@ class SalmonAction extends Action } if (!empty($this->act->time)) { - $options['created'] = common_sql_time($this->act->time); + $options['created'] = common_sql_date($this->act->time); } - return Notice::saveNew($oprofile->profile_id, - $content, - 'ostatus+salmon', - $options); + $saved = Notice::saveNew($oprofile->profile_id, + $content, + 'ostatus+salmon', + $options); + + // Record that this was saved through a validated Salmon source + // @fixme actually do the signature validation! + Ostatus_source::saveNew($saved, $oprofile, 'salmon'); + return $saved; } } diff --git a/plugins/OStatus/lib/webfinger.php b/plugins/OStatus/lib/webfinger.php index 417d54904..0386881d1 100644 --- a/plugins/OStatus/lib/webfinger.php +++ b/plugins/OStatus/lib/webfinger.php @@ -32,11 +32,16 @@ define('WEBFINGER_SERVICE_REL_VALUE', 'lrdd'); /** * Implement the webfinger protocol. */ + class Webfinger { + const PROFILEPAGE = 'http://webfinger.net/rel/profile-page'; + const UPDATESFROM = 'http://schemas.google.com/g/2010#updates-from'; + /** * Perform a webfinger lookup given an account. - */ + */ + public function lookup($id) { $id = $this->normalize($id); @@ -46,7 +51,7 @@ class Webfinger if (!$links) { return false; } - + $services = array(); foreach ($links as $link) { if ($link['template']) { @@ -64,7 +69,7 @@ class Webfinger function normalize($id) { if (substr($id, 0, 7) == 'acct://') { - return substr($id, 7); + return substr($id, 7); } else if (substr($id, 0, 5) == 'acct:') { return substr($id, 5); } @@ -86,7 +91,7 @@ class Webfinger if ($result->host != $domain) { return false; } - + $links = array(); foreach ($result->links as $link) { if ($link['rel'] == WEBFINGER_SERVICE_REL_VALUE) { @@ -140,4 +145,3 @@ class Webfinger } } - |