]> git.mxchange.org Git - friendica.git/commitdiff
allow plugin to abort message posting, fix half-duplex D* relationship
authorfriendica <info@friendica.com>
Tue, 31 Jan 2012 04:49:54 +0000 (20:49 -0800)
committerfriendica <info@friendica.com>
Tue, 31 Jan 2012 04:49:54 +0000 (20:49 -0800)
include/items.php
mod/dfrn_confirm.php
mod/item.php

index 62f1f2ce5bc7b6146bcf002a96e4be08addb1884..ba95919a6ba9672a846b2bfa3fdf2c7d4c18caec 100755 (executable)
@@ -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);
index 89b09ef77e8aa8d55418fc36383bd5128ab143ba..26314f39be6c76313fc17586417ae2a13cbac523 100755 (executable)
@@ -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;
                        }
index 99c01c54fd6c160e0e2fd85f96db82e0e1195541..217f13c4984b3025226484f9f7b49afa6f682a1e 100755 (executable)
@@ -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",