}
}
+ // Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
+ $r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
+ WHERE `hidewall` OR NOT `net-publish` AND `user`.`uid` = %d",
+ intval($owner['uid']));
+ if ($r)
+ xml::add_element($doc, $author, "dfrn:hide", "true");
+
return $author;
}
$author["link"] = $xpath->evaluate($element."/atom:uri/text()", $context)->item(0)->nodeValue;
$r = q("SELECT `id`, `uid`, `url`, `network`, `avatar-date`, `name-date`, `uri-date`, `addr`,
- `name`, `nick`, `about`, `location`, `keywords`, `bdyear`, `bd`
+ `name`, `nick`, `about`, `location`, `keywords`, `bdyear`, `bd`, `hidden`
FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` != '%s'",
intval($importer["uid"]), dbesc(normalise_link($author["link"])), dbesc(NETWORK_STATUSNET));
if ($r) {
/// - poco:region
/// - poco:country
+ // The profile is searchable if it contains poco data
+ $searchable = (isset($poco["name"]) OR isset($poco["nick"]) OR isset($poco["about"]) OR isset($poco["location"]));
+
+ // If the "hide" element is present then the profile isn't searchable.
+ // Since this element is new (version >= 3.5), we need the check above as well.
+ if ($xpath->evaluate($element."/dfrn:hide/text()", $context)->item(0)->nodeValue == "true")
+ $searchable = false;
+
+ // If the contact isn't searchable then set the contact to "hidden".
+ // Problem: This can be manually overridden by the user.
+ if (!$searchable)
+ $contact["hidden"] = true;
+
// Save the keywords into the contact table
$tags = array();
$tagelements = $xpath->evaluate($element."/poco:tags/text()", $context);
logger("Update contact data for contact ".$contact["id"]." (".$contact["nick"].")", LOGGER_DEBUG);
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s',
- `addr` = '%s', `keywords` = '%s', `bdyear` = '%s', `bd` = '%s',
+ `addr` = '%s', `keywords` = '%s', `bdyear` = '%s', `bd` = '%s', `hidden` = %d,
`name-date` = '%s', `uri-date` = '%s'
WHERE `id` = %d AND `network` = '%s'",
dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["about"]), dbesc($contact["location"]),
dbesc($contact["addr"]), dbesc($contact["keywords"]), dbesc($contact["bdyear"]),
- dbesc($contact["bd"]), dbesc($contact["name-date"]), dbesc($contact["uri-date"]),
- intval($contact["id"]), dbesc($contact["network"]));
+ dbesc($contact["bd"]), intval($contact["hidden"]), dbesc($contact["name-date"]),
+ dbesc($contact["uri-date"]), intval($contact["id"]), dbesc($contact["network"]));
}
update_contact_avatar($author["avatar"], $importer["uid"], $contact["id"],
$poco["generation"] = 2;
$poco["photo"] = $author["avatar"];
+ $poco["hide"] = !$searchable;
update_gcontact($poco);
}
/**
* @file include/diaspora.php
* @brief The implementation of the diaspora protocol
- *
- * Checklist:
- *
- * Checked:
- * - send status
- * - send comment
- * - send like
- * - send mail
- * - send status retraction
- * - send comment retraction on own post
- * - send like retraction on own post
- * - send comment retraction on diaspora post
- * - send like retraction on diaspora post
- * - receive status
- * - receive reshare
- * - receive comment
- * - receive like
- * - receive connect request
- * - receive profile data
- * - receive mail
- * - receive comment retraction
- * - receive like retraction
- * - relay comment
- * - relay like
- * - relay comment retraction from diaspora
- * - relay comment retraction from friendica
- * - relay like retraction from diaspora
- * - relay like retraction from friendica
- * - send share
- *
- * Should work:
- * - receive account deletion
- * - send unshare
- *
- * Unchecked:
*/
+/// @todo reshare of some reshare doesn't work well, see guid c1d534b0ed19013358694860008dbc6c
+// 14f571c0f244013358694860008dbc6c
+
require_once("include/items.php");
require_once("include/bb2diaspora.php");
require_once("include/Scrape.php");
if ($contact["network"] == NETWORK_STATUSNET)
$contact["network"] = NETWORK_OSTATUS;
+ // All new contacts are hidden by default
+ if (!isset($contact["hide"]))
+ $contact["hide"] = true;
+
// Replace alternate OStatus user format with the primary one
fix_alternate_contact_address($contact);
$doprobing = (((time() - $last_contact) > (90 * 86400)) AND ((time() - $last_failure) > (90 * 86400)));
}
} else {
- q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `generation`)
- VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
+ q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `hide`, `generation`)
+ VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
dbesc($contact["name"]),
dbesc($contact["nick"]),
dbesc($contact["addr"]),
dbesc(datetime_convert()),
dbesc($contact["location"]),
dbesc($contact["about"]),
+ intval($contact["hide"]),
intval($contact["generation"])
);