Browse Source

Merge pull request #3908 from zeroadam/OStatus-#3878

OStatus moved to src
pull/3913/head
Michael Vogel 3 years ago
committed by GitHub
parent
commit
fda48ec431
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 113 additions and 100 deletions
  1. +5
    -5
      include/Contact.php
  2. +3
    -2
      include/delivery.php
  3. +2
    -2
      include/follow.php
  4. +4
    -4
      include/items.php
  5. +2
    -2
      include/notifier.php
  6. +8
    -5
      include/pubsubpublish.php
  7. +7
    -5
      mod/dfrn_poll.php
  8. +10
    -8
      mod/salmon.php
  9. +2
    -2
      src/Protocol/DFRN.php
  10. +70
    -65
      src/Protocol/OStatus.php

+ 5
- 5
include/Contact.php View File

@ -1,5 +1,7 @@
<?php
/**
* @file include/Contact.php
*/
use Friendica\App;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -8,6 +10,7 @@ use Friendica\Database\DBM;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
// Included here for completeness, but this is a very dangerous operation.
// It is the caller's responsibility to confirm the requestor's intent and
@ -79,14 +82,11 @@ function terminate_friendship($user,$self,$contact) {
require_once 'include/datetime.php';
if ($contact['network'] === NETWORK_OSTATUS) {
require_once 'include/ostatus.php';
// create an unfollow slap
$item = array();
$item['verb'] = NAMESPACE_OSTATUS."/unfollow";
$item['follow'] = $contact["url"];
$slap = ostatus::salmon($item, $user);
$slap = OStatus::salmon($item, $user);
if ((x($contact,'notify')) && (strlen($contact['notify']))) {
require_once 'include/salmon.php';


+ 3
- 2
include/delivery.php View File

@ -1,5 +1,7 @@
<?php
/**
* @file include/delivery.php
*/
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
@ -9,7 +11,6 @@ use Friendica\Protocol\DFRN;
require_once 'include/queue_fn.php';
require_once 'include/html2plain.php';
require_once 'include/ostatus.php';
function delivery_run(&$argv, &$argc){
global $a;


+ 2
- 2
include/follow.php View File

@ -9,11 +9,11 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\PortableContact;
require_once 'include/group.php';
require_once 'include/salmon.php';
require_once 'include/ostatus.php';
require_once 'include/Photo.php';
function update_contact($id) {
@ -267,7 +267,7 @@ function new_contact($uid, $url, $interactive = false, $network = '') {
$item = array();
$item['verb'] = ACTIVITY_FOLLOW;
$item['follow'] = $contact["url"];
$slap = ostatus::salmon($item, $r[0]);
$slap = OStatus::salmon($item, $r[0]);
slapper($r[0], $contact['notify'], $slap);
}


+ 4
- 4
include/items.php View File

@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\GlobalContact;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Lock;
require_once 'include/bbcode.php';
@ -26,7 +27,6 @@ require_once 'include/text.php';
require_once 'include/email.php';
require_once 'include/threads.php';
require_once 'include/plaintext.php';
require_once 'include/ostatus.php';
require_once 'include/feed.php';
require_once 'include/Contact.php';
require_once 'mod/share.php';
@ -542,9 +542,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
/// @todo Check if this is really still needed
if ($arr['network'] == NETWORK_OSTATUS) {
if (isset($arr['plink'])) {
$arr['plink'] = ostatus::convert_href($arr['plink']);
$arr['plink'] = OStatus::convertHref($arr['plink']);
} elseif (isset($arr['uri'])) {
$arr['plink'] = ostatus::convert_href($arr['uri']);
$arr['plink'] = OStatus::convertHref($arr['uri']);
}
}
@ -1532,7 +1532,7 @@ function consume_feed($xml, $importer, &$contact, &$hub, $datedir = 0, $pass = 0
//$tempfile = tempnam(get_temppath(), "ostatus2");
//file_put_contents($tempfile, $xml);
logger("Consume OStatus messages ", LOGGER_DEBUG);
ostatus::import($xml, $importer, $contact, $hub);
OStatus::import($xml, $importer, $contact, $hub);
}
return;
}


+ 2
- 2
include/notifier.php View File

@ -6,10 +6,10 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
require_once 'include/queue_fn.php';
require_once 'include/html2plain.php';
require_once 'include/ostatus.php';
require_once 'include/salmon.php';
/*
@ -225,7 +225,7 @@ function notifier_run(&$argv, &$argc){
if (! ($mail || $fsuggest || $relocate)) {
$slap = ostatus::salmon($target_item,$owner);
$slap = OStatus::salmon($target_item, $owner);
require_once 'include/group.php';


+ 8
- 5
include/pubsubpublish.php View File

@ -1,15 +1,18 @@
<?php
/**
* @file include/pubsubpublish.php
*/
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Protocol\OStatus;
require_once('include/items.php');
require_once('include/ostatus.php');
require_once 'include/items.php';
function pubsubpublish_run(&$argv, &$argc){
function pubsubpublish_run(&$argv, &$argc)
{
global $a;
if ($argc > 1) {
@ -47,7 +50,7 @@ function handle_pubsubhubbub($id) {
logger("Generate feed of user ".$rr['nickname']." to ".$rr['callback_url']." - last updated ".$rr['last_update'], LOGGER_DEBUG);
$last_update = $rr['last_update'];
$params = ostatus::feed($a, $rr['nickname'], $last_update);
$params = OStatus::feed($a, $rr['nickname'], $last_update);
if (!$params) {
return;


+ 7
- 5
mod/dfrn_poll.php View File

@ -1,14 +1,16 @@
<?php
/**
* @file mod/dfrn_poll.php
*/
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
require_once('include/items.php');
require_once('include/auth.php');
require_once('include/ostatus.php');
require_once 'include/items.php';
require_once 'include/auth.php';
function dfrn_poll_init(App $a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
@ -25,7 +27,7 @@ function dfrn_poll_init(App $a) {
if (($a->argc > 1) && ($dfrn_id == '') && !strstr($_SERVER["HTTP_USER_AGENT"], 'Friendica')) {
$nickname = $a->argv[1];
header("Content-type: application/atom+xml");
echo ostatus::feed($a, $nickname, $last_update, 10);
echo OStatus::feed($a, $nickname, $last_update, 10);
killme();
}


+ 10
- 8
mod/salmon.php View File

@ -1,14 +1,16 @@
<?php
/**
* @file mod/salmon.php
*/
use Friendica\App;
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Protocol\OStatus;
require_once('include/salmon.php');
require_once('include/ostatus.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/follow.php');
require_once 'include/salmon.php';
require_once 'include/crypto.php';
require_once 'include/items.php';
require_once 'include/follow.php';
function salmon_return($val) {
@ -89,7 +91,7 @@ function salmon_post(App $a) {
// decode the data
$data = base64url_decode($data);
$author = ostatus::salmon_author($data,$importer);
$author = OStatus::salmonAuthor($data, $importer);
$author_link = $author["author-link"];
if(! $author_link) {
@ -190,7 +192,7 @@ function salmon_post(App $a) {
$contact_rec = ((DBM::is_result($r)) ? $r[0] : null);
ostatus::import($data,$importer,$contact_rec, $hub);
OStatus::import($data, $importer, $contact_rec, $hub);
http_status_exit(200);
}

+ 2
- 2
src/Protocol/DFRN.php View File

@ -14,12 +14,12 @@ use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Model\GlobalContact;
use Friendica\Database\DBM;
use Friendica\Protocol\OStatus;
use Friendica\Util\XML;
use dba;
use DOMDocument;
use DomXPath;
use ostatus;
require_once "include/Contact.php";
require_once "include/enotify.php";
@ -554,7 +554,7 @@ class DFRN
if ($public) {
// DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed.
ostatus::hublinks($doc, $root, $owner["nick"]);
OStatus::hublinks($doc, $root, $owner["nick"]);
$attributes = array("rel" => "salmon", "href" => System::baseUrl()."/salmon/".$owner["nick"]);
XML::add_element($doc, $root, "link", "", $attributes);


include/ostatus.php → src/Protocol/OStatus.php View File


Loading…
Cancel
Save