New OStatus implementation

This commit is contained in:
Michael Vogel 2016-03-30 12:43:15 +02:00
parent 4d668fac8b
commit b93e1d73a1
6 changed files with 1786 additions and 7 deletions

View file

@ -383,9 +383,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
// Converting the plink // Converting the plink
if ($arr['network'] == NETWORK_OSTATUS) { if ($arr['network'] == NETWORK_OSTATUS) {
if (isset($arr['plink'])) if (isset($arr['plink']))
$arr['plink'] = ostatus_convert_href($arr['plink']); $arr['plink'] = ostatus::convert_href($arr['plink']);
elseif (isset($arr['uri'])) elseif (isset($arr['uri']))
$arr['plink'] = ostatus_convert_href($arr['uri']); $arr['plink'] = ostatus::convert_href($arr['uri']);
} }
if(x($arr, 'gravity')) if(x($arr, 'gravity'))
@ -1243,7 +1243,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
//$tempfile = tempnam(get_temppath(), "ostatus2"); //$tempfile = tempnam(get_temppath(), "ostatus2");
//file_put_contents($tempfile, $xml); //file_put_contents($tempfile, $xml);
logger("Consume OStatus messages ", LOGGER_DEBUG); logger("Consume OStatus messages ", LOGGER_DEBUG);
ostatus_import($xml,$importer,$contact, $hub); ostatus::import($xml,$importer,$contact, $hub);
} }
return; return;
} }

View file

@ -223,7 +223,7 @@ function notifier_run(&$argv, &$argc){
if(! ($mail || $fsuggest || $relocate)) { if(! ($mail || $fsuggest || $relocate)) {
$slap = ostatus_salmon($target_item,$owner); $slap = ostatus::salmon($target_item,$owner);
require_once('include/group.php'); require_once('include/group.php');

View file

@ -12,6 +12,7 @@ require_once("include/Scrape.php");
require_once("include/follow.php"); require_once("include/follow.php");
require_once("include/api.php"); require_once("include/api.php");
require_once("mod/proxy.php"); require_once("mod/proxy.php");
require_once("include/ostatus2.php");
define('OSTATUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes define('OSTATUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
define('OSTATUS_DEFAULT_POLL_TIMEFRAME', 1440); // given in minutes define('OSTATUS_DEFAULT_POLL_TIMEFRAME', 1440); // given in minutes

1778
include/ostatus2.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ function handle_pubsubhubbub() {
logger("Generate feed for user ".$rr['nickname']." - last updated ".$rr['last_update'], LOGGER_DEBUG); logger("Generate feed for user ".$rr['nickname']." - last updated ".$rr['last_update'], LOGGER_DEBUG);
$params = ostatus_feed($a, $rr['nickname'], $rr['last_update']); $params = ostatus::feed($a, $rr['nickname'], $rr['last_update']);
$hmac_sig = hash_hmac("sha1", $params, $rr['secret']); $hmac_sig = hash_hmac("sha1", $params, $rr['secret']);
$headers = array("Content-type: application/atom+xml", $headers = array("Content-type: application/atom+xml",

View file

@ -84,7 +84,7 @@ function salmon_post(&$a) {
// decode the data // decode the data
$data = base64url_decode($data); $data = base64url_decode($data);
$author = ostatus_salmon_author($data,$importer); $author = ostatus::salmon_author($data,$importer);
$author_link = $author["author-link"]; $author_link = $author["author-link"];
if(! $author_link) { if(! $author_link) {
@ -181,7 +181,7 @@ function salmon_post(&$a) {
$contact_rec = ((count($r)) ? $r[0] : null); $contact_rec = ((count($r)) ? $r[0] : null);
ostatus_import($data,$importer,$contact_rec, $hub); ostatus::import($data,$importer,$contact_rec, $hub);
http_status_exit(200); http_status_exit(200);
} }