From 2802c142cb4c479f82bcf790c8cc6b4bda51de7b Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 6 Oct 2011 19:10:57 -0700 Subject: local_deliver testing --- include/delivery.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/delivery.php') diff --git a/include/delivery.php b/include/delivery.php index 1ba1d9c3a..8318be4dd 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -280,6 +280,42 @@ function delivery_run($argv, $argc){ $atom .= '' . "\r\n"; logger('notifier: ' . $atom, LOGGER_DATA); + $basepath = implode('/', array_slice(explode('/',$contact['url']),0,3)); + + // perform local delivery if we are on the same site + + if(link_compare($basepath,$a->get_baseurl())) { + + $nickname = basename($contact['url']); + if($contact['issued-id']) + $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($contact['issued-id'])); + else + $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id'])); + + $x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, + `contact`.`pubkey` AS `cpubkey`, + `contact`.`prvkey` AS `cprvkey`, + `contact`.`thumb` AS `thumb`, + `contact`.`url` as `url`, + `contact`.`name` as `senderName`, + `user`.* + FROM `contact` + LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` + WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s' + $sql_extra + AND `user`.`account_expired` = 0 LIMIT 1", + dbesc(NETWORK_DFRN), + dbesc($nickname) + ); + + if(count($x)) { + require_once('library/simplepie/simplepie.inc'); + logger('mod-delivery: local delivery'); + local_delivery($x[0],$atom); + break; + } + } $deliver_status = dfrn_deliver($owner,$contact,$atom); -- cgit v1.2.3