+ // Otherwise everything seems to have worked and we are almost done. Yay!
+ // Send an email notification
+
+ $r = q("SELECT * FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
+ WHERE `contact`.`id` = %d LIMIT 1",
+ intval($dfrn_record)
+ );
+ if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
+
+ $tpl = (($new_relation == REL_BUD)
+ ? load_view_file('view/friend_complete_eml.tpl')
+ : load_view_file('view/intro_complete_eml.tpl'));
+
+ $email_tpl = replace_macros($tpl, array(
+ '$sitename' => $a->config['sitename'],
+ '$siteurl' => $a->get_baseurl(),
+ '$username' => $r[0]['username'],
+ '$email' => $r[0]['email'],
+ '$fn' => $r[0]['name'],
+ '$dfrn_url' => $r[0]['url'],
+ '$uid' => $newuid )
+ );
+
+ $res = mail($r[0]['email'], t("Connection accepted at ") . $a->config['sitename'],
+ $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER[SERVER_NAME] );
+ if(!$res) {
+ // pointless throwing an error here and confusing the person at the other end of the wire.
+ }
+ }
+ xml_status(0); // Success
+ return; // NOTREACHED
+
+ ////////////////////// End of this scenario ///////////////////////////////////////////////