aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorStefan Parviainen <saparvia@caterva.eu>2014-11-08 20:53:41 +0100
committerStefan Parviainen <saparvia@caterva.eu>2014-11-08 20:53:41 +0100
commitb5fad9feefd0f261807222d8a4c42ead6253a65c (patch)
tree399cd4a1b79f61530924ea59670af0bdd6cee5be /include/bb2diaspora.php
parent89aea081825ec7b11b00833a9bec2c74900bfcb6 (diff)
parentb29a968be8df52cd7c9b6d5bebb618534788337c (diff)
downloadvolse-hubzilla-b5fad9feefd0f261807222d8a4c42ead6253a65c.tar.gz
volse-hubzilla-b5fad9feefd0f261807222d8a4c42ead6253a65c.tar.bz2
volse-hubzilla-b5fad9feefd0f261807222d8a4c42ead6253a65c.zip
Fix merge conflict
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 9a87de5b2..3c4f07568 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -116,6 +116,8 @@ function diaspora_mention_callback($matches) {
function diaspora2bb($s,$use_zrl = false) {
+ $s = str_replace("&#xD;\n&gt;","",$s);
+
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
// Too many new lines. So deactivated the following line
@@ -275,7 +277,7 @@ function bb2diaspora_itemwallwall(&$item) {
}
if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author']))) {
- logger('bb2diaspora_itemwallwall: author: ' . print_r($item['author'],true), LOGGER_DEBUG);
+ logger('bb2diaspora_itemwallwall: author: ' . print_r($item['author'],true), LOGGER_DATA);
}
if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
@@ -290,14 +292,18 @@ function bb2diaspora_itemwallwall(&$item) {
// We have to do something similar for wall-to-wall comments. ITEM_WALL|ITEM_ORIGIN indicates that it was posted on this site.
// Regular matrix comments may have one of these bits set, but not both.
- if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && ($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
- logger('bb2diaspora_itemwallwall: wall to wall comment',LOGGER_DEBUG);
+ // Update: this is getting triggered way too often and unnecessarily. Commenting out until we find a better solution.
+ // It's not an easy problem. For now we'll live with the mis-attributions, as wall to wall comments are much less frequent
+ // than wall-to-wall posts.
+
+// if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
+// logger('bb2diaspora_itemwallwall: wall to wall comment',LOGGER_DEBUG);
// post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author.
- $item['body'] = "\n\n"
- . '[img]' . $item['author']['xchan_photo_m'] . '[/img]'
- . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n"
- . $item['body'];
- }
+// $item['body'] = "\n\n"
+// . '[img]' . $item['author']['xchan_photo_m'] . '[/img]'
+// . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n"
+// . $item['body'];
+// }
// $item['author'] might cause a surprise further down the line if it wasn't expected to be here.
@@ -334,8 +340,13 @@ function bb2diaspora_itembody($item,$force_update = false) {
if(array_key_exists('item_flags',$item) && ($item['item_flags'] & ITEM_OBSCURED)) {
$key = get_config('system','prvkey');
- $newitem['title'] = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : '');
- $newitem['body'] = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : '');
+ $b = json_decode($item['body'],true);
+ // if called from diaspora_process_outbound, this decoding has already been done.
+ // Everything else that calls us will not yet be decoded.
+ if($b && is_array($b) && array_key_exists('iv',$b)) {
+ $newitem['title'] = (($item['title']) ? crypto_unencapsulate(json_decode($item['title'],true),$key) : '');
+ $newitem['body'] = (($item['body']) ? crypto_unencapsulate(json_decode($item['body'],true),$key) : '');
+ }
}
bb2diaspora_itemwallwall($newitem);
@@ -377,7 +388,7 @@ function bb2diaspora_itembody($item,$force_update = false) {
}
}
- logger('bb2diaspora_itembody : ' . $body);
+// logger('bb2diaspora_itembody : ' . $body, LOGGER_DATA);
return html_entity_decode($body);
@@ -451,7 +462,7 @@ function format_event_diaspora($ev) {
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
- $o = 'Friendica event notification:' . "\n";
+ $o = t('Redmatrix event notification:') . "\n";
$o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n";