Diaspora: Send the profile data after a successful connect

This commit is contained in:
Michael Vogel 2016-07-10 13:11:09 +02:00
parent 19377f2a9c
commit 9ac26802ce

View file

@ -1981,6 +1981,9 @@ class diaspora {
if($u) { if($u) {
logger("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], LOGGER_DEBUG); 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); $ret = self::send_share($u[0], $contact_record);
// Send the profile data, maybe it weren't transmitted before
self::send_profile($importer["uid"], array($contact_record));
} }
} }
@ -3204,11 +3207,12 @@ class diaspora {
* *
* @param int $uid The user id * @param int $uid The user id
*/ */
public static function send_profile($uid) { public static function send_profile($uid, $recips = false) {
if (!$uid) if (!$uid)
return; return;
if (!$recips)
$recips = q("SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s' $recips = q("SELECT `id`,`name`,`network`,`pubkey`,`notify` FROM `contact` WHERE `network` = '%s'
AND `uid` = %d AND `rel` != %d", AND `uid` = %d AND `rel` != %d",
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
@ -3278,9 +3282,11 @@ class diaspora {
"searchable" => $searchable, "searchable" => $searchable,
"tag_string" => $tags); "tag_string" => $tags);
foreach($recips as $recip) foreach($recips as $recip) {
logger("Send updated profile data for user ".$uid." to contact ".$recip["id"], LOGGER_DEBUG);
self::build_and_transmit($profile, $recip, "profile", $message, false, "", true); self::build_and_transmit($profile, $recip, "profile", $message, false, "", true);
} }
}
/** /**
* @brief Stores the signature for likes that are created on our system * @brief Stores the signature for likes that are created on our system