]> git.mxchange.org Git - friendica.git/blobdiff - include/diaspora.php
Merge pull request #621 from annando/master
[friendica.git] / include / diaspora.php
index 4b81efef8172faac9bed6384f5924be1770d4bc9..5bf45e241fe1013b230f041bbd7b498918f05eac 100755 (executable)
@@ -559,7 +559,7 @@ function diaspora_decode($importer,$xml) {
 
 }
 
-       
+
 function diaspora_request($importer,$xml) {
 
        $a = get_app();
@@ -569,7 +569,7 @@ function diaspora_request($importer,$xml) {
 
        if(! $sender_handle || ! $recipient_handle)
                return;
-        
+
        $contact = diaspora_get_contact_by_handle($importer['uid'],$sender_handle);
 
        if($contact) {
@@ -754,6 +754,20 @@ function diaspora_request($importer,$xml) {
 }
 
 function diaspora_post_allow($importer,$contact) {
+
+       // perhaps we were already sharing with this person. Now they're sharing with us.
+       // That makes us friends.
+       // Normally this should have handled by getting a request - but this could get lost
+       if($contact['rel'] == CONTACT_IS_FOLLOWER && $importer['page-flags'] != PAGE_COMMUNITY) {
+               q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
+                       intval(CONTACT_IS_FRIEND),
+                       intval($contact['id']),
+                       intval($importer['uid'])
+               );
+               $contact['rel'] = CONTACT_IS_FRIEND;
+               logger('diaspora_post_allow: defining user '.$contact["nick"].' as friend');
+       }
+
        if(($contact['blocked']) || ($contact['readonly']) || ($contact['archive']))
                return false;
        if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND)
@@ -2206,7 +2220,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
        $images = array();
 
        $title = $item['title'];
-       $body = fix_private_photos($item['body'], $owner['uid'], $item, $contact['id']);
+       $body = $item['body'];
 
 /*
        // We're trying to match Diaspora's split message/photo protocol but
@@ -2328,7 +2342,9 @@ function diaspora_send_followup($item,$owner,$contact,$public_batch = false) {
        $myaddr = $owner['nickname'] . '@' .  substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
 //     $theiraddr = $contact['addr'];
 
-       // Diaspora doesn't support threaded comments
+       // Diaspora doesn't support threaded comments, but some
+       // versions of Diaspora (i.e. Diaspora-pistos) support
+       // likes on comments
        if($item['verb'] === ACTIVITY_LIKE && $item['thr-parent']) {
                $p = q("select guid, type, uri, `parent-uri` from item where uri = '%s' limit 1",
                        dbesc($item['thr-parent'])
@@ -2404,7 +2420,9 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
        $body = $item['body'];
        $text = html_entity_decode(bb2diaspora($body));
 
-       // Diaspora doesn't support threaded comments
+       // Diaspora doesn't support threaded comments, but some
+       // versions of Diaspora (i.e. Diaspora-pistos) support
+       // likes on comments
        if($item['verb'] === ACTIVITY_LIKE && $item['thr-parent']) {
                $p = q("select guid, type, uri, `parent-uri` from item where uri = '%s' limit 1",
                        dbesc($item['thr-parent'])