]> git.mxchange.org Git - friendica.git/blobdiff - mod/pubsub.php
Merge branch 'newui' of github.com:fabrixxm/friendika into newui
[friendica.git] / mod / pubsub.php
index 5d8ea2ed76640f7a0a3e329123f17aa8ef961808..4dff5d531ab27a9450ebe2b37c6c37a7645ad0e1 100644 (file)
@@ -91,6 +91,11 @@ function pubsub_post(&$a) {
        logger('pubsub: user-agent: ' . $_SERVER['HTTP_USER_AGENT'] );
        logger('pubsub: data: ' . $xml, LOGGER_DATA);
 
+//     if(! stristr($xml,'<?xml')) {
+//             logger('pubsub_post: bad xml');
+//             hub_post_return();
+//     }
+
        $nick       = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
        $contact_id = (($a->argc > 2) ? intval($a->argv[2])       : 0 );
 
@@ -106,8 +111,8 @@ function pubsub_post(&$a) {
                AND ( `rel` = %d OR `rel` = %d ) AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
                intval($contact_id),
                intval($importer['uid']),
-               intval(REL_FAN),
-               intval(REL_BUD) 
+               intval(CONTACT_IS_SHARING),
+               intval(CONTACT_IS_FRIEND)       
        );
 
        if(! count($r)) {
@@ -117,6 +122,12 @@ function pubsub_post(&$a) {
 
        $contact = $r[0];
 
+       // we have no way to match Diaspora guid's with atom post id's and could get duplicates.
+       // we'll assume that direct delivery is robust (and this is a bad assumption, but the duplicates are messy).
+
+       if($r[0]['network'] === NETWORK_DIASPORA)
+               hub_post_return();
+
        $feedhub = '';
 
        require_once('include/items.php');