The generated XML is now valid and it seems to work.
This commit is contained in:
parent
75f1a17f7e
commit
7d7e2e74f4
|
@ -392,8 +392,8 @@ function delivery_run(&$argv, &$argc){
|
|||
continue;
|
||||
|
||||
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
|
||||
//$slaps[] = ostatus_salmon($item,$owner);
|
||||
$slaps[] = atom_entry($item,'html',null,$owner,true);
|
||||
$slaps[] = ostatus_salmon($item,$owner);
|
||||
//$slaps[] = atom_entry($item,'html',null,$owner,true);
|
||||
}
|
||||
|
||||
logger('notifier: slapdelivery: ' . $contact['name']);
|
||||
|
|
|
@ -530,8 +530,8 @@ function notifier_run(&$argv, &$argc){
|
|||
unset($photos);
|
||||
} else {
|
||||
|
||||
//$slap = ostatus_salmon($target_item,$owner);
|
||||
$slap = atom_entry($target_item,'html',null,$owner,false);
|
||||
$slap = ostatus_salmon($target_item,$owner);
|
||||
//$slap = atom_entry($target_item,'html',null,$owner,false);
|
||||
|
||||
if($followup) {
|
||||
foreach($items as $item) { // there is only one item
|
||||
|
@ -571,8 +571,8 @@ function notifier_run(&$argv, &$argc){
|
|||
$atom .= atom_entry($item,'text',null,$owner,true);
|
||||
|
||||
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
|
||||
//$slaps[] = ostatus_salmon($item,$owner);
|
||||
$slaps[] = atom_entry($item,'html',null,$owner,true);
|
||||
$slaps[] = ostatus_salmon($item,$owner);
|
||||
//$slaps[] = atom_entry($item,'html',null,$owner,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1078,11 +1078,11 @@ function ostatus_store_conversation($itemid, $conversation_url) {
|
|||
}
|
||||
|
||||
function xml_add_element($doc, $parent, $element, $value = "", $attributes = array()) {
|
||||
$element = $doc->createElement($element, $value);
|
||||
$element = $doc->createElement($element, xmlify($value));
|
||||
|
||||
foreach ($attributes AS $key => $value) {
|
||||
$attribute = $doc->createAttribute($key);
|
||||
$attribute->value = $value;
|
||||
$attribute->value = xmlify($value);
|
||||
$element->appendChild($attribute);
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ function ostatus_add_header($doc, $owner) {
|
|||
$a = get_app();
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`",
|
||||
intval($owner["user_uid"]));
|
||||
intval($owner["uid"]));
|
||||
if (!$r)
|
||||
return;
|
||||
|
||||
|
@ -1102,13 +1102,13 @@ function ostatus_add_header($doc, $owner) {
|
|||
$root = $doc->createElementNS(NS_ATOM, 'feed');
|
||||
$doc->appendChild($root);
|
||||
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:thr", NS_THR);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:georss", NS_GEORSS);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:activity", NS_ACTIVITY);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:media", NS_MEDIA);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:poco", NS_POCO);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:ostatus", NS_OSTATUS);
|
||||
$root->setAttributeNS(NS_ATOM, "xmlns:statusnet", NS_STATUSNET);
|
||||
$root->setAttribute("xmlns:thr", NS_THR);
|
||||
$root->setAttribute("xmlns:georss", NS_GEORSS);
|
||||
$root->setAttribute("xmlns:activity", NS_ACTIVITY);
|
||||
$root->setAttribute("xmlns:media", NS_MEDIA);
|
||||
$root->setAttribute("xmlns:poco", NS_POCO);
|
||||
$root->setAttribute("xmlns:ostatus", NS_OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", NS_STATUSNET);
|
||||
|
||||
$attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION);
|
||||
xml_add_element($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
|
||||
|
@ -1269,7 +1269,7 @@ function ostatus_add_author($doc, $owner, $profile) {
|
|||
}
|
||||
|
||||
xml_add_element($doc, $author, "followers", "", array("url" => $a->get_baseurl()."/viewcontacts/".$owner["nick"]));
|
||||
xml_add_element($doc, $author, "statusnet:profile_info", "", array("local_id" => $owner["user_uid"]));
|
||||
xml_add_element($doc, $author, "statusnet:profile_info", "", array("local_id" => $owner["uid"]));
|
||||
|
||||
return $author;
|
||||
}
|
||||
|
@ -1283,16 +1283,16 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) {
|
|||
} else {
|
||||
$entry = $doc->createElementNS(NS_ATOM, "entry");
|
||||
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:thr", NS_THR);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:georss", NS_GEORSS);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:activity", NS_ACTIVITY);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:media", NS_MEDIA);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:poco", NS_POCO);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:ostatus", NS_OSTATUS);
|
||||
$entry->setAttributeNS(NS_ATOM, "xmlns:statusnet", NS_STATUSNET);
|
||||
$entry->setAttribute("xmlns:thr", NS_THR);
|
||||
$entry->setAttribute("xmlns:georss", NS_GEORSS);
|
||||
$entry->setAttribute("xmlns:activity", NS_ACTIVITY);
|
||||
$entry->setAttribute("xmlns:media", NS_MEDIA);
|
||||
$entry->setAttribute("xmlns:poco", NS_POCO);
|
||||
$entry->setAttribute("xmlns:ostatus", NS_OSTATUS);
|
||||
$entry->setAttribute("xmlns:statusnet", NS_STATUSNET);
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`",
|
||||
intval($owner["user_uid"]));
|
||||
intval($owner["uid"]));
|
||||
if (!$r)
|
||||
return;
|
||||
|
||||
|
@ -1317,6 +1317,7 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) {
|
|||
$body = "[b]".$item['title']."[/b]\n\n".$body;
|
||||
|
||||
$body = bbcode($body, false, false, 7);
|
||||
|
||||
xml_add_element($doc, $entry, "content", $body, array("type" => "html"));
|
||||
|
||||
xml_add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
|
||||
|
@ -1389,7 +1390,7 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) {
|
|||
|
||||
function ostatus_feed(&$a, $owner_nick, $last_update) {
|
||||
|
||||
$r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
|
||||
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
|
||||
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||
WHERE `contact`.`self` AND `user`.`nickname` = '%s' LIMIT 1",
|
||||
dbesc($owner_nick));
|
||||
|
@ -1413,7 +1414,7 @@ function ostatus_feed(&$a, $owner_nick, $last_update) {
|
|||
AND (`item`.`owner-link` IN ('%s', '%s'))
|
||||
ORDER BY `item`.`received` DESC
|
||||
LIMIT 0, 300",
|
||||
intval($owner["user_uid"]), dbesc($check_date),
|
||||
intval($owner["uid"]), dbesc($check_date),
|
||||
dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS),
|
||||
dbesc($owner["nurl"]), dbesc(str_replace("http://", "https://", $owner["nurl"]))
|
||||
);
|
||||
|
|
|
@ -66,8 +66,6 @@ function get_salmon_key($uri,$keyhash) {
|
|||
|
||||
function slapper($owner,$url,$slap) {
|
||||
|
||||
logger('slapper called for '.$url.'. Data: ' . $slap);
|
||||
|
||||
// does contact have a salmon endpoint?
|
||||
|
||||
if(! strlen($url))
|
||||
|
@ -97,6 +95,8 @@ EOT;
|
|||
|
||||
$slap = str_replace('<entry>',$namespaces,$slap);
|
||||
|
||||
logger('slapper called for '.$url.'. Data: ' . $slap);
|
||||
|
||||
// create a magic envelope
|
||||
|
||||
$data = base64url_encode($slap);
|
||||
|
|
Loading…
Reference in a new issue