- if($cmd == 'drop') {
- $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($contact_id),
- intval($_SESSION['uid']));
-
-// if(count($photos)) {
-// foreach($photos as $p) {
-// q("DELETE FROM `photos` WHERE `id` = %d LIMIT 1",
-// $p['id']);
-// }
-// }
-
- if(intval($contact_id))
- q("DELETE FROM `item` WHERE `contact-id` = %d LIMIT 1",
- intval($contact_id)
- );
-
- notice("Contact has been removed." . EOL );
+ if($cmd === 'ignore') {
+ $readonly = (($orig_record[0]['readonly']) ? 0 : 1);
+ $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($readonly),
+ intval($contact_id),
+ intval(local_user())
+ );
+ if($r) {
+ info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
+ }
+ goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+ return; // NOTREACHED
+ }
+
+ if($cmd === 'drop') {
+
+ // create an unfollow slap
+
+ if($orig_record[0]['network'] === 'stat') {
+ $tpl = get_markup_template('follow_slap.tpl');
+ $slap = replace_macros($tpl, array(
+ '$name' => $a->user['username'],
+ '$profile_page' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],
+ '$photo' => $a->contact['photo'],
+ '$thumb' => $a->contact['thumb'],
+ '$published' => datetime_convert('UTC','UTC', 'now', ATOM_TIME),
+ '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':unfollow:' . random_string(),
+ '$title' => '',
+ '$type' => 'text',
+ '$content' => t('stopped following'),
+ '$nick' => $a->user['nickname'],
+ '$verb' => 'http://ostatus.org/schema/1.0/unfollow', // ACTIVITY_UNFOLLOW,
+ '$ostat_follow' => '' // '<as:verb>http://ostatus.org/schema/1.0/unfollow</as:verb>' . "\r\n"
+ ));
+
+ if((x($orig_record[0],'notify')) && (strlen($orig_record[0]['notify']))) {
+ require_once('include/salmon.php');
+ slapper($a->user,$orig_record[0]['notify'],$slap);
+ }
+ }
+
+ if($orig_record[0]['network'] === 'dfrn') {
+ require_once('include/items.php');
+ dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
+ }
+
+
+ contact_remove($contact_id);
+ info( t('Contact has been removed.') . EOL );