diff --git a/boot.php b/boot.php
index f2c94740..0bab002e 100644
--- a/boot.php
+++ b/boot.php
@@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000);
define ( 'FRIENDIKA_VERSION', '2.2.1023' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1069 );
+define ( 'DB_UPDATE_VERSION', 1070 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index b33c0cdc..df99ca7f 100644
--- a/database.sql
+++ b/database.sql
@@ -509,7 +509,8 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`url` CHAR( 255 ) NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
-`photo` CHAR( 255 ) NOT NULL
+`photo` CHAR( 255 ) NOT NULL ,
+`request` CHAR( 255 ) NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
@@ -526,6 +527,7 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
`cid` INT NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
`url` CHAR( 255 ) NOT NULL ,
+`request` CHAR( 255 ) NOT NULL,
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
`created` DATETIME NOT NULL
diff --git a/include/notifier.php b/include/notifier.php
index 842e1108..d9f90385 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -71,6 +71,16 @@ function notifier_run($argv, $argc){
if(! count($items))
return;
}
+ elseif($cmd === 'suggest') {
+ $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
+ intval($item_id)
+ );
+ if(! count($suggest))
+ return;
+ $uid = $suggest[0]['uid'];
+ $recipients[] = $suggest[0]['cid'];
+ $item = $suggest[0];
+ }
else {
// find ancestors
@@ -126,7 +136,7 @@ function notifier_run($argv, $argc){
// fill this in with a single salmon slap if applicable
$slap = '';
- if($cmd != 'mail') {
+ if($cmd != 'mail' && $cmd != 'suggest') {
require_once('include/group.php');
@@ -236,6 +246,26 @@ function notifier_run($argv, $argc){
'$parent_id' => xmlify($item['parent-uri'])
));
}
+ elseif($cmd === 'suggest') {
+ $notify_hub = false; // suggestions are not public
+
+ $sugg_template = get_markup_template('atom_suggest.tpl');
+
+ $atom .= replace_macros($sugg_template, array(
+ '$name' => xmlify($item['name']),
+ '$url' => xmlify($item['url']),
+ '$photo' => xmlify($item['photo']),
+ '$request' => xmlify($item['request']),
+ '$note' => xmlify($item['note'])
+ ));
+
+ // We don't need this any more
+
+ q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
+ intval($item['id'])
+ );
+
+ }
else {
if($followup) {
foreach($items as $item) { // there is only one item
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 6cb4f69a..31314da7 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -165,6 +165,7 @@ function dfrn_notify_post(&$a) {
$fsugg['name'] = notags(unxmlify($base['name'][0]['data']));
$fsugg['photo'] = notags(unxmlify($base['photo'][0]['data']));
$fsugg['url'] = notags(unxmlify($base['url'][0]['data']));
+ $fsugg['request'] = notags(unxmlify($base['request'][0]['data']));
$fsugg['body'] = escape_tags(unxmlify($base['note'][0]['data']));
// Does our member already have a friend matching this description?
@@ -180,24 +181,25 @@ function dfrn_notify_post(&$a) {
// Do we already have an fcontact record for this person?
$fid = 0;
- $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `photo` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `request` = '%s' LIMIT 1",
dbesc($fsugg['url']),
dbesc($fsugg['name']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['request'])
);
if(count($r)) {
$fid = $r[0]['id'];
}
if(! $fid)
- $r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo` ) VALUES ( '%s', '%s', '%s' ) ",
+ $r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo`,`request` ) VALUES ( '%s', '%s', '%s', '%s' ) ",
dbesc($fsugg['name']),
dbesc($fsugg['url']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['photo']),
+ dbesc($fsugg['request'])
);
- $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `photo` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `request` = '%s' LIMIT 1",
dbesc($fsugg['url']),
dbesc($fsugg['name']),
- dbesc($fsugg['photo'])
+ dbesc($fsugg['request'])
);
if(count($r)) {
$fid = $r[0]['id'];
diff --git a/update.php b/update.php
index 2e22b9d1..ce8c694c 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
$url
$name
$photo
+ $request
$note