more diaspora stuff - most of the basic bits are there except queueing and physical delivery (I'm keeping delivery turned off until some of the bugs are fixed so we don't cause inifinite loops or network meltdowns) - now it's just a matter of going through and methodically finding all the bugs
This commit is contained in:
parent
eb8f194419
commit
6e99848043
@ -153,9 +153,9 @@ function diaspora_process_outbound($arr) {
|
||||
if($arr['walltowall'])
|
||||
return;
|
||||
|
||||
if($arr['recipients']) {
|
||||
if($arr['env_recips']) {
|
||||
$r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_url = '%s'
|
||||
and xchan_hash in (" . implode(',',$arr['recipients']) . ")
|
||||
and xchan_hash in (" . implode(',',$arr['env_recips']) . ")
|
||||
and xchan_network in ('diaspora', 'friendica-over-diaspora') ",
|
||||
dbesc($arr['hub']['hubloc_url'])
|
||||
);
|
||||
@ -228,13 +228,13 @@ function diaspora_process_outbound($arr) {
|
||||
diaspora_send_retraction($arr['target_item'],$arr['channel'],$contact,true);
|
||||
return;
|
||||
}
|
||||
elseif($arr['target_item']['mid'] !== $mid['target_item']['parent_mid']) {
|
||||
elseif($arr['target_item']['mid'] !== $arr['target_item']['parent_mid']) {
|
||||
// we are the relay - send comments, likes and relayable_retractions to our conversants
|
||||
logger('delivery: diaspora relay: ' . $loc);
|
||||
diaspora_send_relay($arr['target_item'],$arr['channel'],$contact,true);
|
||||
return;
|
||||
}
|
||||
elseif(($arr['top_level_post']) && (! $arr['walltowall'])) {
|
||||
elseif($arr['top_level_post']) {
|
||||
// currently no workable solution for sending walltowall
|
||||
logger('delivery: diaspora status: ' . $loc);
|
||||
diaspora_send_status($arr['target_item'],$arr['channel'],$contact,true);
|
||||
@ -2241,12 +2241,38 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
}
|
||||
*/
|
||||
|
||||
//if(strlen($title))
|
||||
// $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;
|
||||
|
||||
$body = str_ireplace("[quote", "\n\n[quote", $body);
|
||||
$body = str_ireplace("[/quote]", "[/quote]\n\n", $body);
|
||||
|
||||
// strip bookmark indicators
|
||||
|
||||
$body = preg_replace('/\#\^\[([zu])rl/i', '[$1rl', $body);
|
||||
$body = preg_replace('/\#\^http/i', 'http', $body);
|
||||
|
||||
// protect tags and mentions from hijacking
|
||||
|
||||
if(! intval(get_pconfig($owner['channel_id'],'system','allow_tag_hijacking'))) {
|
||||
$new_tag = html_entity_decode('⋕',ENT_COMPAT,'UTF-8');
|
||||
$new_mention = html_entity_decode('@',ENT_COMPAT,'UTF-8');
|
||||
|
||||
// #-tags
|
||||
$body = preg_replace('/\#\[url/i', $new_tag . '[url', $body);
|
||||
$body = preg_replace('/\#\[zrl/i', $new_tag . '[zrl', $body);
|
||||
// @-mentions
|
||||
$body = preg_replace('/\@\[url/i', $new_mention . '[url', $body);
|
||||
$body = preg_replace('/\@\[zrl/i', $new_mention . '[zrl', $body);
|
||||
}
|
||||
|
||||
// remove multiple newlines
|
||||
do {
|
||||
$oldbody = $body;
|
||||
$body = str_replace("\n\n\n", "\n\n", $body);
|
||||
} while ($oldbody != $body);
|
||||
|
||||
|
||||
// convert to markdown
|
||||
$body = xmlify(html_entity_decode(bb2diaspora($body)));
|
||||
//$body = bb2diaspora($body);
|
||||
|
||||
// Adding the title
|
||||
if(strlen($title))
|
||||
@ -2262,7 +2288,6 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$public = (($item['item_private']) ? 'false' : 'true');
|
||||
|
||||
require_once('include/datetime.php');
|
||||
@ -2279,7 +2304,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
'$handle' => xmlify($myaddr),
|
||||
'$public' => $public,
|
||||
'$created' => $created,
|
||||
'$provider' => $item['app']
|
||||
'$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
|
||||
));
|
||||
} else {
|
||||
$tpl = get_markup_template('diaspora_post.tpl');
|
||||
@ -2289,11 +2314,11 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
'$handle' => xmlify($myaddr),
|
||||
'$public' => $public,
|
||||
'$created' => $created,
|
||||
'$provider' => $item['app']
|
||||
'$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
|
||||
));
|
||||
}
|
||||
|
||||
logger('diaspora_send_status: '.$owner['channel_name'].' -> '.$contact['xchan_name'].' base message: '.$msg, LOGGER_DATA);
|
||||
logger('diaspora_send_status: '.$owner['channel_name'].' -> '.$contact['xchan_name'].' base message: ' . $msg, LOGGER_DATA);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['channel_prvkey'],$contact['xchan_pubkey'],$public_batch)));
|
||||
|
||||
|
@ -95,6 +95,7 @@ function collect_recipients($item,&$private_envelope) {
|
||||
$recipients[] = $item['author_xchan'];
|
||||
if($item['owner_xchan'] != $item['author_xchan'])
|
||||
$recipients[] = $item['owner_xchan'];
|
||||
|
||||
return $recipients;
|
||||
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ function notifier_run($argv, $argc){
|
||||
}
|
||||
|
||||
|
||||
if($hub['network'] === 'diaspora' || $hub['network'] === 'friendica-over-diaspora') {
|
||||
if($hub['hubloc_network'] === 'diaspora' || $hub['hubloc_network'] === 'friendica-over-diaspora') {
|
||||
if(! get_config('system','diaspora_enabled'))
|
||||
continue;
|
||||
|
||||
|
16
view/tpl/diaspora_comment.tpl
Normal file
16
view/tpl/diaspora_comment.tpl
Normal file
@ -0,0 +1,16 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<comment>
|
||||
<guid>{{$guid}}</guid>
|
||||
<parent_guid>{{$parent_guid}}</parent_guid>
|
||||
<author_signature>{{$authorsig}}</author_signature>
|
||||
<text>{{$body}}</text>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
</comment>
|
||||
</post>
|
||||
</XML>
|
17
view/tpl/diaspora_comment_relay.tpl
Normal file
17
view/tpl/diaspora_comment_relay.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<comment>
|
||||
<guid>{{$guid}}</guid>
|
||||
<parent_guid>{{$parent_guid}}</parent_guid>
|
||||
<parent_author_signature>{{$parentsig}}</parent_author_signature>
|
||||
<author_signature>{{$authorsig}}</author_signature>
|
||||
<text>{{$body}}</text>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
</comment>
|
||||
</post>
|
||||
</XML>
|
34
view/tpl/diaspora_conversation.tpl
Normal file
34
view/tpl/diaspora_conversation.tpl
Normal file
@ -0,0 +1,34 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<conversation>
|
||||
<guid>{{$conv.guid}}</guid>
|
||||
<subject>{{$conv.subject}}</subject>
|
||||
<created_at>{{$conv.created_at}}</created_at>
|
||||
|
||||
{{foreach $conv.messages as $msg}}
|
||||
|
||||
<message>
|
||||
<guid>{{$msg.guid}}</guid>
|
||||
<parent_guid>{{$msg.parent_guid}}</parent_guid>
|
||||
{{if $msg.parent_author_signature}}
|
||||
<parent_author_signature>{{$msg.parent_author_signature}}</parent_author_signature>
|
||||
{{/if}}
|
||||
<author_signature>{{$msg.author_signature}}</author_signature>
|
||||
<text>{{$msg.text}}</text>
|
||||
<created_at>{{$msg.created_at}}</created_at>
|
||||
<diaspora_handle>{{$msg.diaspora_handle}}</diaspora_handle>
|
||||
<conversation_guid>{{$msg.conversation_guid}}</conversation_guid>
|
||||
</message>
|
||||
|
||||
{{/foreach}}
|
||||
|
||||
<diaspora_handle>{{$conv.diaspora_handle}}</diaspora_handle>
|
||||
<participant_handles>{{$conv.participant_handles}}</participant_handles>
|
||||
</conversation>
|
||||
</post>
|
||||
</XML>
|
17
view/tpl/diaspora_like.tpl
Normal file
17
view/tpl/diaspora_like.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<like>
|
||||
<positive>{{$positive}}</positive>
|
||||
<guid>{{$guid}}</guid>
|
||||
<target_type>{{$target_type}}</target_type>
|
||||
<parent_guid>{{$parent_guid}}</parent_guid>
|
||||
<author_signature>{{$authorsig}}</author_signature>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
</like>
|
||||
</post>
|
||||
</XML>
|
18
view/tpl/diaspora_like_relay.tpl
Normal file
18
view/tpl/diaspora_like_relay.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<like>
|
||||
<positive>{{$positive}}</positive>
|
||||
<guid>{{$guid}}</guid>
|
||||
<target_type>{{$target_type}}</target_type>
|
||||
<parent_guid>{{$parent_guid}}</parent_guid>
|
||||
<parent_author_signature>{{$parentsig}}</parent_author_signature>
|
||||
<author_signature>{{$authorsig}}</author_signature>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
</like>
|
||||
</post>
|
||||
</XML>
|
18
view/tpl/diaspora_message.tpl
Normal file
18
view/tpl/diaspora_message.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<message>
|
||||
<guid>{{$msg.guid}}</guid>
|
||||
<parent_guid>{{$msg.parent_guid}}</parent_guid>
|
||||
<author_signature>{{$msg.author_signature}}</author_signature>
|
||||
<text>{{$msg.text}}</text>
|
||||
<created_at>{{$msg.created_at}}</created_at>
|
||||
<diaspora_handle>{{$msg.diaspora_handle}}</diaspora_handle>
|
||||
<conversation_guid>{{$msg.conversation_guid}}</conversation_guid>
|
||||
</message>
|
||||
</post>
|
||||
</XML>
|
18
view/tpl/diaspora_photo.tpl
Normal file
18
view/tpl/diaspora_photo.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<photo>
|
||||
<guid>{{$guid}}</guid>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<public>{{$public}}</public>
|
||||
<created_at>{{$created_at}}</created_at>
|
||||
<remote_photo_path>{{$path}}</remote_photo_path>
|
||||
<remote_photo_name>{{$filename}}</remote_photo_name>
|
||||
<status_message_guid>{{$msg_guid}}</status_message_guid>
|
||||
</photo>
|
||||
</post>
|
||||
</XML>
|
12
view/tpl/diaspora_post.tpl
Normal file
12
view/tpl/diaspora_post.tpl
Normal file
@ -0,0 +1,12 @@
|
||||
<XML>
|
||||
<post>
|
||||
<status_message>
|
||||
<raw_message>{{$body}}</raw_message>
|
||||
<guid>{{$guid}}</guid>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<public>{{$public}}</public>
|
||||
<created_at>{{$created}}</created_at>
|
||||
<provider_display_name>{{$provider}}</provider_display_name>
|
||||
</status_message>
|
||||
</post>
|
||||
</XML>
|
21
view/tpl/diaspora_profile.tpl
Normal file
21
view/tpl/diaspora_profile.tpl
Normal file
@ -0,0 +1,21 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post><profile>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<first_name>{{$first}}</first_name>
|
||||
<last_name>{{$last}}</last_name>
|
||||
<image_url>{{$large}}</image_url>
|
||||
<image_url_medium>{{$medium}}</image_url_medium>
|
||||
<image_url_small>{{$small}}</image_url_small>
|
||||
<birthday>{{$dob}}</birthday>
|
||||
<gender>{{$gender}}</gender>
|
||||
<bio>{{$about}}</bio>
|
||||
<location>{{$location}}</location>
|
||||
<searchable>{{$searchable}}</searchable>
|
||||
<tag_string>{{$tags}}</tag_string>
|
||||
</profile></post>
|
||||
</XML>
|
15
view/tpl/diaspora_relay_retraction.tpl
Normal file
15
view/tpl/diaspora_relay_retraction.tpl
Normal file
@ -0,0 +1,15 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<relayable_retraction>
|
||||
<target_type>{{$type}}</target_type>
|
||||
<target_guid>{{$guid}}</target_guid>
|
||||
<target_author_signature>{{$signature}}</target_author_signature>
|
||||
<sender_handle>{{$handle}}</sender_handle>
|
||||
</relayable_retraction>
|
||||
</post>
|
||||
</XML>
|
16
view/tpl/diaspora_relayable_retraction.tpl
Normal file
16
view/tpl/diaspora_relayable_retraction.tpl
Normal file
@ -0,0 +1,16 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<relayable_retraction>
|
||||
<parent_author_signature>{{$parentsig}}</parent_author_signature>
|
||||
<target_guid>{{$guid}}</target_guid>
|
||||
<target_type>{{$target_type}}</target_type>
|
||||
<sender_handle>{{$handle}}</sender_handle>
|
||||
<target_author_signature>{{$authorsig}}</target_author_signature>
|
||||
</relayable_retraction>
|
||||
</post>
|
||||
</XML>
|
18
view/tpl/diaspora_reshare.tpl
Normal file
18
view/tpl/diaspora_reshare.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<reshare>
|
||||
<root_diaspora_id>{{$root_handle}}</root_diaspora_id>
|
||||
<root_guid>{{$root_guid}}</root_guid>
|
||||
<guid>{{$guid}}</guid>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<public>{{$public}}</public>
|
||||
<created_at>{{$created}}</created_at>
|
||||
<provider_display_name>{{$provider}}</provider_display_name>
|
||||
</reshare>
|
||||
</post>
|
||||
</XML>
|
14
view/tpl/diaspora_retract.tpl
Normal file
14
view/tpl/diaspora_retract.tpl
Normal file
@ -0,0 +1,14 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<retraction>
|
||||
<post_guid>{{$guid}}</post_guid>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<type>{{$type}}</type>
|
||||
</retraction>
|
||||
</post>
|
||||
</XML>
|
13
view/tpl/diaspora_share.tpl
Normal file
13
view/tpl/diaspora_share.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<request>
|
||||
<sender_handle>{{$sender}}</sender_handle>
|
||||
<recipient_handle>{{$recipient}}</recipient_handle>
|
||||
</request>
|
||||
</post>
|
||||
</XML>
|
15
view/tpl/diaspora_signed_retract.tpl
Normal file
15
view/tpl/diaspora_signed_retract.tpl
Normal file
@ -0,0 +1,15 @@
|
||||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<signed_retraction>
|
||||
<target_guid>{{$guid}}</target_guid>
|
||||
<target_type>{{$type}}</target_type>
|
||||
<sender_handle>{{$handle}}</sender_handle>
|
||||
<target_author_signature>{{$signature}}</target_author_signature>
|
||||
</signed_retraction>
|
||||
</post>
|
||||
</XML>
|
Reference in New Issue
Block a user