aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-14 21:23:02 -0700
committerFriendika <info@friendika.com>2011-08-14 21:23:02 -0700
commitd723ff47708843893956bf30669b4762a6360bcd (patch)
tree0de7e918d66d3c67fd8a3e983b64a10619c1ce81 /include/diaspora.php
parent0729e205c8149f5634b8622654a09382b50ec678 (diff)
downloadvolse-hubzilla-d723ff47708843893956bf30669b4762a6360bcd.tar.gz
volse-hubzilla-d723ff47708843893956bf30669b4762a6360bcd.tar.bz2
volse-hubzilla-d723ff47708843893956bf30669b4762a6360bcd.zip
diaspora top level status posts, string update
Diffstat (limited to 'include/diaspora.php')
-rw-r--r--include/diaspora.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index d8be2b2cc..38ee8c1e5 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -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;
+}
+