From 19377f2a9c4b89d53fb6c50e7e8e6f91ecde712b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 10 Jul 2016 12:18:10 +0200 Subject: [PATCH] Just make the bugfix a little bit simpler --- include/diaspora.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index f6ac59ed8..a23a7d278 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1855,12 +1855,7 @@ class diaspora { // If we are now friends, we are sending a share message. // Normally we needn't to do so, but the first message could have been vanished. if (in_array($contact["rel"], array(CONTACT_IS_FRIEND, CONTACT_IS_FOLLOWER))) { - $u = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, - `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, - `user`.`page-flags`, `user`.`prvnets`, `user`.`guid` - FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` - WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", - intval($importer["uid"])); + $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($importer["uid"])); if($u) { logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); $ret = self::send_share($u[0], $contact); @@ -1982,12 +1977,7 @@ class diaspora { intval($contact_record["id"]) ); - $u = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, - `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, - `user`.`page-flags`, `user`.`prvnets`, `user`.`guid` - FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` - WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", - intval($importer["uid"])); + $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($importer["uid"])); if($u) { logger("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); $ret = self::send_share($u[0], $contact_record); @@ -2677,6 +2667,10 @@ class diaspora { logger('message: '.$msg, LOGGER_DATA); logger('send guid '.$guid, LOGGER_DEBUG); + // Fallback if the private key wasn't transmitted in the expected field + if ($owner['uprvkey'] == "") + $owner['uprvkey'] = $owner['prvkey']; + $slap = self::build_message($msg, $owner, $contact, $owner['uprvkey'], $contact['pubkey'], $public_batch); if ($spool) {