From 3ff8fe53a23778f1894bfb166c80c75c6e411c09 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Apr 2012 01:25:25 -0700 Subject: [PATCH] provide "xxx joined yyy" notifications --- mod/dfrn_confirm.php | 45 +++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index efb5be3a41..6f7b925ac8 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -434,9 +434,14 @@ function dfrn_confirm_post(&$a,$handsfree = null) { else $contact = null; - if(isset($new_relation) && $new_relation == CONTACT_IS_FRIEND) { - if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) { + $forum_type = false; + if($user['page-flags'] == PAGE_SOAPBOX || $user['page-flags'] == PAGE_COMMUNITY) + $forum_type = true; + + if((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND) || ($forum_type)) { + + if(($contact) && ($contact['network'] === NETWORK_DIASPORA) && (! $forum_type)) { require_once('include/diaspora.php'); $ret = diaspora_share($user[0],$r[0]); logger('mod_follow: diaspora_share returns: ' . $ret); @@ -468,19 +473,37 @@ function dfrn_confirm_post(&$a,$handsfree = null) { $arr['author-name'] = $arr['owner-name'] = $self[0]['name']; $arr['author-link'] = $arr['owner-link'] = $self[0]['url']; $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb']; - $arr['verb'] = ACTIVITY_FRIEND; - $arr['object-type'] = ACTIVITY_OBJ_PERSON; - + $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]'; + $APhoto = '[url=' . $self[0]['url'] . ']' . '[img]' . $self[0]['thumb'] . '[/img][/url]'; + $B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]'; - $arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto; - $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $contact['name'] . '' - . '' . $contact['url'] . '/' . $contact['name'] . ''; - $arr['object'] .= '' . xmlify('' . "\n"); - $arr['object'] .= xmlify('' . "\n"); - $arr['object'] .= '' . "\n"; + if($forum_type) { + $arr['verb'] = ACTIVITY_JOIN; + $arr['object-type'] = ACTIVITY_OBJ_GROUP; + $arr['body'] = sprintf( t('%1$s joined %2$s'), $B, $A)."\n\n\n".$APhoto; + $arr['object'] = '' . ACTIVITY_OBJ_GROUP . '' . $self[0]['name'] . '' + . '' . $self[0]['url'] . '/' . $self[0]['name'] . ''; + $arr['object'] .= '' . xmlify('' . "\n"); + $arr['object'] .= xmlify('' . "\n"); + $arr['object'] .= '' . "\n"; + + } + else { + $arr['verb'] = ACTIVITY_FRIEND; + $arr['object-type'] = ACTIVITY_OBJ_PERSON; + $arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto; + + $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $contact['name'] . '' + . '' . $contact['url'] . '/' . $contact['name'] . ''; + $arr['object'] .= '' . xmlify('' . "\n"); + $arr['object'] .= xmlify('' . "\n"); + $arr['object'] .= '' . "\n"; + } + + $arr['last-child'] = 1; $arr['allow_cid'] = $user[0]['allow_cid'];