aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-05 17:14:11 -0700
committerzotlabs <mike@macgirvin.com>2017-04-05 17:14:11 -0700
commit6710a77c26b9f5d621ad839cadeefb08fa066aa2 (patch)
tree8253b2f4bbf5484f45f81a762c7aad61073bc45c /include
parenta4685e6df38dd530b348268f383f59a993607cad (diff)
parenta4f6c24273f5ba321b7255ec228f677483fd3fa3 (diff)
downloadvolse-hubzilla-6710a77c26b9f5d621ad839cadeefb08fa066aa2.tar.gz
volse-hubzilla-6710a77c26b9f5d621ad839cadeefb08fa066aa2.tar.bz2
volse-hubzilla-6710a77c26b9f5d621ad839cadeefb08fa066aa2.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index e3147dea4..c3b57f6cb 100755
--- a/include/items.php
+++ b/include/items.php
@@ -777,6 +777,38 @@ function import_author_xchan($x) {
}
return($y);
+
+}
+
+/**
+ * @brief Imports an author from Diaspora.
+ *
+ * @param array $x an associative array with
+ * * \e string \b address
+ * @return boolean|string false on error, otherwise xchan_hash of the new entry
+ */
+function import_author_diaspora($x) {
+ if(! $x['address'])
+ return false;
+
+ $r = q("select * from xchan where xchan_addr = '%s' limit 1",
+ dbesc($x['address'])
+ );
+ if($r) {
+ logger('in_cache: ' . $x['address'], LOGGER_DATA);
+ return $r[0]['xchan_hash'];
+ }
+
+ if(discover_by_webbie($x['address'])) {
+ $r = q("select xchan_hash from xchan where xchan_addr = '%s' limit 1",
+ dbesc($x['address'])
+ );
+ if($r)
+ return $r[0]['xchan_hash'];
+ }
+
+ return false;
+
}
/**