Events are now shared with Diaspora.
This commit is contained in:
parent
5222bd2264
commit
55ee80338f
6 changed files with 36 additions and 15 deletions
2
boot.php
2
boot.php
|
@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
|||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1210 );
|
||||
define ( 'DB_UPDATE_VERSION', 1211 );
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 3.5.1-dev (Asparagus)
|
||||
-- DB_UPDATE_VERSION 1210
|
||||
-- DB_UPDATE_VERSION 1211
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -212,6 +212,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
|
|||
--
|
||||
CREATE TABLE IF NOT EXISTS `event` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`cid` int(11) NOT NULL DEFAULT 0,
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
|
|
|
@ -622,6 +622,7 @@ function db_definition($charset) {
|
|||
$database["event"] = array(
|
||||
"fields" => array(
|
||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
|
||||
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
|
|
|
@ -2949,7 +2949,7 @@ class Diaspora {
|
|||
*/
|
||||
private static function build_event($event_id) {
|
||||
|
||||
$r = q("SELECT `uid`, `start`, `finish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
|
||||
$r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
|
||||
if (!dbm::is_result($r)) {
|
||||
return array();
|
||||
}
|
||||
|
@ -2965,22 +2965,37 @@ class Diaspora {
|
|||
|
||||
$user = $r[0];
|
||||
|
||||
if ($event['adjust']) {
|
||||
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
|
||||
if (!dbm::is_result($r)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$owner = $r[0];
|
||||
|
||||
$eventdata['author'] = self::my_handle($owner);
|
||||
|
||||
if ($event['guid']) {
|
||||
$eventdata['guid'] = $event['guid'];
|
||||
}
|
||||
|
||||
$mask = 'Y-m-d\TH:i:s\Z';
|
||||
|
||||
/// @todo
|
||||
$eventdata["all_day"] = "false";
|
||||
|
||||
if (!$event['adjust']) {
|
||||
$eventdata['timezone'] = $user['timezone'];
|
||||
|
||||
if ($eventdata['timezone'] == "") {
|
||||
$eventdata['timezone'] = 'UTC';
|
||||
}
|
||||
$mask = 'Y-m-d\TH:i:s\Z';
|
||||
} else {
|
||||
$mask = 'Y-m-d\TH:i:s';
|
||||
}
|
||||
|
||||
if ($event['start']) {
|
||||
$eventdata['start'] = datetime_convert("UTC", "UTC", $event['start'], $mask);
|
||||
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
||||
}
|
||||
if ($event['finish']) {
|
||||
$eventdata['end'] = datetime_convert("UTC", "UTC", $event['finish'], $mask);
|
||||
if ($event['finish'] AND !$event['nofinish']) {
|
||||
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
||||
}
|
||||
if ($event['summary']) {
|
||||
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
|
||||
|
@ -3083,6 +3098,9 @@ class Diaspora {
|
|||
$event = self::build_event($item['event-id']);
|
||||
if (count($event)) {
|
||||
$message['event'] = $event;
|
||||
|
||||
/// @todo Once Diaspora supports it, we will remove the body
|
||||
// $message['raw_message'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ function event_store($arr) {
|
|||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
||||
$arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid']));
|
||||
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
||||
$arr['guid'] = get_guid(32);
|
||||
|
||||
if($arr['cid'])
|
||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
@ -333,16 +334,16 @@ function event_store($arr) {
|
|||
call_hooks("event_updated", $arr['id']);
|
||||
|
||||
return $item_id;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
// New event. Store it.
|
||||
|
||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||
$r = q("INSERT INTO `event` (`uid`,`cid`,`guid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||
intval($arr['uid']),
|
||||
intval($arr['cid']),
|
||||
dbesc($arr['guid']),
|
||||
dbesc($arr['uri']),
|
||||
dbesc($arr['created']),
|
||||
dbesc($arr['edited']),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define('UPDATE_VERSION' , 1210);
|
||||
define('UPDATE_VERSION' , 1211);
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue