diff --git a/include/diaspora.php b/include/diaspora.php index 95673996f..69d2dff19 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -257,8 +257,8 @@ function diaspora_get_contact_by_handle($uid,$handle) { function diaspora_request($importer,$xml) { - $sender_handle = $xml->sender_handle; - $recipient_handle = $xml->recipient_handle; + $sender_handle = unxmlify($xml->sender_handle); + $recipient_handle = unxmlify($xml->recipient_handle); if(! $sender_handle || ! $recipient_handle) return; @@ -303,21 +303,12 @@ function diaspora_request($importer,$xml) { ); // find the contact record we just created - $contact_record = null; - if($r) { - $r = q("SELECT `id` FROM `contact` - WHERE `uid` = %d AND `addr` = '%s' AND `poll` = '%s' LIMIT 1", - intval($importer['uid']), - $ret['addr'], - $ret['poll'] - ); - if(count($r)) - $contact_record = $r[0]; - } + + $contact_record = diaspora_get_contact_by_handle($importer['uid'],$sender_handle); $hash = random_string() . (string) time(); // Generate a confirm_key - if(is_array($contact_record)) { + if($contact_record) { $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`,`blocked`) VALUES ( %d, %d, 1, %d, '%s', '%s', '%s', 0 )", intval($importer['uid']), @@ -328,10 +319,8 @@ function diaspora_request($importer,$xml) { dbesc(datetime_convert()) ); } - return; - } function diaspora_post($importer,$xml) { @@ -370,7 +359,6 @@ function diaspora_post($importer,$xml) { ); } - $created = unxmlify($xml->created_at); $private = ((unxmlify($xml->public) == 'false') ? 1 : 0); @@ -422,7 +410,6 @@ function diaspora_post($importer,$xml) { return; - } function diaspora_comment($importer,$xml) {