mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
allow plugin to abort message posting, fix half-duplex D* relationship
This commit is contained in:
parent
95878a3e84
commit
4993f4f1d6
3 changed files with 22 additions and 0 deletions
|
@ -814,6 +814,11 @@ function item_store($arr,$force_parent = false) {
|
|||
|
||||
call_hooks('post_remote',$arr);
|
||||
|
||||
if(x($arr,'cancel')) {
|
||||
logger('item_store: post cancelled by plugin.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
dbesc_array($arr);
|
||||
|
||||
logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
|
||||
|
|
|
@ -370,6 +370,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
if($network === NETWORK_DIASPORA) {
|
||||
if($duplex)
|
||||
$new_relation = CONTACT_IS_FRIEND;
|
||||
else
|
||||
$new_relation = CONTACT_IS_SHARING;
|
||||
|
||||
if($new_relation != CONTACT_IS_FOLLOWER)
|
||||
$writable = 1;
|
||||
}
|
||||
|
|
14
mod/item.php
14
mod/item.php
|
@ -633,6 +633,20 @@ function item_post(&$a) {
|
|||
|
||||
call_hooks('post_local',$datarray);
|
||||
|
||||
if(x($datarray,'cancel')) {
|
||||
logger('mod_item: post cancelled by plugin.');
|
||||
if($return_path) {
|
||||
goaway($a->get_baseurl() . "/" . $return_path);
|
||||
}
|
||||
|
||||
$json = array('cancel' => 1);
|
||||
if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
|
||||
$json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
|
||||
|
||||
echo json_encode($json);
|
||||
killme();
|
||||
}
|
||||
|
||||
|
||||
if($orig_post) {
|
||||
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
|
Loading…
Reference in a new issue