+ /*
+ *
+ * We have now established a relationship with the other site.
+ * Let's make our own personal copy of their profile photo so we don't have
+ * to always load it from their site.
+ *
+ * We will also update the contact record with the nature and scope of the relationship.
+ *
+ */
+
+ require_once('include/Photo.php');
+
+ $photos = import_profile_photo($contact['photo'],$uid,$contact_id);
+
+ logger('dfrn_confirm: confirm - imported photos');
+
+ if($network === NETWORK_DFRN) {
+
+ $new_relation = CONTACT_IS_FOLLOWER;
+ if(($relation == CONTACT_IS_SHARING) || ($duplex))
+ $new_relation = CONTACT_IS_FRIEND;
+
+ if(($relation == CONTACT_IS_SHARING) && ($duplex))
+ $duplex = 0;
+
+ $r = q("UPDATE `contact` SET `photo` = '%s',
+ `thumb` = '%s',
+ `micro` = '%s',
+ `rel` = %d,
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s',
+ `blocked` = 0,
+ `pending` = 0,
+ `duplex` = %d,
+ `network` = 'dfrn' WHERE `id` = %d LIMIT 1
+ ",
+ dbesc($photos[0]),
+ dbesc($photos[1]),
+ dbesc($photos[2]),
+ intval($new_relation),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ intval($duplex),
+ intval($contact_id)
+ );
+ }
+ else {
+
+ // $network !== NETWORK_DFRN
+
+ $network = (($contact['network']) ? $contact['network'] : NETWORK_OSTATUS);
+ $notify = (($contact['notify']) ? $contact['notify'] : '');
+ $poll = (($contact['poll']) ? $contact['poll'] : '');
+
+ if((! $contact['notify']) || (! $contact['poll'])) {
+ $arr = lrdd($contact['url']);
+ if(count($arr)) {
+ foreach($arr as $link) {
+ if($link['@attributes']['rel'] === 'salmon')
+ $notify = $link['@attributes']['href'];
+ if($link['@attributes']['rel'] === NAMESPACE_FEED)
+ $poll = $link['@attributes']['href'];
+ }
+ }