sync changes

This commit is contained in:
friendica
2012-07-19 18:53:26 -07:00
parent 6402fa1170
commit 49c0e0de9b
8 changed files with 259 additions and 24 deletions

View File

@@ -163,6 +163,49 @@ function localize_item(&$item){
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
}
if (stristr($item['verb'],ACTIVITY_POKE)) {
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
if(! $verb)
return;
if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
$Aname = $item['author-name'];
$Alink = $item['author-link'];
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$item['object']);
$links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
$Bname = $obj->title;
$Blink = ""; $Bphoto = "";
foreach ($links->link as $l){
$atts = $l->attributes();
switch($atts['rel']){
case "alternate": $Blink = $atts['href'];
case "photo": $Bphoto = $atts['href'];
}
}
$A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
$B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
// we can't have a translation string with three positions but no distinguishable text
// So here is the translate string.
$txt = t('%1$s poked %2$s');
// now translate the verb
$txt = str_replace( t('poked'), t($verb), $txt);
// then do the sprintf on the translation string
$item['body'] = sprintf($txt, $A, $B). "\n\n\n" . $Bphoto;
}
if ($item['verb']===ACTIVITY_TAG){
$r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",

View File

@@ -180,6 +180,8 @@ function notifier_run($argv, $argc){
$parent = $items[0];
// This is IMPORTANT!!!!
// We will only send a "notify owner to relay" or followup message if the referenced post
@@ -195,10 +197,9 @@ function notifier_run($argv, $argc){
// Other DFRN conversation members will be alerted during polled updates.
$localhost = str_replace('www.','',$a->get_hostname());
if(strpos($localhost,':'))
$localhost = substr($localhost,0,strpos($localhost,':'));
$relay_to_owner = false;
$relay_origin_check = (((intval($target_item['origin'])) && (! intval($parent['origin']))) ? true : false);
/**
*
@@ -208,28 +209,17 @@ function notifier_run($argv, $argc){
*
*/
$relay_to_owner = false;
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
if((! $top_level) && ($parent['wall'] == 0) && ($relay_origin_check) && (! $expire))
$relay_to_owner = true;
}
if(($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && (! $top_level)) {
$relay_to_owner = true;
}
// until the 'origin' flag has been in use for several months
// we will just use it as a fallback test
// later we will be able to use it as the primary test of whether or not to relay.
if(! $target_item['origin'])
if(! $relay_origin_check)
$relay_to_owner = false;
if($parent['origin'])
$relay_to_owner = false;
if($relay_to_owner) {
logger('notifier: followup', LOGGER_DEBUG);

View File

@@ -705,6 +705,20 @@ function linkify($s) {
return($s);
}}
function get_poke_verbs() {
// index is present tense verb
// value is array containing past tense verb, translation of present, translation of past
$arr = array(
'poke' => array( 'poked', t('poke'), t('poked')),
'prod' => array( 'prodded', t('prod'), t('prodded')),
'slap' => array( 'slapped', t('slap'), t('slapped')),
'finger' => array( 'fingered', t('finger'), t('fingered'))
);
call_hooks('poke_verbs', $arr);
return $arr;
}
/**
*