aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-19 21:09:40 -0700
committerfriendica <info@friendica.com>2012-07-19 21:09:40 -0700
commitbf386749047731d3a7f47fd99f7dcc4e93ed7be7 (patch)
tree49168f1e7d3ca11f0b3622ca9129904af15608bf /include
parent6293c5e1cf53eeb6db487c74c6e4cec8a11148d4 (diff)
downloadvolse-hubzilla-bf386749047731d3a7f47fd99f7dcc4e93ed7be7.tar.gz
volse-hubzilla-bf386749047731d3a7f47fd99f7dcc4e93ed7be7.tar.bz2
volse-hubzilla-bf386749047731d3a7f47fd99f7dcc4e93ed7be7.zip
sync
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php3
-rw-r--r--include/enotify.php18
-rwxr-xr-xinclude/items.php52
3 files changed, 72 insertions, 1 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 4e902be4f..9a6c64693 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -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,
diff --git a/include/enotify.php b/include/enotify.php
index 814bd06a4..510991476 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -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);
diff --git a/include/items.php b/include/items.php
index 21b7d9433..b11250f8b 100755
--- a/include/items.php
+++ b/include/items.php
@@ -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;
}
}