Browse Source

allow plugin to abort message posting, fix half-duplex D* relationship

pull/34/head
friendica 9 years ago
parent
commit
4993f4f1d6
3 changed files with 22 additions and 0 deletions
  1. +5
    -0
      include/items.php
  2. +3
    -0
      mod/dfrn_confirm.php
  3. +14
    -0
      mod/item.php

+ 5
- 0
include/items.php View File

@ -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);


+ 3
- 0
mod/dfrn_confirm.php View File

@ -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
- 0
mod/item.php View File

@ -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…
Cancel
Save