aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-16 00:59:43 -0800
committerfriendica <info@friendica.com>2013-01-16 00:59:43 -0800
commita9f4a47a35eecad03c9c0da58a3febc99fd87453 (patch)
tree603afbbde45be1e32398a6d458b73144858057f8 /include/zot.php
parentddd8a0e062964cc18a7ef54828019ee28e63175b (diff)
downloadvolse-hubzilla-a9f4a47a35eecad03c9c0da58a3febc99fd87453.tar.gz
volse-hubzilla-a9f4a47a35eecad03c9c0da58a3febc99fd87453.tar.bz2
volse-hubzilla-a9f4a47a35eecad03c9c0da58a3febc99fd87453.zip
import events (not just event posts) from zot
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/include/zot.php b/include/zot.php
index 55e2dbe92..f01b0f63f 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -885,13 +885,40 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
continue;
}
-
if($arr['item_restrict'] & ITEM_DELETED) {
delete_imported_item($sender,$arr,$channel['channel_id']);
$result[] = array($d['hash'],'deleted');
continue;
}
+ // for events, extract the event info and create and event linked to an item
+
+ if((x($arr,'obj_type')) && (activity_compare($arr['obj_type'],ACTIVITY_OBJ_EVENT))) {
+ require_once('include/event.php');
+ $ev = bbtoevent($arr['body']);
+ if(x($ev,'desc') && x($ev,'start')) {
+ $ev['event_xchan'] = $arr['author_xchan'];
+ $ev['uid'] = $channel['channel_id'];
+ $ev['account'] = $channel['channel_account_id'];
+ $ev['edited'] = $arr['edited'];
+
+ // is this an edit?
+
+ $r = q("SELECT * FROM event left join item on resource_id = event_hash WHERE resource_type = 'event' and
+ `uri` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($arr['uri']),
+ intval($importer['uid'])
+ );
+ if($r)
+ $ev['event_hash'] = $r[0]['event_hash'];
+ $xyz = event_store($ev);
+ $result = array($d['hash'],'event processed');
+ continue;
+ }
+ }
+
+
+
$r = q("select id, edited from item where uri = '%s' and uid = %d limit 1",
dbesc($arr['uri']),
intval($channel['channel_id'])