]> git.mxchange.org Git - friendica.git/commitdiff
provide ability to autofriend ostatus accounts
authorfriendica <info@friendica.com>
Fri, 8 Jun 2012 03:20:13 +0000 (20:20 -0700)
committerfriendica <info@friendica.com>
Fri, 8 Jun 2012 03:20:13 +0000 (20:20 -0700)
mod/salmon.php

index 6172d17a1ddda0e7c0816fc2cdfbf945f9becbb4..1e16f9d14ba1d2e6b7b8fff8886b24adbcdef04d 100644 (file)
@@ -170,14 +170,28 @@ function salmon_post(&$a) {
        *
        */
 
-       $r = q("SELECT * FROM `contact` WHERE `network` = 'stat' AND ( `url` = '%s' OR `alias` = '%s'
+       $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s' 
                AND `uid` = %d LIMIT 1",
+               dbesc(NETWORK_OSTATUS),
                dbesc($author_link),
                dbesc($author_link),
                intval($importer['uid'])
        );
        if(! count($r)) {
                logger('mod-salmon: Author unknown to us.');
+               if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
+                       require_once('include/follow.php');
+                       $result = new_contact($importer['uid'],$author_link);
+                       if($result['success']) {
+                               $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s' ) 
+                                       AND `uid` = %d LIMIT 1",
+                                       dbesc(NETWORK_OSTATUS),
+                                       dbesc($author_link),
+                                       dbesc($author_link),
+                                       intval($importer['uid'])
+                               );
+                       }
+               }
        }       
 
        // is this a follower? Or have we ignored the person?