]> git.mxchange.org Git - friendica.git/commitdiff
turn diaspora posts into x-www-form-urlencoded
authorFriendika <info@friendika.com>
Tue, 16 Aug 2011 00:14:51 +0000 (17:14 -0700)
committerFriendika <info@friendika.com>
Tue, 16 Aug 2011 00:14:51 +0000 (17:14 -0700)
boot.php
include/diaspora.php
mod/receive.php

index 9461f21ae4ccb7096cc24039a72c41cad3b2c087..7186ce7c688adee4ee1e42e81aaf1774918826c2 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -7,7 +7,7 @@ require_once('include/text.php');
 require_once("include/pgettext.php");
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.1072' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1073' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1079      );
 
index 74aa32f5cb4ecb4534019702bfd53c1c80156267..dd0debe69ae2fd01b61c2ea658c0529f8dbe3f36 100644 (file)
@@ -533,12 +533,9 @@ function diaspora_share($me,$contact) {
                '$recipient' => $theiraddr
        ));
 
-       $slap = diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey']);
+       $slap = 'xml=' . urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey']));
 
-       post_url($contact['notify'],$slap, array(
-               'Content-type: application/magic-envelope+xml',
-               'Content-length: ' . strlen($slap)
-       ));
+       post_url($contact['notify'],$slap);
        $return_code = $a->get_curl_code();
        return $return_code;
 }
@@ -567,12 +564,9 @@ function diaspora_send_status($item,$owner,$contact) {
 
        logger('diaspora_send_status: base message: ' . $msg, LOGGER_DATA);
 
-       $slap = diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey']);
+       $slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey']));
 
-       post_url($contact['notify'],$slap, array(
-               'Content-type: application/magic-envelope+xml',
-               'Content-length: ' . strlen($slap)
-       ));
+       post_url($contact['notify'],$slap);
        $return_code = $a->get_curl_code();
        logger('diaspora_send_status: returns: ' . $return_code);
        return $return_code;
index 43f8c7bbcd36b05b23fb306def746c7e47b7a3c9..46b1f2745684e6cb513a192d2a480cd1ab351fde 100644 (file)
@@ -26,6 +26,9 @@ function receive_post(&$a) {
 
        $importer = $r[0];
 
+       // I really don't know why we need urldecode - PHP should be doing this for us.
+       // It is an application/x-www-form-urlencoded
+
        $xml = urldecode($_POST['xml']);
 
        logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
@@ -34,6 +37,9 @@ function receive_post(&$a) {
                http_status_exit(500);
 
        $msg = diaspora_decode($importer,$xml);
+
+       logger('mod-diaspora: decoded msg: ' . $msg, LOGGER_DATA);
+
        if(! $msg)
                http_status_exit(500);
 
@@ -58,21 +64,23 @@ function receive_post(&$a) {
        // is this a follower? Or have we ignored the person?
        // If so we can not accept this post.
        // However we will accept a sharing e.g. friend request
+       // or a retraction of same.
 
-       if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
-               if(! $xmlbase->request) {
+
+       $allow_blocked = (($xmlbase->request || ($xmlbase->retraction && $xmlbase->retraction->type == 'Person')) ? true : false);
+
+       if((count($r)) 
+               && (($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']) || ($r[0]['readonly'])) 
+               && (! $allow_blocked)) {
                        logger('mod-diaspora: Ignoring this author.');
                        http_status_exit(202);
                        // NOTREACHED
-               }
        }
 
        require_once('include/items.php');
 
        $contact = ((count($r)) ? $r[0] : null);
 
-       logger('diaspora msg: ' . $msg, LOGGER_DATA); 
-
        if($xmlbase->request) {
                diaspora_request($importer,$contact,$xmlbase->request);
        }