aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/deliver.php3
-rwxr-xr-xinclude/diaspora.php23
-rw-r--r--include/queue.php17
-rw-r--r--include/zot.php13
4 files changed, 46 insertions, 10 deletions
diff --git a/include/deliver.php b/include/deliver.php
index 08c4f9b64..6f8bf0c98 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -24,6 +24,9 @@ function deliver_run($argv, $argc) {
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
if($result['success'] && $result['return_code'] < 300) {
logger('deliver: queue post success to ' . $r[0]['outq_posturl'], LOGGER_DEBUG);
+ $y = q("update outq set outq_delivered = '%s' where outq_hash = '%s' limit 1",
+ dbesc($argv[$x])
+ );
}
else {
$y = q("update outq set outq_updated = '%s' where outq_hash = '%s' limit 1",
diff --git a/include/diaspora.php b/include/diaspora.php
index 9652ecce7..352ed48e4 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -18,7 +18,7 @@ function diaspora_dispatch_public($msg) {
// find everybody following or allowing this author
- $r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook WHERE abook_network = 'diaspora' and abook_xchan = '%s' )",
+ $r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' )",
dbesc($msg['author'])
);
@@ -339,7 +339,8 @@ function diaspora_pubmsg_build($msg,$channel,$contact,$prvkey,$pubkey) {
logger('diaspora_pubmsg_build: ' . $msg, LOGGER_DATA);
- $handle = $channel['xchan_addr'];
+ $handle = $channel['channel_address'] . '@' . get_app()->get_hostname();
+
$b64url_data = base64url_encode($msg,false);
@@ -757,6 +758,10 @@ function diaspora_post($importer,$xml,$msg) {
$a = get_app();
$guid = notags(unxmlify($xml->guid));
$diaspora_handle = notags(unxmlify($xml->diaspora_handle));
+ $app = notags(xmlify($xml->provider_display_name));
+
+
+
if($diaspora_handle != $msg['author']) {
logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.');
@@ -767,6 +772,16 @@ function diaspora_post($importer,$xml,$msg) {
if(! $contact)
return;
+
+
+ if(! $app) {
+ if(strstr($contact['xchan_network'],'friendica'))
+ $app = 'Friendica';
+ else
+ $app = 'Diaspora';
+ }
+
+
if(! perm_is_allowed($importer['channel_id'],$contact['xchan_hash'],'send_stream')) {
logger('diaspora_post: Ignoring this author.');
return 202;
@@ -857,11 +872,11 @@ function diaspora_post($importer,$xml,$msg) {
$datarray['plink'] = $plink;
$datarray['author_xchan'] = $contact['xchan_hash'];
- $datarray['owner_xchan'] = $importer['channel_hash'];
+ $datarray['owner_xchan'] = $contact['xchan_hash'];
$datarray['body'] = $body;
- $datarray['app'] = 'Diaspora';
+ $datarray['app'] = $app;
$datarray['item_flags'] = ITEM_UNSEEN|ITEM_THREAD_TOP;
diff --git a/include/queue.php b/include/queue.php
index 239d61fc0..378cc7816 100644
--- a/include/queue.php
+++ b/include/queue.php
@@ -46,6 +46,23 @@ function queue_run($argv, $argc){
foreach($r as $rr) {
if(in_array($rr['outq_posturl'],$deadguys))
continue;
+
+ if($rr['outq_driver'] === 'post') {
+ $result = z_post_url($rr['outq_posturl'],$rr['outq_msg']);
+ if($result['success'] && $result['return_code'] < 300) {
+ logger('deliver: queue post success to ' . $rr['outq_posturl'], LOGGER_DEBUG);
+ $y = q("update outq set outq_delivered = '%s' where outq_hash = '%s' limit 1",
+ dbesc($rr['ouq_hash'])
+ );
+ }
+ else {
+ $y = q("update outq set outq_updated = '%s' where outq_hash = '%s' limit 1",
+ dbesc(datetime_convert()),
+ dbesc($rr['outq_hash'])
+ );
+ }
+ continue;
+ }
$result = zot_zot($rr['outq_posturl'],$rr['outq_notify']);
if($result['success']) {
zot_process_response($rr['outq_posturl'],$result, $rr);
diff --git a/include/zot.php b/include/zot.php
index 54efe1343..8627656c2 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1595,12 +1595,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) {
$arr['aid'] = $channel['channel_account_id'];
$arr['uid'] = $channel['channel_id'];
$item_result = item_store($arr);
- $item_id = $item_result['item_id'];
- $parr = array('item_id' => $item_id,'item' => $arr,'sender' => $sender,'channel' => $channel);
- call_hooks('activity_received',$parr);
-
- add_source_route($item_id,$sender['hash']);
-
+ $item_id = 0;
+ if($item_result['success']) {
+ $item_id = $item_result['item_id'];
+ $parr = array('item_id' => $item_id,'item' => $arr,'sender' => $sender,'channel' => $channel);
+ call_hooks('activity_received',$parr);
+ add_source_route($item_id,$sender['hash']);
+ }
$result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
}