-
- push_lang($r[0]['language']);
- $tpl = (($new_relation == CONTACT_IS_FRIEND)
- ? get_intltext_template('friend_complete_eml.tpl')
- : get_intltext_template('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'], sprintf( t("Connection accepted at %s") , $a->config['sitename']),
- $email_tpl,
- 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
-
- if(!$res) {
- // pointless throwing an error here and confusing the person at the other end of the wire.
- }
- pop_lang();
+ $mutual = ($new_relation == CONTACT_IS_FRIEND);
+ notification(array(
+ 'type' => NOTIFY_CONFIRM,
+ 'notify_flags' => $r[0]['notify-flags'],
+ 'language' => $r[0]['language'],
+ 'to_name' => $r[0]['username'],
+ 'to_email' => $r[0]['email'],
+ 'uid' => $r[0]['uid'],
+ 'link' => $a->get_baseurl() . '/contacts/' . $dfrn_record,
+ 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
+ 'source_link' => $r[0]['url'],
+ 'source_photo' => $r[0]['photo'],
+ 'verb' => ($mutual?ACTIVITY_FRIEND:ACTIVITY_FOLLOW),
+ 'otype' => 'intro'
+ ));