poke notifications
This commit is contained in:
parent
b78bd8cc94
commit
a54278649f
1
boot.php
1
boot.php
|
@ -191,6 +191,7 @@ define ( 'NOTIFY_SUGGEST', 0x0020 );
|
||||||
define ( 'NOTIFY_PROFILE', 0x0040 );
|
define ( 'NOTIFY_PROFILE', 0x0040 );
|
||||||
define ( 'NOTIFY_TAGSELF', 0x0080 );
|
define ( 'NOTIFY_TAGSELF', 0x0080 );
|
||||||
define ( 'NOTIFY_TAGSHARE', 0x0100 );
|
define ( 'NOTIFY_TAGSHARE', 0x0100 );
|
||||||
|
define ( 'NOTIFY_POKE', 0x0200 );
|
||||||
|
|
||||||
define ( 'NOTIFY_SYSTEM', 0x8000 );
|
define ( 'NOTIFY_SYSTEM', 0x8000 );
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,24 @@ function notification($params) {
|
||||||
$itemlink = $params['link'];
|
$itemlink = $params['link'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($params['type'] == NOTIFY_POKE) {
|
||||||
|
|
||||||
|
$subject = sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']);
|
||||||
|
$preamble = sprintf( t('%1$s poked you at %2$s') , $params['source_name'], $sitename);
|
||||||
|
$epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') ,
|
||||||
|
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||||
|
$params['link']);
|
||||||
|
|
||||||
|
$subject = str_replace('poked', t($params['activity']), $subject);
|
||||||
|
$preamble = str_replace('poked', t($params['activity']), $preamble);
|
||||||
|
$epreamble = str_replace('poked', t($params['activity']), $epreamble);
|
||||||
|
|
||||||
|
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||||
|
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||||
|
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
||||||
|
$itemlink = $params['link'];
|
||||||
|
}
|
||||||
|
|
||||||
if($params['type'] == NOTIFY_TAGSHARE) {
|
if($params['type'] == NOTIFY_TAGSHARE) {
|
||||||
$subject = sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']);
|
$subject = sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']);
|
||||||
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
|
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
|
||||||
|
|
|
@ -2958,7 +2958,57 @@ function local_delivery($importer,$data) {
|
||||||
$datarray['owner-avatar'] = $importer['thumb'];
|
$datarray['owner-avatar'] = $importer['thumb'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = item_store($datarray);
|
$posted_id = item_store($datarray);
|
||||||
|
|
||||||
|
if(stristr($datarray['verb'],ACTIVITY_POKE)) {
|
||||||
|
$verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1));
|
||||||
|
if(! $verb)
|
||||||
|
continue;
|
||||||
|
$xo = parse_xml_string($datarray['object'],false);
|
||||||
|
|
||||||
|
if(($xo->type == ACTIVITY_OBJ_PERSON) && ($xo->id)) {
|
||||||
|
|
||||||
|
// somebody was poked/prodded. Was it me?
|
||||||
|
|
||||||
|
$links = parse_xml_string("<links>".unxmlify($xo->link)."</links>",false);
|
||||||
|
|
||||||
|
foreach($links->link as $l) {
|
||||||
|
$atts = $l->attributes();
|
||||||
|
switch($atts['rel']) {
|
||||||
|
case "alternate":
|
||||||
|
$Blink = $atts['href'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($Blink && link_compare($Blink,$a->get_baseurl() . '/profile/' . $importer['nickname'])) {
|
||||||
|
|
||||||
|
// send a notification
|
||||||
|
require_once('include/enotify.php');
|
||||||
|
|
||||||
|
notification(array(
|
||||||
|
'type' => NOTIFY_POKE,
|
||||||
|
'notify_flags' => $importer['notify-flags'],
|
||||||
|
'language' => $importer['language'],
|
||||||
|
'to_name' => $importer['username'],
|
||||||
|
'to_email' => $importer['email'],
|
||||||
|
'uid' => $importer['importer_uid'],
|
||||||
|
'item' => $datarray,
|
||||||
|
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
||||||
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
|
'source_link' => $datarray['author-link'],
|
||||||
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
|
? $importer['thumb'] : $datarray['author-avatar']),
|
||||||
|
'verb' => $datarray['verb'],
|
||||||
|
'otype' => 'person',
|
||||||
|
'activity' => $verb,
|
||||||
|
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,6 +373,8 @@ function settings_post(&$a) {
|
||||||
$notify += intval($_POST['notify6']);
|
$notify += intval($_POST['notify6']);
|
||||||
if(x($_POST,'notify7'))
|
if(x($_POST,'notify7'))
|
||||||
$notify += intval($_POST['notify7']);
|
$notify += intval($_POST['notify7']);
|
||||||
|
if(x($_POST,'notify8'))
|
||||||
|
$notify += intval($_POST['notify8']);
|
||||||
|
|
||||||
$email_changed = false;
|
$email_changed = false;
|
||||||
|
|
||||||
|
@ -1025,6 +1027,7 @@ function settings_content(&$a) {
|
||||||
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
|
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
|
||||||
'$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
|
'$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
|
||||||
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
|
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
|
||||||
|
'$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
|
||||||
|
|
||||||
|
|
||||||
'$h_advn' => t('Advanced Account/Page Type Settings'),
|
'$h_advn' => t('Advanced Account/Page Type Settings'),
|
||||||
|
|
|
@ -123,6 +123,7 @@ $group_select
|
||||||
{{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}}
|
{{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}}
|
||||||
{{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}}
|
{{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}}
|
||||||
{{inc field_intcheckbox.tpl with $field=$notify7 }}{{endinc}}
|
{{inc field_intcheckbox.tpl with $field=$notify7 }}{{endinc}}
|
||||||
|
{{inc field_intcheckbox.tpl with $field=$notify8 }}{{endinc}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue