}
elseif($contact['network'] === NETWORK_DIASPORA) {
require_once('include/diaspora.php');
- diaspora::send_unshare($user,$contact);
+ Diaspora::send_unshare($user,$contact);
}
elseif($contact['network'] === NETWORK_DFRN) {
require_once('include/dfrn.php');
function api_share_as_retweet(&$item) {
$body = trim($item["body"]);
- if (diaspora::is_reshare($body, false)===false) {
+ if (Diaspora::is_reshare($body, false)===false) {
return false;
}
$networkname = str_replace($search,$replace,$s);
- if (($s == NETWORK_DIASPORA) AND ($profile != "") AND diaspora::is_redmatrix($profile)) {
+ if (($s == NETWORK_DIASPORA) AND ($profile != "") AND Diaspora::is_redmatrix($profile)) {
$networkname = t("Hubzilla/Redmatrix");
$r = q("SELECT `gserver`.`platform` FROM `gcontact`
break;
if ($mail) {
- diaspora::send_mail($item,$owner,$contact);
+ Diaspora::send_mail($item,$owner,$contact);
break;
}
if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
// top-level retraction
logger('diaspora retract: '.$loc);
- diaspora::send_retraction($target_item,$owner,$contact,$public_message);
+ Diaspora::send_retraction($target_item,$owner,$contact,$public_message);
break;
} elseif ($followup) {
// send comments and likes to owner to relay
logger('diaspora followup: '.$loc);
- diaspora::send_followup($target_item,$owner,$contact,$public_message);
+ Diaspora::send_followup($target_item,$owner,$contact,$public_message);
break;
} elseif ($target_item['uri'] !== $target_item['parent-uri']) {
// we are the relay - send comments, likes and relayable_retractions to our conversants
logger('diaspora relay: '.$loc);
- diaspora::send_relay($target_item,$owner,$contact,$public_message);
+ Diaspora::send_relay($target_item,$owner,$contact,$public_message);
break;
} elseif ($top_level && !$walltowall) {
// currently no workable solution for sending walltowall
logger('diaspora status: '.$loc);
- diaspora::send_status($target_item,$owner,$contact,$public_message);
+ Diaspora::send_status($target_item,$owner,$contact,$public_message);
break;
}
* @brief This class contain functions to create and send Diaspora XML files
*
*/
-class diaspora {
+class Diaspora {
/**
* @brief Return a list of relay servers
// This will often be different with relayed messages (for example "like" and "comment")
$sender = $msg["author"];
- if (!diaspora::valid_posting($msg, $fields)) {
+ if (!self::valid_posting($msg, $fields)) {
logger("Invalid posting");
return false;
}
$b64url_data = base64url_encode($msg);
$data = str_replace(array("\n", "\r", " ", "\t"), array("", "", "", ""), $b64url_data);
- $key_id = base64url_encode(diaspora::my_handle($user));
+ $key_id = base64url_encode(self::my_handle($user));
$type = "application/xml";
$encoding = "base64url";
$alg = "RSA-SHA256";
*/
public static function send_status($item, $owner, $contact, $public_batch = false) {
- $status = diaspora::build_status($item, $owner);
+ $status = self::build_status($item, $owner);
return self::build_and_transmit($owner, $contact, $status["type"], $status["message"], $public_batch, $item["guid"]);
}
}
if($contact['network'] == NETWORK_DIASPORA) {
require_once('include/diaspora.php');
- $ret = diaspora::send_share($a->user,$contact);
+ $ret = Diaspora::send_share($a->user,$contact);
logger('share returns: '.$ret);
}
}
// Save the author information for the like in case we need to relay to Diaspora
- diaspora::store_like_signature($contact, $post_id);
+ Diaspora::store_like_signature($contact, $post_id);
$arr['id'] = $post_id;
if($public_message) {
if (!$followup)
- $r0 = diaspora::relay_list();
+ $r0 = Diaspora::relay_list();
else
$r0 = array();
require_once('include/diaspora.php');
function profile_change() {
- diaspora::send_profile(local_user());
+ Diaspora::send_profile(local_user());
}
case NETWORK_DIASPORA:
if($contact['notify']) {
logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
- $deliver_status = diaspora::transmit($owner,$contact,$data,$public,true);
+ $deliver_status = Diaspora::transmit($owner,$contact,$data,$public,true);
if($deliver_status == (-1)) {
update_queue_time($q_item['id']);
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
require_once('include/diaspora.php');
- $ret = diaspora::send_share($user[0],$r[0]);
+ $ret = Diaspora::send_share($user[0],$r[0]);
logger('share returns: ' . $ret);
}
}
$user = $r[0];
- $status = diaspora::build_status($item[0], $user);
- $xml = diaspora::build_post_xml($status["type"], $status["message"]);
+ $status = Diaspora::build_status($item[0], $user);
+ $xml = Diaspora::build_post_xml($status["type"], $status["message"]);
// Send the envelope
header("Content-Type: application/magic-envelope+xml; charset=utf-8");
- echo diaspora::build_magic_envelope($xml, $user);
+ echo Diaspora::build_magic_envelope($xml, $user);
killme();
}
// Store the comment signature information in case we need to relay to Diaspora
- diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
+ Diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
} else {
$parent = $post_id;
}
$user = $r[0];
- $status = diaspora::build_status($item[0], $user);
- $xml = diaspora::build_post_xml($status["type"], $status["message"]);
+ $status = Diaspora::build_status($item[0], $user);
+ $xml = Diaspora::build_post_xml($status["type"], $status["message"]);
header("Content-Type: application/xml; charset=utf-8");
echo $xml;
logger('mod-diaspora: message is okay', LOGGER_DEBUG);
- $msg = diaspora::decode($importer,$xml);
+ $msg = Diaspora::decode($importer,$xml);
logger('mod-diaspora: decoded', LOGGER_DEBUG);
$ret = 0;
if($public) {
- diaspora::dispatch_public($msg);
+ Diaspora::dispatch_public($msg);
} else {
- $ret = diaspora::dispatch($importer,$msg);
+ $ret = Diaspora::dispatch($importer,$msg);
}
http_status_exit(($ret) ? $ret : 200);
// Diaspora isn't able to do likes on comments - but red does
if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment') AND
- !diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"]))
+ !Diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"]))
unset($buttons["like"]);
// Diaspora doesn't has multithreaded comments