Removing connectors we won't be needing - this is probably going to break some shit.
This commit is contained in:
@@ -474,21 +474,8 @@ function get_atom_elements($feed,$item) {
|
||||
$apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info');
|
||||
if($apps && $apps[0]['attribs']['']['source']) {
|
||||
$res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source']));
|
||||
if($res['app'] === 'web')
|
||||
$res['app'] = 'OStatus';
|
||||
}
|
||||
|
||||
// base64 encoded json structure representing Diaspora signature
|
||||
|
||||
$dsig = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_signature');
|
||||
if($dsig) {
|
||||
$res['dsprsig'] = unxmlify($dsig[0]['data']);
|
||||
}
|
||||
|
||||
$dguid = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_guid');
|
||||
if($dguid)
|
||||
$res['guid'] = unxmlify($dguid[0]['data']);
|
||||
|
||||
/**
|
||||
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
|
||||
*/
|
||||
@@ -800,22 +787,11 @@ function encode_rel_links($links) {
|
||||
|
||||
function item_store($arr,$force_parent = false) {
|
||||
|
||||
// If a Diaspora signature structure was passed in, pull it out of the
|
||||
// item array and set it aside for later storage.
|
||||
|
||||
$dsprsig = null;
|
||||
if(x($arr,'dsprsig')) {
|
||||
$dsprsig = json_decode(base64_decode($arr['dsprsig']));
|
||||
unset($arr['dsprsig']);
|
||||
}
|
||||
|
||||
if(! $arr['uid']) {
|
||||
logger('item_store: no uid');
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(x($arr, 'gravity'))
|
||||
$arr['gravity'] = intval($arr['gravity']);
|
||||
elseif($arr['parent-uri'] === $arr['uri'])
|
||||
@@ -1152,15 +1128,10 @@ function tag_deliver($uid,$item_id) {
|
||||
|
||||
$link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
|
||||
|
||||
// Diaspora uses their own hardwired link URL in @-tags
|
||||
// instead of the one we supply with webfinger
|
||||
|
||||
$dlink = normalise_link($a->get_baseurl() . '/u/' . $u[0]['nickname']);
|
||||
|
||||
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
|
||||
if(link_compare($link,$mtch[1])) {
|
||||
$mention = true;
|
||||
logger('tag_deliver: mention found: ' . $mtch[2]);
|
||||
}
|
||||
@@ -3080,11 +3051,7 @@ function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
|
||||
);
|
||||
}
|
||||
|
||||
// Diaspora has different message-ids in feeds than they do
|
||||
// through the direct Diaspora protocol. If we try and use
|
||||
// the feed, we'll get duplicates. So don't.
|
||||
|
||||
if((! count($r)) || $contact['network'] === NETWORK_DIASPORA)
|
||||
if(! count($r))
|
||||
return;
|
||||
|
||||
$push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
|
||||
@@ -3194,13 +3161,6 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
|
||||
if($item['app'])
|
||||
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . xmlify($item['app']) . '" ></statusnet:notice_info>' . "\r\n";
|
||||
|
||||
if($item['guid'])
|
||||
$o .= '<dfrn:diaspora_guid>' . $item['guid'] . '</dfrn:diaspora_guid>' . "\r\n";
|
||||
|
||||
if($item['signed_text']) {
|
||||
$sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
|
||||
$o .= '<dfrn:diaspora_signature>' . xmlify($sign) . '</dfrn:diaspora_signature>' . "\r\n";
|
||||
}
|
||||
|
||||
$verb = construct_verb($item);
|
||||
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
|
||||
@@ -3610,8 +3570,6 @@ function drop_item($id,$interactive = true) {
|
||||
);
|
||||
}
|
||||
|
||||
// Add a relayable_retraction signature for Diaspora.
|
||||
store_diaspora_retract_sig($item, $a->user, $a->get_baseurl());
|
||||
}
|
||||
$drop_id = intval($item['id']);
|
||||
|
||||
@@ -3703,54 +3661,6 @@ function posted_date_widget($url,$uid,$wall) {
|
||||
}
|
||||
|
||||
|
||||
function store_diaspora_retract_sig($item, $user, $baseurl) {
|
||||
// Note that we can't add a target_author_signature
|
||||
// if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
|
||||
// the comment, that means we're the home of the post, and Diaspora will only
|
||||
// check the parent_author_signature of retractions that it doesn't have to relay further
|
||||
//
|
||||
// I don't think this function gets called for an "unlike," but I'll check anyway
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
logger('drop_item: diaspora support disabled, not storing retraction signature', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
logger('drop_item: storing diaspora retraction signature');
|
||||
|
||||
$signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
|
||||
|
||||
if(local_user() == $item['uid']) {
|
||||
|
||||
$handle = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
|
||||
$authorsig = base64_encode(rsa_sign($signed_text,$user['prvkey'],'sha256'));
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
|
||||
$item['contact-id'] // If this function gets called, drop_item() has already checked remote_user() == $item['contact-id']
|
||||
);
|
||||
if(count($r)) {
|
||||
// The below handle only works for NETWORK_DFRN. I think that's ok, because this function
|
||||
// only handles DFRN deletes
|
||||
$handle_baseurl_start = strpos($r['url'],'://') + 3;
|
||||
$handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
|
||||
$handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
|
||||
$authorsig = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($handle))
|
||||
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($item['id']),
|
||||
dbesc($signed_text),
|
||||
dbesc($authorsig),
|
||||
dbesc($handle)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function fetch_post_tags($items) {
|
||||
|
||||
$tag_finder = array();
|
||||
|
||||
Reference in New Issue
Block a user