From 3e79a19e579b19d04ec3d28d59799d76cf685735 Mon Sep 17 00:00:00 2001 From: Michael Vogel <icarus@dabo.de> Date: Mon, 14 Mar 2016 08:11:14 +0100 Subject: [PATCH] Some more function calls changed to the new class --- include/Contact.php | 2 +- include/contact_selectors.php | 2 +- include/delivery.php | 8 ++++---- include/diaspora2.php | 10 ++++++++-- include/follow.php | 2 +- include/notifier.php | 6 +++--- include/queue.php | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 3799e0b18..d76c8f826 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -129,7 +129,7 @@ function terminate_friendship($user,$self,$contact) { } elseif($contact['network'] === NETWORK_DIASPORA) { require_once('include/diaspora.php'); - diaspora_unshare($user,$contact); + diaspora::send_unshare($user,$contact); } elseif($contact['network'] === NETWORK_DFRN) { require_once('include/dfrn.php'); diff --git a/include/contact_selectors.php b/include/contact_selectors.php index a884a6b52..3bf68f764 100644 --- a/include/contact_selectors.php +++ b/include/contact_selectors.php @@ -99,7 +99,7 @@ function network_to_name($s, $profile = "") { $networkname = str_replace($search,$replace,$s); - if (($s == NETWORK_DIASPORA) AND ($profile != "") AND diaspora_is_redmatrix($profile)) { + if (($s == NETWORK_DIASPORA) AND ($profile != "") AND diaspora::is_redmatrix($profile)) { $networkname = t("Hubzilla/Redmatrix"); $r = q("SELECT `gserver`.`platform` FROM `gcontact` diff --git a/include/delivery.php b/include/delivery.php index d184fe12e..1e1dadcd9 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -522,25 +522,25 @@ function delivery_run(&$argv, &$argc){ if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) { // top-level retraction - logger('delivery: diaspora retract: '.$loc); - + logger('diaspora retract: '.$loc); diaspora::send_retraction($target_item,$owner,$contact,$public_message); //diaspora_send_retraction($target_item,$owner,$contact,$public_message); break; } elseif ($followup) { // send comments and likes to owner to relay + logger('diaspora followup: '.$loc); diaspora::send_followup($target_item,$owner,$contact,$public_message); //diaspora_send_followup($target_item,$owner,$contact,$public_message); break; } elseif ($target_item['uri'] !== $target_item['parent-uri']) { // we are the relay - send comments, likes and relayable_retractions to our conversants - logger('delivery: diaspora relay: '.$loc); + logger('diaspora relay: '.$loc); diaspora::send_relay($target_item,$owner,$contact,$public_message); //diaspora_send_relay($target_item,$owner,$contact,$public_message); break; } elseif ($top_level && !$walltowall) { // currently no workable solution for sending walltowall - logger('delivery: diaspora status: '.$loc); + logger('diaspora status: '.$loc); diaspora::send_status($target_item,$owner,$contact,$public_message); //diaspora_send_status($target_item,$owner,$contact,$public_message); break; diff --git a/include/diaspora2.php b/include/diaspora2.php index f6b8b9a70..5c17754e8 100644 --- a/include/diaspora2.php +++ b/include/diaspora2.php @@ -460,6 +460,8 @@ class diaspora { * @return string The public key */ private function key($handle) { + $handle = strval($handle); + logger("Fetching diaspora key for: ".$handle); $r = self::person_by_handle($handle); @@ -1699,7 +1701,7 @@ class diaspora { } // Check if the sender is the thread owner - $p = q("SELECT `author-link`, `origin` FROM `item` WHERE `id` = %d", + $p = q("SELECT `id`, `author-link`, `origin` FROM `item` WHERE `id` = %d", intval($r[0]["parent"])); // Only delete it if the parent author really fits @@ -1716,7 +1718,7 @@ class diaspora { ); delete_thread($r[0]["id"], $r[0]["parent-uri"]); - logger("Deleted target ".$target_guid." from user ".$importer["uid"], LOGGER_DEBUG); + logger("Deleted target ".$target_guid." (".$r[0]["id"].") from user ".$importer["uid"]." parent: ".$p[0]["id"], LOGGER_DEBUG); // Now check if the retraction needs to be relayed by us if($p[0]["origin"]) { @@ -1727,6 +1729,8 @@ class diaspora { intval($r[0]["id"]), dbesc(json_encode($data)) ); + $s = q("select * from sign where retract_iid = %d", intval($r[0]["id"])); + logger("Stored signatur for item ".$r[0]["id"]." - ".print_r($s, true), LOGGER_DEBUG); // notify others proc_run("php", "include/notifier.php", "drop", $r[0]["id"]); @@ -2341,6 +2345,8 @@ class diaspora { $type = "comment"; } + logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG); + // fetch the original signature $r = q("SELECT `signed_text`, `signature`, `signer` FROM `sign` WHERE `".$sql_sign_id."` = %d LIMIT 1", diff --git a/include/follow.php b/include/follow.php index 3af629536..6eab7e12f 100644 --- a/include/follow.php +++ b/include/follow.php @@ -303,7 +303,7 @@ function new_contact($uid,$url,$interactive = false) { } if($contact['network'] == NETWORK_DIASPORA) { require_once('include/diaspora.php'); - $ret = diaspora_share($a->user,$contact); + $ret = diaspora::send_share($a->user,$contact); logger('mod_follow: diaspora_share returns: ' . $ret); } } diff --git a/include/notifier.php b/include/notifier.php index 6c42f19c6..e65da3adf 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -536,7 +536,7 @@ function notifier_run(&$argv, &$argc){ if($public_message) { if (!$followup AND $top_level) - $r0 = diaspora_fetch_relay(); + $r0 = diaspora::relay_list(); else $r0 = array(); @@ -629,11 +629,11 @@ function notifier_run(&$argv, &$argc){ } // If the item was deleted, clean up the `sign` table - if($target_item['deleted']) { + /* if($target_item['deleted']) { $r = q("DELETE FROM sign where `retract_iid` = %d", intval($target_item['id']) ); - } + } */ logger('notifier: calling hooks', LOGGER_DEBUG); diff --git a/include/queue.php b/include/queue.php index 183ce0f9c..878c14973 100644 --- a/include/queue.php +++ b/include/queue.php @@ -193,7 +193,7 @@ function queue_run(&$argv, &$argc){ case NETWORK_DIASPORA: if($contact['notify']) { logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>'); - $deliver_status = diaspora_transmit($owner,$contact,$data,$public,true); + $deliver_status = diaspora::transmit($owner,$contact,$data,$public,true); if($deliver_status == (-1)) { update_queue_time($q_item['id']);