diaspora top level status posts, string update

This commit is contained in:
Friendika 2011-08-14 21:23:02 -07:00
parent 0729e205c8
commit d723ff4770
4 changed files with 274 additions and 210 deletions

View file

@ -540,3 +540,38 @@ function diaspora_share($me,$contact) {
return $return_code;
}
function diaspora_send_status($item,$owner,$contact) {
$a = get_app();
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
$theiraddr = $contact['addr'];
require_once('include/bbcode.php');
$body = xmlify(bbcode($item['body']));
$public = (($item['private']) ? 'false' : 'true');
require_once('include/datetime.php');
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d h:i:s \U\T\C');
$tpl = get_markup_template('diaspora_post.tpl');
$msg = replace_macros($tpl, array(
'$body' => $body,
'$guid' => $item['guid'],
'$handle' => xmlify($myaddr),
'$public' => $public,
'$created' => $created
));
logger('diaspora_send_status: base message: ' . $msg, LOGGER_DATA);
$slap = diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey']);
post_url($contact['notify'],$slap, array(
'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($slap)
));
$return_code = $a->get_curl_code();
logger('diaspora_send_status: returns: ' . $return_code);
return $return_code;
}

View file

@ -119,7 +119,8 @@ function notifier_run($argv, $argc){
$top_level = true;
}
$r = q("SELECT `contact`.*, `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
`user`.`page-flags`, `user`.`prvnets`
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
@ -351,7 +352,7 @@ function notifier_run($argv, $argc){
$deliver_status = 0;
switch($contact['network']) {
case 'dfrn':
case NETWORK_DFRN:
logger('notifier: dfrndelivery: ' . $contact['name']);
$deliver_status = dfrn_deliver($owner,$contact,$atom);
@ -369,7 +370,7 @@ function notifier_run($argv, $argc){
);
}
break;
case 'stat':
case NETWORK_OSTATUS:
// Do not send to otatus if we are not configured to send to public networks
if($owner['prvnets'])
@ -419,7 +420,7 @@ function notifier_run($argv, $argc){
}
break;
case 'mail':
case NETWORK_MAIL:
if(get_config('system','dfrn_only'))
break;
@ -496,9 +497,18 @@ function notifier_run($argv, $argc){
mail($addr, $subject, $message, $headers);
}
break;
case 'feed':
case 'face':
case 'dspr':
case NETWORK_DIASPORA:
if(get_config('system','dfrn_only') || (! get_config('diaspora_enabled')))
break;
if($top_level) {
diaspora_send_status($parent_item,$owner,$contact);
break;
}
break;
case NETWORK_FEED:
case NETWORK_FACEBOOK:
if(get_config('system','dfrn_only'))
break;
default:

File diff suppressed because it is too large Load diff

View file

@ -495,6 +495,7 @@ $a->strings["Crop Image"] = "";
$a->strings["Please adjust the image cropping for optimum viewing."] = "";
$a->strings["Done Editing"] = "";
$a->strings["Image uploaded successfully."] = "";
$a->strings["No profile"] = "";
$a->strings["Remove My Account"] = "";
$a->strings["This will completely remove your account. Once this has been done it is not recoverable."] = "";
$a->strings["Please enter your password for verification:"] = "";
@ -606,7 +607,6 @@ $a->strings["FTP Host"] = "";
$a->strings["FTP Path"] = "";
$a->strings["FTP User"] = "";
$a->strings["FTP Password"] = "";
$a->strings["No profile"] = "";
$a->strings["Access to this profile has been restricted."] = "";
$a->strings["Tips for New Members"] = "";
$a->strings["Login failed."] = "";
@ -618,7 +618,7 @@ $a->strings["No compatible communication protocols or feeds were discovered."] =
$a->strings["The profile address specified does not provide adequate information."] = "";
$a->strings["An author or name was not found."] = "";
$a->strings["No browser URL could be matched to this address."] = "";
$a->strings["Communication options with this network have been restricted."] = "";
$a->strings["The profile address specified belongs to a network which has been disabled on this site."] = "";
$a->strings["Limited profile. This person will be unable to receive direct/personal notifications from you."] = "";
$a->strings["Unable to retrieve contact information."] = "";
$a->strings["following"] = "";
@ -756,7 +756,6 @@ $a->strings["Drop files here to upload"] = "";
$a->strings["Failed"] = "";
$a->strings["No files were uploaded."] = "";
$a->strings["Uploaded file is empty"] = "";
$a->strings["Uploaded file is too large"] = "";
$a->strings["File has an invalid extension, it should be one of "] = "";
$a->strings["Upload was cancelled, or server error encountered"] = "";
$a->strings["Impressum"] = "";
@ -792,6 +791,9 @@ $a->strings["If enabled all your <strong>public</strong> postings can be posted
$a->strings["Allow posting to StatusNet"] = "";
$a->strings["Send public postings to StatusNet by default"] = "";
$a->strings["Clear OAuth configuration"] = "";
$a->strings["API URL"] = "";
$a->strings["Consumer Secret"] = "";
$a->strings["Consumer Key"] = "";
$a->strings["Piwik Base URL"] = "";
$a->strings["Site ID"] = "";
$a->strings["Show opt-out cookie link?"] = "";
@ -923,6 +925,7 @@ $a->strings["November"] = "";
$a->strings["December"] = "";
$a->strings["bytes"] = "";
$a->strings["Select an alternate language"] = "";
$a->strings["Sharing notification from Diaspora network"] = "";
$a->strings["Embedding disabled"] = "";
$a->strings["Create a new group"] = "";
$a->strings["Everybody"] = "";