This commit is contained in:
friendica 2012-07-19 21:09:40 -07:00
parent 6293c5e1cf
commit bf38674904
9 changed files with 103 additions and 5 deletions

View File

@ -199,6 +199,7 @@ define ( 'NOTIFY_SUGGEST', 0x0020 );
define ( 'NOTIFY_PROFILE', 0x0040 );
define ( 'NOTIFY_TAGSELF', 0x0080 );
define ( 'NOTIFY_TAGSHARE', 0x0100 );
define ( 'NOTIFY_POKE', 0x0200 );
define ( 'NOTIFY_SYSTEM', 0x8000 );

View File

@ -188,6 +188,7 @@ function contact_photo_menu($contact) {
$status_link="";
$photos_link="";
$posts_link="";
$poke_link="";
$sparkle = false;
if($contact['network'] === NETWORK_DFRN) {
@ -207,10 +208,12 @@ function contact_photo_menu($contact) {
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
}
$poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
$posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id'];
$menu = Array(
t("Poke") => $poke_link,
t("View Status") => $status_link,
t("View Profile") => $profile_link,
t("View Photos") => $photos_link,

View File

@ -147,6 +147,24 @@ function notification($params) {
$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) {
$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);

View File

@ -2818,7 +2818,57 @@ function local_delivery($importer,$data) {
$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;
}
}

View File

@ -102,6 +102,26 @@ function poke_init(&$a) {
function poke_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
$name = '';
$id = '';
if(intval($_GET['c'])) {
$r = q("select id,name from contact where id = %d and uid = %d limit 1",
intval($_GET['c']),
intval(local_user())
);
if(count($r)) {
$name = $r[0]['name'];
$id = $r[0]['id'];
}
}
$base = $a->get_baseurl();
$a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>';
@ -141,7 +161,9 @@ EOT;
'$clabel' => t('Recipient'),
'$choice' => t('Choose what you wish to do to recipient'),
'$verbs' => $shortlist,
'$submit' => t('Submit')
'$submit' => t('Submit'),
'$name' => $name,
'$id' => $id
));
return $o;

View File

@ -373,6 +373,8 @@ function settings_post(&$a) {
$notify += intval($_POST['notify6']);
if(x($_POST,'notify7'))
$notify += intval($_POST['notify7']);
if(x($_POST,'notify8'))
$notify += intval($_POST['notify8']);
$email_changed = false;
@ -970,6 +972,7 @@ function settings_content(&$a) {
'$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, ''),
'$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'),

View File

@ -8,8 +8,8 @@
<div id="poke-recip-label">$clabel</div>
<br />
<input id="recip" type="text" size="64" maxlength="255" value="" name="pokename" autocomplete="off">
<input id="recip-complete" type="hidden" value="" name="cid">
<input id="recip" type="text" size="64" maxlength="255" value="$name" name="pokename" autocomplete="off">
<input id="recip-complete" type="hidden" value="$id" name="cid">
<br />
<br />

View File

@ -123,6 +123,7 @@ $group_select
{{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}}
{{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}}
{{inc field_intcheckbox.tpl with $field=$notify7 }}{{endinc}}
{{inc field_intcheckbox.tpl with $field=$notify8 }}{{endinc}}
</div>
</div>

View File

@ -9,7 +9,7 @@ $parent
<div id="prvmail-to-label">$to</div>
{{ if $showinputs }}
<input type="text" id="recip" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" />
<input type="text" id="recip" name="messagerecip" value="$prefill" maxlength="255" size="64" tabindex="10" />
<input type="hidden" id="recip-complete" name="messageto" value="$preid">
{{ else }}
$select