<?php
+/**
+ * @file include/ostatus.php
+ */
+
require_once("include/Contact.php");
require_once("include/threads.php");
require_once("include/html2bbcode.php");
require_once("mod/proxy.php");
require_once("include/xml.php");
+/**
+ * @brief This class contain functions for the OStatus protocol
+ *
+ */
class ostatus {
const OSTATUS_DEFAULT_POLL_INTERVAL = 30; // given in minutes
const OSTATUS_DEFAULT_POLL_TIMEFRAME = 1440; // given in minutes
const OSTATUS_DEFAULT_POLL_TIMEFRAME_MENTIONS = 14400; // given in minutes
+ /**
+ * @brief
+ *
+ * @param $xpath
+ * @param $context
+ * @param $importer
+ * @param $contact
+ * @param $onlyfetch
+ *
+ * @return
+ */
private function fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch) {
$author = array();
return($author);
}
+ /**
+ * @brief
+ *
+ * @param $xml
+ * @param $importer
+ *
+ * @return
+ */
public static function salmon_author($xml, $importer) {
if ($xml == "")
}
}
+ /**
+ * @brief
+ *
+ * @param $xml
+ * @param $importer
+ * @param $contact
+ * @param $hub
+ *
+ * @return
+ */
public static function import($xml,$importer,&$contact, &$hub) {
logger("Import OStatus message", LOGGER_DEBUG);
}
}
+ /**
+ * @brief
+ *
+ * @param $href
+ *
+ * @return
+ */
public static function convert_href($href) {
$elements = explode(":",$href);
return $href;
}
+ /**
+ * @brief
+ *
+ * @param $mentions
+ * @param $override
+ *
+ * @return
+ */
public static function check_conversations($mentions = false, $override = false) {
$last = get_config('system','ostatus_last_poll');
return $details;
}
+ /**
+ * @brief
+ *
+ * @param $conversation_url
+ * @param $uid
+ * @param $item
+ *
+ * @return
+ */
private function completion($conversation_url, $uid, $item = array(), $self = "") {
return($item_stored);
}
+ /**
+ * @brief
+ *
+ * @param $itemid
+ * @param $conversation_url
+ *
+ * @return
+ */
private function store_conversation($itemid, $conversation_url) {
$conversation_url = self::convert_href($conversation_url);
}
}
+ /**
+ * @brief
+ *
+ * @param $item
+ *
+ * @return
+ */
private function get_reshared_guid($item) {
$body = trim($item["body"]);
return $guid;
}
+ /**
+ * @brief
+ *
+ * @param $body
+ *
+ * @return
+ */
private function format_picture_post($body) {
$siteinfo = get_attached_data($body);
return $body;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $owner
+ *
+ * @return
+ */
private function add_header($doc, $owner) {
$a = get_app();
return $root;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $root
+ *
+ * @return
+ */
public static function hublinks($doc, $root) {
$hub = get_config('system','huburl');
}
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $root
+ * @param $item
+ *
+ * @return
+ */
private function get_attachment($doc, $root, $item) {
$o = "";
$siteinfo = get_attached_data($item["body"]);
}
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $owner
+ *
+ * @return
+ */
private function add_author($doc, $owner) {
$r = q("SELECT `homepage` FROM `profile` WHERE `uid` = %d AND `is-default` LIMIT 1", intval($owner["uid"]));
*
*/
+ /**
+ * @brief
+ *
+ * @param $item
+ *
+ * @return
+ */
function construct_verb($item) {
if ($item['verb'])
return $item['verb'];
return ACTIVITY_POST;
}
+ /**
+ * @brief
+ *
+ * @param $item
+ *
+ * @return
+ */
function construct_objecttype($item) {
if (in_array($item['object-type'], array(ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT)))
return $item['object-type'];
return ACTIVITY_OBJ_NOTE;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $item
+ * @param $owner
+ * @param $toplevel
+ *
+ * @return
+ */
private function entry($doc, $item, $owner, $toplevel = false) {
$repeated_guid = self::get_reshared_guid($item);
if ($repeated_guid != "")
return self::note_entry($doc, $item, $owner, $toplevel);
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $contact
+ *
+ * @return
+ */
private function source_entry($doc, $contact) {
$source = $doc->createElement("source");
xml::add_element($doc, $source, "id", $contact["poll"]);
return $source;
}
+ /**
+ * @brief
+ *
+ * @param $url
+ * @param $owner
+ *
+ * @return
+ */
private function contact_entry($url, $owner) {
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` IN (0, %d) ORDER BY `uid` DESC LIMIT 1",
return $contact;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $item
+ * @param $owner
+ * @param $repeated_guid
+ * @param $toplevel
+ *
+ * @return
+ */
private function reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel) {
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
$as_object = $doc->createElement("activity:object");
-// ostatusWaEeYs
-// ostatusogu9zg - besser
xml::add_element($doc, $as_object, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA."activity");
self::entry_content($doc, $as_object, $repeated_item, $owner, "", "", false);
return $entry;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $item
+ * @param $owner
+ * @param $toplevel
+ *
+ * @return
+ */
private function like_entry($doc, $item, $owner, $toplevel) {
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
return $entry;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $item
+ * @param $owner
+ * @param $toplevel
+ *
+ * @return
+ */
private function note_entry($doc, $item, $owner, $toplevel) {
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
return $entry;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $entry
+ * @param $owner
+ * @param $toplevel
+ *
+ * @return
+ */
private function entry_header($doc, &$entry, $owner, $toplevel) {
if (!$toplevel) {
$entry = $doc->createElement("entry");
return $title;
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $entry
+ * @param $item
+ * @param $owner
+ * @param $title
+ * @param $verb
+ * @param $complete
+ *
+ * @return
+ */
private function entry_content($doc, $entry, $item, $owner, $title, $verb = "", $complete = true) {
if ($verb == "")
xml::add_element($doc, $entry, "updated", datetime_convert("UTC","UTC",$item["edited"]."+00:00",ATOM_TIME));
}
+ /**
+ * @brief
+ *
+ * @param $doc
+ * @param $entry
+ * @param $item
+ * @param $owner
+ * @param $complete
+ *
+ * @return
+ */
private function entry_footer($doc, $entry, $item, $owner, $complete = true) {
$mentioned = array();
}
}
+ /**
+ * @brief
+ *
+ * @param $a
+ * @param $owner_nick
+ * @param $last_update
+ *
+ * @return
+ */
public static function feed(&$a, $owner_nick, $last_update) {
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
return(trim($doc->saveXML()));
}
+ /**
+ * @brief
+ *
+ * @param $item
+ * @param $owner
+ *
+ * @return
+ */
public static function salmon($item,$owner) {
$doc = new DOMDocument('1.0', 'utf-8');