]> git.mxchange.org Git - friendica.git/commitdiff
poke notifications
authorfriendica <info@friendica.com>
Fri, 20 Jul 2012 03:13:40 +0000 (20:13 -0700)
committerfriendica <info@friendica.com>
Fri, 20 Jul 2012 03:13:40 +0000 (20:13 -0700)
boot.php
include/enotify.php
include/items.php
mod/settings.php
view/settings.tpl

index 4f52db86385b380ecd50e923aadedd0b33bbb227..beaaeb247522a060476b92bd58125c3746a21965 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -191,6 +191,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 );
 
index 814bd06a4ce2501e97da19ac542b8c56eddd6f0a..51099147623dfafe89ee539394ab8d775d73235d 100644 (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);
index b933804fd9fc54e0aab475ebd16a954134306ef3..fe729000ccb5607c2844ca7a80520bfddc29daf5 100755 (executable)
@@ -2958,7 +2958,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;
                }
        }
index b1c3cf7d40277f9b5f3fce977f1b76e976557d06..0d9d35f69231f622203c7a723870c2ed9b4ab284 100644 (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;
 
@@ -1025,6 +1027,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'),
index 99ee9b51efdb3cc0c9ca8cf531f71fb6025abdb4..bebd0c12a85df299645ec07f007a6d0cbb5cd86f 100644 (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>