X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsalmon.php;h=5df1e1c9e541b9d332942fb629e65f42cfdeb8b1;hb=8b20af6ef536e34c3bc9c412cbffa4cf9c0cea53;hp=6172d17a1ddda0e7c0816fc2cdfbf945f9becbb4;hpb=355c42cb309eb1313097411067ca999b699aa620;p=friendica.git diff --git a/mod/salmon.php b/mod/salmon.php index 6172d17a1d..5df1e1c9e5 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -30,7 +30,7 @@ function salmon_post(&$a) { $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : ''); $mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false); - $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 LIMIT 1", + $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", dbesc($nick) ); if(! count($r)) @@ -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?